Class: Berbix::Tokens
- Inherits:
-
Object
- Object
- Berbix::Tokens
- Defined in:
- lib/berbix.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#client_token ⇒ Object
readonly
Returns the value of attribute client_token.
-
#expiry ⇒ Object
readonly
Returns the value of attribute expiry.
-
#refresh_token ⇒ Object
readonly
Returns the value of attribute refresh_token.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(refresh_token, access_token = nil, client_token = nil, expiry = nil, transaction_id = nil, response = nil) ⇒ Tokens
constructor
A new instance of Tokens.
- #needs_refresh? ⇒ Boolean
- #refresh!(access_token, client_token, expiry, transaction_id) ⇒ Object
Constructor Details
#initialize(refresh_token, access_token = nil, client_token = nil, expiry = nil, transaction_id = nil, response = nil) ⇒ Tokens
Returns a new instance of Tokens.
62 63 64 65 66 67 68 69 |
# File 'lib/berbix.rb', line 62 def initialize(refresh_token, access_token=nil, client_token=nil, expiry=nil, transaction_id=nil, response=nil) @refresh_token = refresh_token @access_token = access_token @client_token = client_token @expiry = expiry @transaction_id = transaction_id @response = response end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
60 61 62 |
# File 'lib/berbix.rb', line 60 def access_token @access_token end |
#client_token ⇒ Object (readonly)
Returns the value of attribute client_token.
60 61 62 |
# File 'lib/berbix.rb', line 60 def client_token @client_token end |
#expiry ⇒ Object (readonly)
Returns the value of attribute expiry.
60 61 62 |
# File 'lib/berbix.rb', line 60 def expiry @expiry end |
#refresh_token ⇒ Object (readonly)
Returns the value of attribute refresh_token.
60 61 62 |
# File 'lib/berbix.rb', line 60 def refresh_token @refresh_token end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
60 61 62 |
# File 'lib/berbix.rb', line 60 def response @response end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
60 61 62 |
# File 'lib/berbix.rb', line 60 def transaction_id @transaction_id end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
60 61 62 |
# File 'lib/berbix.rb', line 60 def user_id @user_id end |
Class Method Details
Instance Method Details
#needs_refresh? ⇒ Boolean
78 79 80 |
# File 'lib/berbix.rb', line 78 def needs_refresh? @access_token.nil? || @expiry.nil? || @expiry < Time.now end |
#refresh!(access_token, client_token, expiry, transaction_id) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/berbix.rb', line 71 def refresh!(access_token, client_token, expiry, transaction_id) @access_token = access_token @client_token = client_token @expiry = expiry @transaction_id = transaction_id end |