Class: NedbankApi::Models::IntentToken
- Defined in:
- lib/nedbank_api/models/intent_token.rb
Constant Summary collapse
- ERRORS =
{ token_expired: { error: 'token_expired', error_description: 'Intent Access Token has expired' } }
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#error_description ⇒ Object
Returns the value of attribute error_description.
-
#token_expires_at ⇒ Object
Returns the value of attribute token_expires_at.
Attributes inherited from BaseModel
Instance Method Summary collapse
Methods inherited from BaseModel
#__getobj__, #__setobj__, #initialize
Constructor Details
This class inherits a constructor from NedbankApi::Models::BaseModel
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
11 12 13 |
# File 'lib/nedbank_api/models/intent_token.rb', line 11 def error @error end |
#error_description ⇒ Object
Returns the value of attribute error_description.
11 12 13 |
# File 'lib/nedbank_api/models/intent_token.rb', line 11 def error_description @error_description end |
#token_expires_at ⇒ Object
Returns the value of attribute token_expires_at.
11 12 13 |
# File 'lib/nedbank_api/models/intent_token.rb', line 11 def token_expires_at @token_expires_at end |
Instance Method Details
#authenticated? ⇒ Boolean
19 20 21 22 |
# File 'lib/nedbank_api/models/intent_token.rb', line 19 def authenticated? return false if self.access_token.nil? !expired? end |
#expired? ⇒ Boolean
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/nedbank_api/models/intent_token.rb', line 24 def expired? return true if self.expires_in.nil? raise Exceptions::TokenExpired if token_expires_at < Time.now return false rescue Exceptions::TokenExpired self.error = ERRORS[:token_expired][:error] self.error_description = ERRORS[:token_expired][:error_description ] return true end |