Class: ExchangeRatesNBP::Clients::CurrencyDataSet
- Inherits:
-
Object
- Object
- ExchangeRatesNBP::Clients::CurrencyDataSet
- Defined in:
- lib/exchange_rates_nbp/clients/currency_data_set.rb
Constant Summary collapse
- SELECTOR_CURRENCY_ELEMENT =
'tabela_kursow pozycja'.freeze
- FIELD_AVERAGE_EXCHANGE_RATE =
'kurs_sredni'.freeze
- FIELD_CURRENCY_CODE =
'kod_waluty'.freeze
- FIELD_TABLE_NAME =
'numer_tabeli'.freeze
- FIELD_PUBLISH_DATE =
'data_publikacji'.freeze
- FIELD_CONVERSION_FACTOR =
'przelicznik'.freeze
Instance Method Summary collapse
- #exchange_rate(currency_code) ⇒ Object
-
#initialize(table_id) ⇒ CurrencyDataSet
constructor
A new instance of CurrencyDataSet.
Constructor Details
#initialize(table_id) ⇒ CurrencyDataSet
Returns a new instance of CurrencyDataSet.
14 15 16 |
# File 'lib/exchange_rates_nbp/clients/currency_data_set.rb', line 14 def initialize(table_id) @table_id = table_id end |
Instance Method Details
#exchange_rate(currency_code) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/exchange_rates_nbp/clients/currency_data_set.rb', line 18 def exchange_rate(currency_code) xml = Oga.parse_xml(data) doc = selected_currency_element(xml, currency_code) currency_element_to_hash(xml, doc) end |