module ExchangeRatesNBP
Constants
- BASE_URL
- DEFAULT_TABLE_TYPES
- FILE_NAME_CURRENT_YEAR
- FILE_NAME_YEAR_PATTERN
- TABLE_TYPES
'xnnnzrrmmdd.xml'
- VERSION
Public Class Methods
exchange_rate(date, currency_code, table = DEFAULT_TABLE_TYPES)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 37 def self.exchange_rate(date, currency_code, table = DEFAULT_TABLE_TYPES) exchange_rate_info(date, currency_code, table)[:exchange_rate] end
exchange_rate_info(date, currency_code, table = DEFAULT_TABLE_TYPES)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 41 def self.exchange_rate_info(date, currency_code, table = DEFAULT_TABLE_TYPES) table_id = find_table_id(date, table) exchange_rate_hash(table_id, currency_code) end
exchange_table_date(date, table = DEFAULT_TABLE_TYPES)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 28 def self.exchange_table_date(date, table = DEFAULT_TABLE_TYPES) exchange_table_info(date, table)[:publish_date] end
exchange_table_info(date, table = DEFAULT_TABLE_TYPES)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 32 def self.exchange_table_info(date, table = DEFAULT_TABLE_TYPES) table_id = find_table_id(date, table) exchange_table_hash(table_id) end
exchange_table_number(date, table = DEFAULT_TABLE_TYPES)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 24 def self.exchange_table_number(date, table = DEFAULT_TABLE_TYPES) exchange_table_info(date, table)[:exchange_table_name] end
Private Class Methods
exchange_rate_hash(table_id, currency_code)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 53 def exchange_rate_hash(table_id, currency_code) ExchangeRatesNBP::Clients::CurrencyDataSet .new(table_id) .exchange_rate(currency_code) end
exchange_table_hash(table_id)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 59 def exchange_table_hash(table_id) ExchangeRatesNBP::Clients::CurrencyDataSet .new(table_id) .exchange_table end
find_table_id(date, table)
click to toggle source
# File lib/exchange_rates_nbp.rb, line 49 def find_table_id(date, table) Clients::TableList.new(date.year, table).fetch_closest_to(date) end