Class: API::Support::TokenWithExpiration

Inherits:
Object
  • Object
show all
Defined in:
lib/api/support/token_with_expiration.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/api/support/token_with_expiration.rb', line 19

def expirable?
  @strategy.expirable?
end

#tokenObject



11
12
13
# File 'lib/api/support/token_with_expiration.rb', line 11

def token
  @strategy.get_token(@instance)
end

#token_expires_atObject



15
16
17
# File 'lib/api/support/token_with_expiration.rb', line 15

def token_expires_at
  @strategy.expires_at(@instance)
end