Module: Mint::FixerCurrency
- Defined in:
- lib/mint/fixer_currency.rb,
lib/mint/fixer_currency/request.rb,
lib/mint/fixer_currency/version.rb,
lib/mint/fixer_currency/exceptions.rb
Overview
Access to foreign exchange rates from Fixer.io
Defined Under Namespace
Classes: FixerArgumentError, Request, WrongCurrencyError
Constant Summary collapse
- VERSION =
'0.1.0'.freeze
Class Method Summary collapse
-
.currencies ⇒ Array<Symbols>
List of available currencies.
-
.rates(currency = :USD, date = nil) ⇒ Hash
Gets you currency exchange rates.
Class Method Details
.currencies ⇒ Array<Symbols>
List of available currencies
24 25 26 27 |
# File 'lib/mint/fixer_currency.rb', line 24 def self.currencies %i[AUD BGN BRL CAD CHF CNY CZK DKK GBP HKD HRK HUF IDR ILS INR JPY KRW MXN MYR NOK NZD PHP PLN RON RUB SEK SGD TRY USD ZAR EUR] end |
.rates(currency = :USD, date = nil) ⇒ Hash
Gets you currency exchange rates
16 17 18 19 20 |
# File 'lib/mint/fixer_currency.rb', line 16 def self.rates(currency = :USD, date = nil) currency = currency.to_s.upcase.to_sym raise(WrongCurrencyError, currency) unless currencies.include? currency Request.new(currency, date).perform! end |