Class: GoCardlessPro::Resources::CurrencyExchangeRate

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/currency_exchange_rate.rb

Overview

Currency exchange rates from our foreign exchange provider.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ CurrencyExchangeRate

Initialize a currency_exchange_rate resource instance

Parameters:

  • object (Hash)

    an object returned from the API



24
25
26
27
28
29
30
31
32
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 24

def initialize(object, response = nil)
  @object = object

  @rate = object['rate']
  @source = object['source']
  @target = object['target']
  @time = object['time']
  @response = response
end

Instance Attribute Details

#rateObject (readonly)

Returns the value of attribute rate.



17
18
19
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 17

def rate
  @rate
end

#sourceObject (readonly)

Returns the value of attribute source.



18
19
20
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 18

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



19
20
21
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 19

def target
  @target
end

#timeObject (readonly)

Returns the value of attribute time.



20
21
22
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 20

def time
  @time
end

Instance Method Details

#api_responseObject



34
35
36
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 34

def api_response
  ApiResponse.new(@response)
end

#to_hObject

Provides the currency_exchange_rate resource as a hash of all its readable attributes



39
40
41
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 39

def to_h
  @object
end