fx_lib 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fx_lib/version.rb +1 -1
- data/lib/fx_lib.rb +2 -1
- data/lib/tasks/db_seed.rake +5 -0
- data/spec/acceptance/fx_lib_spec.rb +3 -3
- data/spec/acceptance/fx_table_spec.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7faf2c70cf0b0ac42eb025863ebd3a9d1f1fbc00
|
4
|
+
data.tar.gz: 9bd0c3a8e6dce41426adcbe57181433b0b34afd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fb1a6ba4bff52b1fb5a63f0b9ba065b6633ddf7ad378a1e970fb57e38546c98cb5f9a51817955f7848c489263c68b804799fb59b1a9014863b3d94c245229ed
|
7
|
+
data.tar.gz: 5a9721a8f3447821109b78c90a78cf2cf4baf3bbca81210144ff630dbf228945e80edb86cfa1ebf51ad2d39dc93257a702ddbd3c38d1564ac99940d68f6f96b3
|
data/lib/fx_lib/version.rb
CHANGED
data/lib/fx_lib.rb
CHANGED
@@ -46,7 +46,8 @@ module FxLib
|
|
46
46
|
file = open_xml_file(url)
|
47
47
|
no_of_days.times do |d|
|
48
48
|
#ToDo Account for weekends
|
49
|
-
date = (Date.today - d - 3).strftime("%Y-%m-%d")
|
49
|
+
#date = (Date.today - d - 3).strftime("%Y-%m-%d")
|
50
|
+
date = (Date.today - d).strftime("%Y-%m-%d")
|
50
51
|
extract = file.xpath("//Cube[@time='#{date}']/Cube")
|
51
52
|
puts date.inspect
|
52
53
|
extract.each do |e|
|
@@ -20,7 +20,7 @@ describe 'FxLib' do
|
|
20
20
|
it "should have a method for ExchangeRate.at" do
|
21
21
|
lambda do
|
22
22
|
FxLib::ExchangeRate.fetch_data(url, 1)
|
23
|
-
date = DateTime.new(2013,12,
|
23
|
+
date = DateTime.new(2013,12,16)
|
24
24
|
FxLib::ExchangeRate.at(date, 'GBP', 'USD')
|
25
25
|
end.should_not raise_error
|
26
26
|
end
|
@@ -33,8 +33,8 @@ describe 'FxLib' do
|
|
33
33
|
|
34
34
|
it 'should calculate exchange rate' do
|
35
35
|
FxLib::ExchangeRate.fetch_data(url, 1)
|
36
|
-
date = DateTime.new(2013,12,
|
36
|
+
date = DateTime.new(2013,12,16)
|
37
37
|
rate = FxLib::ExchangeRate.at(date, 'GBP', 'USD')
|
38
|
-
rate.should eq(1.
|
38
|
+
rate.should eq(1.6325)
|
39
39
|
end
|
40
40
|
end
|
@@ -7,6 +7,6 @@ describe 'Generating a fx table' do
|
|
7
7
|
|
8
8
|
it 'should fetch the data given correct url and date' do
|
9
9
|
FxLib::ExchangeRate.fetch_data(url, 1)
|
10
|
-
expect(FxRate.where(currency: 'USD', rate: '1.
|
10
|
+
expect(FxRate.where(currency: 'USD', rate: '1.3776')).not_to be_empty
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fx_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hsu
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/generators/fx_rate.rb
|
130
130
|
- lib/generators/fx_rate/migration/migration_generator.rb
|
131
131
|
- lib/generators/fx_rate/migration/templates/create_fx_rate_table.rb
|
132
|
+
- lib/tasks/db_seed.rake
|
132
133
|
- lib/tasks/test.rake
|
133
134
|
- spec/acceptance/fx_lib_spec.rb
|
134
135
|
- spec/acceptance/fx_table_spec.rb
|