Class: OpenIdAuthentication::Result
- Inherits:
-
Object
- Object
- OpenIdAuthentication::Result
- Defined in:
- lib/open_id_authentication/lib/open_id_authentication.rb
Constant Summary collapse
- ERROR_MESSAGES =
{ :missing => "Sorry, the OpenID server couldn't be found", :canceled => "OpenID verification was canceled", :failed => "OpenID verification failed", :setup_needed => "OpenID verification needs setup" }
Class Method Summary collapse
Instance Method Summary collapse
- #===(code) ⇒ Object
-
#initialize(code) ⇒ Result
constructor
A new instance of Result.
- #message ⇒ Object
- #successful? ⇒ Boolean
- #unsuccessful? ⇒ Boolean
Constructor Details
#initialize(code) ⇒ Result
Returns a new instance of Result.
39 40 41 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 39 def initialize(code) @code = code end |
Class Method Details
.[](code) ⇒ Object
35 36 37 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 35 def self.[](code) new(code) end |
Instance Method Details
#===(code) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 43 def ===(code) if code == :unsuccessful && unsuccessful? true else @code == code end end |
#message ⇒ Object
61 62 63 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 61 def ERROR_MESSAGES[@code] end |
#successful? ⇒ Boolean
53 54 55 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 53 def successful? @code == :successful end |
#unsuccessful? ⇒ Boolean
57 58 59 |
# File 'lib/open_id_authentication/lib/open_id_authentication.rb', line 57 def unsuccessful? ERROR_MESSAGES.keys.include?(@code) end |