Class: FidorApi::Token
- Inherits:
-
Object
- Object
- FidorApi::Token
- Includes:
- ActiveModel::Model
- Defined in:
- lib/fidor_api/token.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#state ⇒ Object
Returns the value of attribute state.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
Instance Method Summary collapse
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
6 7 8 |
# File 'lib/fidor_api/token.rb', line 6 def access_token @access_token end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
6 7 8 |
# File 'lib/fidor_api/token.rb', line 6 def expires_at @expires_at end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
6 7 8 |
# File 'lib/fidor_api/token.rb', line 6 def refresh_token @refresh_token end |
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'lib/fidor_api/token.rb', line 6 def state @state end |
#token_type ⇒ Object
Returns the value of attribute token_type.
6 7 8 |
# File 'lib/fidor_api/token.rb', line 6 def token_type @token_type end |
Instance Method Details
#expires_in=(value) ⇒ Object
12 13 14 |
# File 'lib/fidor_api/token.rb', line 12 def expires_in=(value) self.expires_at = Time.now + value.seconds end |
#to_hash ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fidor_api/token.rb', line 16 def to_hash { access_token: access_token, expires_at: expires_at, token_type: token_type, refresh_token: refresh_token, state: state } end |
#valid? ⇒ Boolean
8 9 10 |
# File 'lib/fidor_api/token.rb', line 8 def valid? expires_at >= Time.now end |