Class: LockstepSdk::CurrencyRateModel
- Inherits:
-
Object
- Object
- LockstepSdk::CurrencyRateModel
- Defined in:
- lib/lockstep_sdk/models/currency_rate_model.rb
Overview
Represents a currency rate for specific currencies and date
Instance Attribute Summary collapse
-
#currency_rate ⇒ Double
The currency rate value.
-
#date ⇒ Date
The date for the currency rate.
-
#destination_currency ⇒ String
The destination currency.
-
#source_currency ⇒ String
The source currency.
Instance Method Summary collapse
-
#as_json(options = {}) ⇒ object
This object as a JSON key-value structure.
-
#initialize(params = {}) ⇒ CurrencyRateModel
constructor
Initialize the CurrencyRateModel using the provided prototype.
-
#to_json(*options) ⇒ String
This object converted to a JSON string.
Constructor Details
#initialize(params = {}) ⇒ CurrencyRateModel
Initialize the CurrencyRateModel using the provided prototype
28 29 30 31 32 33 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 28 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_rate ⇒ Double
Returns The currency rate value.
49 50 51 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 49 def currency_rate @currency_rate end |
#date ⇒ Date
Returns The date for the currency rate.
45 46 47 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 45 def date @date end |
#destination_currency ⇒ String
Returns The destination currency.
41 42 43 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 41 def destination_currency @destination_currency end |
#source_currency ⇒ String
Returns The source currency.
37 38 39 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 37 def source_currency @source_currency end |
Instance Method Details
#as_json(options = {}) ⇒ object
Returns This object as a JSON key-value structure.
53 54 55 56 57 58 59 60 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 53 def as_json(={}) { 'sourceCurrency' => @source_currency, 'destinationCurrency' => @destination_currency, 'date' => @date, 'currencyRate' => @currency_rate, } end |
#to_json(*options) ⇒ String
Returns This object converted to a JSON string.
64 65 66 |
# File 'lib/lockstep_sdk/models/currency_rate_model.rb', line 64 def to_json(*) "[#{as_json(*).to_json(*)}]" end |