Currency Converter

Build Status Code Climate Test Coverage Dependency Status Inline docs

Moneyc is a library that allows you to get the exchange rate and conversion of one currency to another. This library uses the API of the European Central Bank via Fixer.io.

Get historical rates for any day since 1999 (2000 January 3).

Links:

Installation

gem 'moneyc'

or

gem install moneyc

Use it

require 'moneyc'

# Convert 7.55 EUR to USD
Moneyc::Converter.new(money: 7.55, from: 'EUR', to: 'USD').convert
# => Float

# Convert with specific date 7.55 EUR to USD
Moneyc::Converter.new(money: 7.55, from: 'EUR', to: 'USD', at: Time.now).convert
# => Float

# Get today rate (EUR to USD)
Moneyc::Converter.new(from: 'EUR', to: 'USD').rate
# => Integer or Float

# Get specific date rate (EUR to USD)
Moneyc::Converter.new(from: 'EUR', to: 'USD', at: Time.now).rate
# => Integer or Float