Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

uolcz/cnb

Repository files navigation

CNB

Gem Version Build Status Dependency Status Code Climate Test Coverage

CNB is a gem that will help you get daily and monthly currency rates for czech crown (CZK) from Czech National Bank.

Install

Add following into your Gemfile

gem 'cnb'

Or install the gem by on your own

gem install cnb

Usage

Daily

CNB.daily_rate('AUD', Date.today)

Returns today's exchange rate between CZK and AUD. Input date defaults to Date.today so the above line can written like this:

CNB.daily_rate('AUD')

Monthly

CNB.monthly_rate('ALL', Date.today)

Returns today's exchange rate between CZK and ALL (Albanian lek).

Exceptions

  • DateTooOld - triggers when date entered is older than 24 years, or 10 years if monthly.
  • DateInFuture - triggers when date enetered is in future.
  • CurrencyMissing - triggers when currency is not present.
  • CurrencyNotSupported - triggers when currency is not in downloaded list of currencies.

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

License

MIT License. Copyright (c) 2014