Class: FidorApi::Token
- Inherits:
-
Object
- Object
- FidorApi::Token
- Defined in:
- lib/fidor_api/token.rb
Constant Summary collapse
- ATTRIBUTES =
%i[ access_token expires_in token_type refresh_token ].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.
12 13 14 15 16 17 18 |
# File 'lib/fidor_api/token.rb', line 12 def initialize(args = {}) args.each do |key, value| next unless ATTRIBUTES.include?(key.to_sym) instance_variable_set("@#{key}", value) end end |
Instance Method Details
#to_h ⇒ Object
20 21 22 |
# File 'lib/fidor_api/token.rb', line 20 def to_h Hash[ATTRIBUTES.map { |key| [key, instance_variable_get("@#{key}")] }] end |