Skip to content

Instantly share code, notes, and snippets.

@cored
Created May 22, 2013 20:58
Show Gist options
  • Save cored/1887df0997798b92b127 to your computer and use it in GitHub Desktop.
Save cored/1887df0997798b92b127 to your computer and use it in GitHub Desktop.
class AuthorizationConnectionValidator
def self.validate(authorization)
begin
authorization.errors.add(:authentication,
"Login credentials are incorrect. Please change") if authorization.errors.empty? && authorization.system != 'dummy' && !authorization.ticketmaster.valid?
rescue Timeout::Error, ActiveResource::TimeoutError,
ActiveResource::ServerError
authorization.errors.add(:timeout,
"Your tracker server provider timed out")
rescue => exc
authorization.errors.add(:authentication,
"Login credentials are incorrect. Please change")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment