Class: Toke::AccessToken
- Inherits:
-
Object
- Object
- Toke::AccessToken
- Defined in:
- lib/toke/models/access_token.rb
Instance Attribute Summary collapse
-
#expires ⇒ Object
Returns the value of attribute expires.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(hash = {}) ⇒ AccessToken
constructor
A new instance of AccessToken.
Constructor Details
#initialize(hash = {}) ⇒ AccessToken
Returns a new instance of AccessToken.
5 6 7 8 9 |
# File 'lib/toke/models/access_token.rb', line 5 def initialize(hash = {}) @token = hash['access_token'] @expires = hash['expires_in'] @created_at = Time.now end |
Instance Attribute Details
#expires ⇒ Object
Returns the value of attribute expires.
3 4 5 |
# File 'lib/toke/models/access_token.rb', line 3 def expires @expires end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/toke/models/access_token.rb', line 3 def token @token end |
Instance Method Details
#expired? ⇒ Boolean
11 12 13 |
# File 'lib/toke/models/access_token.rb', line 11 def expired? Time.now > @created_at + expires - (expires / 12) end |