Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ecb-currency_converter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ecb-currency_converter

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

ECB::CurrencyConverter

Currency Conversion using the European Central Bank's Euro foreign exchange reference rates. All calculations are performed and returned in +BigDecimal+.

Installation

Add this line to your application's Gemfile:

gem 'ecb-currency_converter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ecb-currency_converter

Usage

To convert between two currencies:

ECB::CurrencyConverter.exchange(100, 'EUR', 'USD').to_f
=> 133.74

ECB::CurrencyConverter.exchange(100, 'USD', 'EUR').to_f
=> 74.77194556602363

To convert between two currencies using historical data:

date = Date.parse('2013-05-17')

ECB::CurrencyConverter.exchange(100, 'EUR', 'USD', date).to_f
=> 128.69

ECB::CurrencyConverter.exchange(100, 'USD', 'EUR', date).to_f
=> 77.70611547128759

To get the most recent exchange rate between two currencies:

ECB::CurrencyConverter.rate('EUR', 'USD').to_f
=> 1.3374

ECB::CurrencyConverter.rate('USD', 'EUR').to_f
=> 0.7477194556602362

To get the historical exchange rate between two currencies:

date = Date.parse('2013-05-17')

ECB::CurrencyConverter.rate('EUR', 'USD', date).to_f
=> 1.2869

ECB::CurrencyConverter.rate('USD', 'EUR', date).to_f
=> 0.777061154712876

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 19 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc