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.

Parameters:

  • lockstepsdk (LockstepApi)

    The Lockstep API client object for this connection



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).

Parameters:

  • destination_currency (string)

    The currency to convert to.

  • body (BulkCurrencyConversionModel)

    A list of dates and source currencies.



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.

Parameters:

  • source_currency (string)

    The ISO 4217 currency code of the origin currency. For a list of currency codes, call List Currencies.

  • destination_currency (string)

    The ISO 4217 currency code of the target currency. For a list of currency codes, call List Currencies.

  • date (date)

    The date for which we should cto use for this currency conversion.

  • data_provider (string)

    Optionally, you can specify a data provider.



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