Serapke / ExchangeRate

Ruby library for obtaining FX rates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExchangeRate

Foreign currency exchange library.

Example Ruby on Rails application repository:

https://github.com/Serapke/ExchangeRateApp

Usage

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

Installation

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!

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.

About

Ruby library for obtaining FX rates

License:MIT License


Languages

Language:Ruby 83.1%Language:HTML 12.4%Language:JavaScript 2.7%Language:CSS 1.8%