Wraps a simple scraper to retrieve the historic exchange rates. Returns the average rates for yesterday or any day specified and supported by the Central Bank of Kenya.
Add this line to your application's Gemfile:
gem 'historic_bank_rates'
And then execute:
$ bundle
Or install it yourself as:
$ gem install historic_bank_rates
scraper = HistoricBankRates::BankScrapers::CentralBankOfKenya.new
hbr = HistoricBankRates::Rates.new(scraper, Date.new(2016, 05, 30))
hbr.import! # => true
import! returns true if rates have been found. Might also throw HTTP errors. It will also return false when requesting rates for weekend days.
Update an instance's import_date and rerun the import process:
hbr.import!(Date.new(2015, 06, 30)) # => true
hbr.rate('KES', 'EUR') # => 112.2322
Get all available currencies:
hbr.currencies # => ['ZAR', 'USD', 'EUR', 'RWF'… ]
Get all rates
hbr.rates # => { 'ZAR'=>6.4373, 'USD'=>100.6606, … }
The author of this gem is not affiliated with any of the banks referenced/scraped by the gem.
MIT, see LICENSE file
The Software is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.