Class: CurrenciesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/clients/currencies_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(lockstepsdk) ⇒ CurrenciesClient

Initialize the CurrenciesClient class with a lockstepsdk instance.



25
26
27
# File 'lib/lockstep_sdk/clients/currencies_client.rb', line 25

def initialize(lockstepsdk)
    @lockstepsdk = lockstepsdk
end

Instance Method Details

#bulk_currency_data(destination_currency:, body:) ⇒ Object

Receives an array of dates and currencies and a destination currency and returns an array of the corresponding currency rates to the given destination currency (Limit X).



50
51
52
53
54
# File 'lib/lockstep_sdk/clients/currencies_client.rb', line 50

def bulk_currency_data(destination_currency:, body:)
    path = "/api/v1/Currencies/bulk"
    params = {:destinationCurrency => destination_currency}
    @lockstepsdk.request(:post, path, body, params)
end

#retrieve_currency_rate(source_currency:, destination_currency:, date:, data_provider:) ⇒ Object

Retrieve a currency conversation rate from one currency to another as of the specified date. Optionally, you can specify which currency data provider to use.

The currency rate model contains all of the information used to make the API call, plus the rate to              use for the conversion.


39
40
41
42
43
# File 'lib/lockstep_sdk/clients/currencies_client.rb', line 39

def retrieve_currency_rate(source_currency:, destination_currency:, date:, data_provider:)
    path = "/api/v1/Currencies/#{sourceCurrency}/#{destinationCurrency}"
    params = {:date => date, :dataProvider => data_provider}
    @lockstepsdk.request(:get, path, nil, params)
end