Class: OpenIdAuthentication::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/passport/openid/protocol.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"
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Result

Returns a new instance of Result.



54
55
56
# File 'lib/passport/openid/protocol.rb', line 54

def initialize(code)
  @code = code
end

Class Method Details

.[](code) ⇒ Object



50
51
52
# File 'lib/passport/openid/protocol.rb', line 50

def self.[](code)
  new(code)
end

Instance Method Details

#messageObject



72
73
74
# File 'lib/passport/openid/protocol.rb', line 72

def message
  ERROR_MESSAGES[@code]
end

#statusObject



58
59
60
# File 'lib/passport/openid/protocol.rb', line 58

def status
  @code
end

#successful?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/passport/openid/protocol.rb', line 64

def successful?
  @code == :successful
end

#unsuccessful?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/passport/openid/protocol.rb', line 68

def unsuccessful?
  ERROR_MESSAGES.keys.include?(@code)
end