Class: VlatkoDawanda::Bank
- Inherits:
-
Object
- Object
- VlatkoDawanda::Bank
- Defined in:
- lib/vlatko_dawanda/bank.rb
Instance Method Summary collapse
- #conversion_rates(base_currency, currencies) ⇒ Object
- #currencies ⇒ Object
- #find_currency(search) ⇒ Object
Instance Method Details
#conversion_rates(base_currency, currencies) ⇒ Object
4 5 6 |
# File 'lib/vlatko_dawanda/bank.rb', line 4 def conversion_rates(base_currency, currencies) @currencies = parse_currencies(base_currency, currencies) end |
#currencies ⇒ Object
8 9 10 |
# File 'lib/vlatko_dawanda/bank.rb', line 8 def currencies @currencies ||= {} end |
#find_currency(search) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/vlatko_dawanda/bank.rb', line 12 def find_currency(search) currency = case search when ::String, ::Symbol currencies[currency_id(search)] when Currency found = currencies[currency_id(search.iso_code)] raise UnknownCurrency.new('currency not matching the rate') unless found == search found end raise UnknownCurrency.new('currency not found') if currency.nil? currency end |