Sha256: 5c61d7a8c688b95b2127c48672fa1f1db296139da89206cdb8b32f8e456c807e
Contents?: true
Size: 862 Bytes
Versions: 2
Compression:
Stored size: 862 Bytes
Contents
module NedbankApi module Models class IntentToken < BaseModel ERRORS = { token_expired: { error: 'token_expired', error_description: 'Intent Access Token has expired' } } attr_accessor :token_expires_at, :error, :error_description def token_expires_at self.initialized_at + self.expires_in end def authenticated? return false if self.access_token.nil? !expired? end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nedbank_api-0.2.5 | lib/nedbank_api/models/intent_token.rb |
nedbank_api-0.2.2 | lib/nedbank_api/models/intent_token.rb |