Class: JsonTokenAuthentication::Responder
- Inherits:
-
Object
- Object
- JsonTokenAuthentication::Responder
- Includes:
- Utility
- Defined in:
- lib/json_token_authentication/responder.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
Instance Method Summary collapse
- #entity_token ⇒ Object
-
#initialize(entity) ⇒ Responder
constructor
A new instance of Responder.
- #invalid_token ⇒ Object
- #valid_token ⇒ Object
Methods included from Utility
Constructor Details
#initialize(entity) ⇒ Responder
Returns a new instance of Responder.
6 7 8 |
# File 'lib/json_token_authentication/responder.rb', line 6 def initialize(entity) @entity = entity end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
4 5 6 |
# File 'lib/json_token_authentication/responder.rb', line 4 def entity @entity end |
Instance Method Details
#entity_token ⇒ Object
14 15 16 |
# File 'lib/json_token_authentication/responder.rb', line 14 def entity_token entity.present? ? valid_token : invalid_token end |
#invalid_token ⇒ Object
10 11 12 |
# File 'lib/json_token_authentication/responder.rb', line 10 def invalid_token { :message => 'Invalid Username/Password' } end |
#valid_token ⇒ Object
18 19 20 21 22 23 |
# File 'lib/json_token_authentication/responder.rb', line 18 def valid_token { 'token' => generate_valid_tokens, JsonTokenAuthentication.entity_identifier_method_name => entity_identifier } end |