Class: TagAuth::TokenAssigner
- Inherits:
-
Object
- Object
- TagAuth::TokenAssigner
- Defined in:
- lib/tag_auth/token_assigner.rb
Instance Method Summary collapse
- #assign_token ⇒ Object
-
#initialize(model_instance) ⇒ TokenAssigner
constructor
A new instance of TokenAssigner.
Constructor Details
#initialize(model_instance) ⇒ TokenAssigner
Returns a new instance of TokenAssigner.
5 6 7 |
# File 'lib/tag_auth/token_assigner.rb', line 5 def initialize(model_instance) @model_instance = model_instance end |
Instance Method Details
#assign_token ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/tag_auth/token_assigner.rb', line 9 def assign_token token = generate_token @model_instance.update(authentication_token: token, authentication_token_valid_to: DateTime.current + TagAuth.configuration.token_validity_duration) token end |