Class: CognitoIdp::Token
- Inherits:
-
Object
- Object
- CognitoIdp::Token
- Defined in:
- lib/cognito_idp/token.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
-
#expires_in ⇒ Object
readonly
Returns the value of attribute expires_in.
-
#id_token ⇒ Object
readonly
Returns the value of attribute id_token.
-
#token_type ⇒ Object
readonly
Returns the value of attribute token_type.
Instance Method Summary collapse
-
#initialize(token_hash) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(token_hash) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 12 13 14 15 |
# File 'lib/cognito_idp/token.rb', line 7 def initialize(token_hash) token_hash.transform_keys(&:to_sym).tap do |values| @access_token = values[:access_token] @id_token = values[:id_token] @token_type = values[:token_type] @expires_in = values[:expires_in] end @expires_at = Time.now + expires_in unless expires_in.nil? end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/cognito_idp/token.rb', line 5 def access_token @access_token end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
5 6 7 |
# File 'lib/cognito_idp/token.rb', line 5 def expires_at @expires_at end |
#expires_in ⇒ Object (readonly)
Returns the value of attribute expires_in.
5 6 7 |
# File 'lib/cognito_idp/token.rb', line 5 def expires_in @expires_in end |
#id_token ⇒ Object (readonly)
Returns the value of attribute id_token.
5 6 7 |
# File 'lib/cognito_idp/token.rb', line 5 def id_token @id_token end |
#token_type ⇒ Object (readonly)
Returns the value of attribute token_type.
5 6 7 |
# File 'lib/cognito_idp/token.rb', line 5 def token_type @token_type end |