Gem for get exchange rates from cbr.ru
Add this line to your application's Gemfile:
gem 'cbr', github: '4itosik/cbr', branch: 'master'
And then execute:
$ bundle
cbr = Cbr::ExchangeRate.new(date: date, locale: locale)
valutes = cbr.valutes
return all valutes
default date = Time.now
, locale = :ru
Support ru and en locale.
You can get valute by Char Code, example
valute = Cbr::ExchangeRate.new.usd
Get list char codes, use
Cbr::ExchangeRate.new.char_codes
Use method rate
for Valute instanse, this method return rate for 1 nominal
Full example
usd_rate = Cbr::ExchangeRate.new.usd.rate
- Fork it ( https://github.com/[my-github-username]/cbr/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request