FxRates is a Ruby library that allows you to convert from one currency to another using exchange rates from a given service.
Add this line to your application's Gemfile:
gem 'fx_rates', github: 'overture8/fx_rates'
And then execute:
Or install it yourself as:
$ gem install fx_rates
require 'fx_rates' ExchangeRate.at(Date.today, 'GBP', 'USD')
Can be ran by cron job to cache API data to key/value store
require 'fx_rates' FxRates.configure do |config| config.parser = FxRates::Api::Parser::Ecb config.store = Moneta.new(:File, dir: 'db/moneta') end
FxRates provides a way for different API parsers to be integrated. See the
direct for examples of how to implement different strategies. Currently supported:-
- ECB - European Central Bank
The Moneta library is used for providing a unified interface for key/value stores. This is to allow different key/value stores to be swapped in and out when required. See the moneta docs for a list of the available stores.
bundle exec guard
- Fork it ( https://github.com/[my-github-username]/fx_rates/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