Class: LockstepSdk::CurrencyRateModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/currency_rate_model.rb

Overview

Represents a currency rate for specific currencies and date

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ CurrencyRateModel

Initialize the CurrencyRateModel using the provided prototype



25
26
27
28
29
30
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 25

def initialize(params = {})
    @source_currency = params.dig(:source_currency)
    @destination_currency = params.dig(:destination_currency)
    @date = params.dig(:date)
    @currency_rate = params.dig(:currency_rate)
end

Instance Attribute Details

#currency_rateDouble

Returns The currency rate value.

Returns:

  • (Double)

    The currency rate value



46
47
48
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 46

def currency_rate
  @currency_rate
end

#dateDate

Returns The date for the currency rate.

Returns:

  • (Date)

    The date for the currency rate



42
43
44
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 42

def date
  @date
end

#destination_currencyString

Returns The destination currency.

Returns:

  • (String)

    The destination currency



38
39
40
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 38

def destination_currency
  @destination_currency
end

#source_currencyString

Returns The source currency.

Returns:

  • (String)

    The source currency



34
35
36
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 34

def source_currency
  @source_currency
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



50
51
52
53
54
55
56
57
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 50

def as_json(options={})
    {
        'sourceCurrency' => @source_currency,
        'destinationCurrency' => @destination_currency,
        'date' => @date,
        'currencyRate' => @currency_rate,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



61
62
63
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 61

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end