Class: FidorApi::Token

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(args = {}) ⇒ Token

Returns a new instance of Token.



12
13
14
15
16
# File 'lib/fidor_api/token.rb', line 12

def initialize(args = {})
  args.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Method Details

#to_hObject



18
19
20
# File 'lib/fidor_api/token.rb', line 18

def to_h
  Hash[ATTRIBUTES.map { |key| [key, instance_variable_get("@#{key}")] }]
end