cnb 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cnb.rb +5 -9
- data/lib/cnb/version.rb +1 -1
- data/spec/cnb_spec.rb +0 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8bebe99129e461c1bceb59a2a43f1754221488e
|
4
|
+
data.tar.gz: 31d620b7020a35a9a82d692d51d7daa085864565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7751cf538513923175f62e5321b306ea0d773dfdc9471be30e205e387c888e47212eb6e7196ec0e4ab53bda0359fc2a52928905a81b731da56b62d54e48e8b1
|
7
|
+
data.tar.gz: f2a93574bb6034564afd3af9b657f39c888f0143b28471ba35f98f3f9a12aca08893ae45c69b6828100a6f2ebdae81f6099372a8f2849f330a6d9f979bcbf6f9
|
data/lib/cnb.rb
CHANGED
@@ -1,21 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'cnb/currency_rates'
|
2
|
+
require 'cnb/daily_rates'
|
3
|
+
require 'cnb/monthly_rates'
|
4
4
|
|
5
5
|
module CNB
|
6
6
|
PRIMARY_CURRENCY = 'CZK'
|
7
7
|
|
8
|
-
@rates_objects = {}
|
9
|
-
|
10
8
|
class << self
|
11
9
|
def daily_rates
|
12
|
-
|
13
|
-
@rates_objects[key] ||= DailyRates.new
|
10
|
+
DailyRates.new
|
14
11
|
end
|
15
12
|
|
16
13
|
def monthly_rates(month, year)
|
17
|
-
|
18
|
-
@rates_objects[key] ||= MonthlyRates.new(month, year)
|
14
|
+
MonthlyRates.new(month, year)
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
data/lib/cnb/version.rb
CHANGED
data/spec/cnb_spec.rb
CHANGED
@@ -9,11 +9,6 @@ describe 'CNB' do
|
|
9
9
|
it 'returns DailyRates object' do
|
10
10
|
expect(CNB.daily_rates).to be_a(CNB::DailyRates)
|
11
11
|
end
|
12
|
-
|
13
|
-
it 'always returns the same object' do
|
14
|
-
rates = CNB.daily_rates
|
15
|
-
expect(CNB.daily_rates.object_id).to eq rates.object_id
|
16
|
-
end
|
17
12
|
end
|
18
13
|
|
19
14
|
describe '#monthly_rates' do
|
@@ -24,11 +19,5 @@ describe 'CNB' do
|
|
24
19
|
it 'returns MonthlyRates object' do
|
25
20
|
expect(CNB.monthly_rates(11,2013)).to be_a(CNB::MonthlyRates)
|
26
21
|
end
|
27
|
-
|
28
|
-
it 'always returns the same object for the same combination of month and year params' do
|
29
|
-
rates = CNB.monthly_rates(11, 2013)
|
30
|
-
expect(CNB.monthly_rates(11, 2013).object_id).to eq rates.object_id
|
31
|
-
expect(CNB.monthly_rates(10, 2013).object_id).not_to eq rates.object_id
|
32
|
-
end
|
33
22
|
end
|
34
23
|
end
|