Class: API::Support::TokenWithExpiration
- Inherits:
-
Object
- Object
- API::Support::TokenWithExpiration
- Defined in:
- lib/api/support/token_with_expiration.rb
Instance Method Summary collapse
- #expirable? ⇒ Boolean
-
#initialize(strategy, instance) ⇒ TokenWithExpiration
constructor
A new instance of TokenWithExpiration.
- #token ⇒ Object
- #token_expires_at ⇒ Object
Constructor Details
#initialize(strategy, instance) ⇒ TokenWithExpiration
Returns a new instance of TokenWithExpiration.
6 7 8 9 |
# File 'lib/api/support/token_with_expiration.rb', line 6 def initialize(strategy, instance) @strategy = strategy @instance = instance end |
Instance Method Details
#expirable? ⇒ Boolean
19 20 21 |
# File 'lib/api/support/token_with_expiration.rb', line 19 def expirable? @strategy.expirable? end |
#token ⇒ Object
11 12 13 |
# File 'lib/api/support/token_with_expiration.rb', line 11 def token @strategy.get_token(@instance) end |
#token_expires_at ⇒ Object
15 16 17 |
# File 'lib/api/support/token_with_expiration.rb', line 15 def token_expires_at @strategy.expires_at(@instance) end |