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



19
20
21
22
23
24
25
26
27
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 19

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.



15
16
17
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 15

def rate
  @rate
end

#sourceObject (readonly)

Returns the value of attribute source.



15
16
17
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 15

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



15
16
17
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 15

def target
  @target
end

#timeObject (readonly)

Returns the value of attribute time.



15
16
17
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 15

def time
  @time
end

Instance Method Details

#api_responseObject



29
30
31
# File 'lib/gocardless_pro/resources/currency_exchange_rate.rb', line 29

def api_response
  ApiResponse.new(@response)
end

#to_hObject

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



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

def to_h
  @object
end