Class: OpenIdAuthentication::Result
- Inherits:
-
Object
- Object
- OpenIdAuthentication::Result
- Defined in:
- lib/open_id_authentication/result.rb
Constant Summary collapse
- ERROR_MESSAGES =
{ missing: "Sorry, the OpenID server couldn't be found", invalid: "Sorry, but this does not appear to be a valid OpenID", canceled: "OpenID verification was canceled", failed: "OpenID verification failed", setup_needed: "OpenID verification needs setup", }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code) ⇒ Result
constructor
A new instance of Result.
- #message ⇒ Object
- #status ⇒ Object
- #successful? ⇒ Boolean
- #unsuccessful? ⇒ Boolean
Constructor Details
#initialize(code) ⇒ Result
Returns a new instance of Result.
17 18 19 |
# File 'lib/open_id_authentication/result.rb', line 17 def initialize(code) @code = code end |
Class Method Details
.[](code) ⇒ Object
12 13 14 |
# File 'lib/open_id_authentication/result.rb', line 12 def [](code) new(code) end |
Instance Method Details
#message ⇒ Object
35 36 37 |
# File 'lib/open_id_authentication/result.rb', line 35 def ERROR_MESSAGES[@code] end |
#status ⇒ Object
21 22 23 |
# File 'lib/open_id_authentication/result.rb', line 21 def status @code end |
#successful? ⇒ Boolean
27 28 29 |
# File 'lib/open_id_authentication/result.rb', line 27 def successful? @code == :successful end |
#unsuccessful? ⇒ Boolean
31 32 33 |
# File 'lib/open_id_authentication/result.rb', line 31 def unsuccessful? ERROR_MESSAGES.keys.include?(@code) end |