Class: DwollaV2::TokenWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/dwolla_v2/token_manager.rb

Constant Summary collapse

EXPIRES_IN_LEEWAY =
60

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ TokenWrapper

Returns a new instance of TokenWrapper.



30
31
32
33
# File 'lib/dwolla_v2/token_manager.rb', line 30

def initialize(token)
  @token = token
  @expires_at = Time.now.utc + @token.expires_in - EXPIRES_IN_LEEWAY
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



28
29
30
# File 'lib/dwolla_v2/token_manager.rb', line 28

def token
  @token
end

Instance Method Details

#is_expired?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/dwolla_v2/token_manager.rb', line 35

def is_expired?
  @expires_at < Time.now.utc
end