Foreign currency exchange library.
Example Ruby on Rails application repository:
https://github.com/Serapke/ExchangeRateApp
Create new rate instances:
ExchangeRate::Rate.instance.set(currency, rate, date)
Get rates from database:
ExchangeRate::Rate.instance.get(currency, date)
Convert currency using:
ExchangeRate::Rate.instance.at(date, from, to)
To access ActiveRecord class of Rate use class:
ExchangeRate::Record
Add this line to your application's Gemfile:
gem 'exchange_rate',
:git => 'https://github.com/Serapke/ExchangeRate.git'
And then execute:
$ bundle
After that:
$ rails g exchange_rate:install
This will create a new migration create_rates
Do a migration:
$ rails db:migrate
And you are good to go!
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.