Module: CNB

Defined in:
lib/cnb.rb,
lib/cnb/base.rb,
lib/cnb/config.rb,
lib/cnb/version.rb,
lib/cnb/daily_rates.rb,
lib/cnb/monthly_rates.rb

Overview

The main interface to CNB rates.

Defined Under Namespace

Classes: Base, CurrencyMissing, CurrencyNotSupported, DailyRates, DateInFuture, DateTooOld, MonthlyRates

Constant Summary collapse

BASE_URL =
'http://www.cnb.cz/cs/financni_trhy/devizovy_trh'
DAILY =
'/kurzy_devizoveho_trhu/denni_kurz.xml?date='
DAILY_MAX_PAST =
24
MONTHLY =
'/kurzy_ostatnich_men/kurzy.xml?mesic='
MONTHLY_SEP =
'&rok='
MONTHLY_MAX_PAST =
10
VERSION =
'2.0.2'

Class Method Summary collapse

Class Method Details

.daily_rate(currency, date = Date.today) ⇒ Object

Returns float with daily rate for given currency and date.



16
17
18
19
# File 'lib/cnb.rb', line 16

def self.daily_rate(currency, date = Date.today)
  daily_rates = DailyRates.new
  daily_rates.rate_for(currency, date)
end

.monthly_rate(currency, date = Date.today) ⇒ Object

Returns float with monthly rate for given currency and date.



22
23
24
25
# File 'lib/cnb.rb', line 22

def self.monthly_rate(currency, date = Date.today)
  monthly_rates = MonthlyRates.new
  monthly_rates.rate_for(currency, date)
end