cnb 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7258b91abda4684ba20e7f057cacc405608eac4d
4
- data.tar.gz: f5218a603a1f96285627001d9ed4b8f890aae7f0
3
+ metadata.gz: 5900cf0a63e8bfba9da32eb6e36f70898cb0a4c2
4
+ data.tar.gz: 099dad1d8d2db942144c5b11ffb20f416ead3e4e
5
5
  SHA512:
6
- metadata.gz: faf1a3221cb1a415ac00cfac3bb31503a5aaf433abeb47490311ffd7d7fe3984aeaa79b547b1351a08d0c114eecfea3ad02d84fa698a75494f7e7bb9a77bb745
7
- data.tar.gz: d9cdce86836c8179dc0bbb86154acd1b3662cb1ae7f896791d3c599150436d79e570fa87fc4e5ac26b6c4f8219e30a1b19e6d50e15286c96c190f010831bc4f1
6
+ metadata.gz: b5f7595d50d3cc5834ed71b73b90a5d9f786fd5ba503e6b9e4e26ac29662542b26acabfe812bc4e15be660ba767d7a4c23a337e167735f9eed73efe27c3aa922
7
+ data.tar.gz: 7c8e69002530cb07323d2b63ccae74940d39b22ab73586f079e9b51054ec0c823fb337a36708c7a72ccbd6cc2f182478fa1a230225751fd9d6898887b8f27b12
data/.gitignore CHANGED
@@ -8,6 +8,7 @@
8
8
  Gemfile.lock
9
9
  coverage
10
10
  rdoc
11
+ pkg
11
12
 
12
13
  ## PROJECT::SPECIFIC
13
14
  config/*.yml
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # CNB [![Build Status](https://travis-ci.org/ucetnictvi-on-line/cnb.png?branch=master)](https://travis-ci.org/ucetnictvi-on-line/cnb)
1
+ # CNB
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/cnb.png)](http://badge.fury.io/rb/cnb)
4
+ [![Build Status](https://travis-ci.org/ucetnictvi-on-line/cnb.png?branch=master)](https://travis-ci.org/ucetnictvi-on-line/cnb)
2
5
 
3
6
  CNB is a gem that will help you get daily and monthly currency rates for czech crown (CZK) from Czech National Bank. Besides the currency rate you can also get name of the currency, name of the country where it is used and date when the currency rates were published.
4
7
 
@@ -38,6 +41,8 @@ Get name of the country where the currency comes from in czech language.
38
41
 
39
42
  CNB.country('USD') # USA
40
43
 
44
+ The currency code is not case sensitive.
45
+
41
46
  Get date when the currency rates were published. Czech National Bank does not publish currency rates during the weekend, so may want to check when exactly were the values published.
42
47
 
43
48
  CNB.date
@@ -21,6 +21,7 @@ module CNB
21
21
  protected
22
22
 
23
23
  def get_currency(cur_code)
24
+ cur_code.upcase!
24
25
  raise 'Currency with given code was not found in exchange rates list' unless @currencies[cur_code]
25
26
  @currencies[cur_code]
26
27
  end
data/lib/cnb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CNB
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -16,6 +16,10 @@ describe CNB::DailyCurRatesParser do
16
16
  expect(@parser.rate('USD')).to eq(19.927)
17
17
  end
18
18
 
19
+ it 'returns currency rate no matter the case of currency code' do
20
+ expect(@parser.rate('usd')).to eq(19.927)
21
+ end
22
+
19
23
  it 'raises error if currency with given code is not included in the exchange rates file' do
20
24
  expect{@parser.rate('USX')}.to raise_error(StandardError)
21
25
  end
@@ -28,6 +28,10 @@ describe CNB::MonthlyCurRatesParser do
28
28
  expect(@parser.rate('HNL')).to eq(1.024)
29
29
  end
30
30
 
31
+ it 'returns currency rate no matter the case of the currency code' do
32
+ expect(@parser.rate('hnl')).to eq(1.024)
33
+ end
34
+
31
35
  it 'raises error if currency wth given code is not included in the exchange rates file' do
32
36
  expect{@parser.rate('HNX')}.to raise_error(StandardError)
33
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Zikán