4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/nbrb-api/currencies.rb', line 4
def daily_rates(date = Date.today)
response = call(:ex_rates_daily, message: {on_date: date.to_date})
rates = response.find(*%w{Body ExRatesDailyResponse ExRatesDailyResult diffgram new_data_set daily_ex_rates_on_date})
if rates.nil?
raise Nbrb::Api::GeneralError, "No exchange rates found for operation #{:ex_rates_daily}"
end
result = {}
[rates].flatten.each do |rate|
result[rate[:cur_abbreviation]] = cleanup_rate_row(rate)
end
result
end
|