Class: CurrencyConversion::ExchangeRatesEndpoint

Inherits:
Resource
  • Object
show all
Defined in:
lib/currency-conversion/endpoints/exchange_rates.rb

Overview

Latest Exchange Rates Endpoint

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from CurrencyConversion::Resource

Instance Method Details

#latest(base_currency: 'USD', currencies: nil) ⇒ ExchangeRates

Returns the latest exchange rates

Parameters:

  • base_currency (String) (defaults to: 'USD')

    The base currency to which all results are behaving relative to

  • currencies (Array<String>) (defaults to: nil)

    An aray of string of currency codes which you want to get. Default all currencies will be shown.

Returns:



15
16
17
18
19
# File 'lib/currency-conversion/endpoints/exchange_rates.rb', line 15

def latest(base_currency: 'USD', currencies: nil)
  params = { base_currency: base_currency }
  params[:currencies] = currencies.join(',') if currencies.present?
  ExchangeRates.new get_request('latest', params: params)
end