Project

exrates

0.0
No release in over a year
This gem allows you to fetch exchange rates from National Bank of Ukraine (bank.gov.ua) and perform currency conversion.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 6
 Project Readme

ExRates

ExRates is a Ruby gem, that fethes exchange rates from National Bank of Ukraine (bank.gov.ua) and perform currency conversion. With the help of this gem, you can easily find out the exchange rate for a certain date in relation to the hryvnia and convert one currency to another. This gem also uses another gem, called 'Money'. The documentation for this gem you can read here. On Rubygems you can find it here.

Installation

Add this line to your application's Gemfile:

gem 'exrates'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install exrates

Usage

Find out the exchange rate in relation to the hryvnia for a certain currency:

currency = ExRate.new

puts currency.rate('USD')

Find out the exchange rate for a specific date:

currency = ExRate.new('22.02.2022')

puts currency.rate('USD')

Convertion currency to hryvna:

usd = Money.new('1_00', 'USD')

result = ExRates.new.exchange(usd, 'UAH')

puts "1.00 USD -> UAH: #{result.format}"

Convertion one currency to another:

usd = Money.new('1_50', 'USD')

result = ExRates.new.exchange(usd, 'CAD')

puts "1.50 USD -> CAD: #{result.format}"

See the 'Money' gem's documentation for how to handle the Money object.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mashk4/exrates.