Class: SantanderChile::ApiClient::Token
- Inherits:
-
Object
- Object
- SantanderChile::ApiClient::Token
- Defined in:
- lib/santander_chile/api_client/token.rb
Constant Summary collapse
- ATTRIBUTES =
i[ access_token expires_in token_type refresh_token refresh_token_expires_in tokenJWT ].freeze
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Token
constructor
A new instance of Token.
- #to_h ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Token
Returns a new instance of Token.
15 16 17 18 19 20 21 |
# File 'lib/santander_chile/api_client/token.rb', line 15 def initialize(args = {}) args.to_h.each do |key, value| next unless ATTRIBUTES.include?(key.to_sym) instance_variable_set("@#{key}", value) end end |
Instance Method Details
#to_h ⇒ Object
23 24 25 |
# File 'lib/santander_chile/api_client/token.rb', line 23 def to_h Hash[ATTRIBUTES.map { |key| [key, instance_variable_get("@#{key}")] }] end |