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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94366a6b246afed2ed1db3dfdd4036c7006c56bd
4
- data.tar.gz: d04826efc36a667bcfff1383044005649973d959
3
+ metadata.gz: 7faf2c70cf0b0ac42eb025863ebd3a9d1f1fbc00
4
+ data.tar.gz: 9bd0c3a8e6dce41426adcbe57181433b0b34afd7
5
5
  SHA512:
6
- metadata.gz: 521eb7b1eedfdfaa2e049c488fa8458437c565602a037175792106985226f0b4b3083dd553335ac272176b9e3132a2170fa4965738bfc52f2b3c5a23a2ac4a13
7
- data.tar.gz: 244cd64c1ee2e0558853019063427aa1ac8c4b77bd0bbce41adef6cb01b4301835a0f3f5a970fa18d4aecf97fdb9bb5b989f111b22fccf6d9a9bcccfa5baf804
6
+ metadata.gz: 2fb1a6ba4bff52b1fb5a63f0b9ba065b6633ddf7ad378a1e970fb57e38546c98cb5f9a51817955f7848c489263c68b804799fb59b1a9014863b3d94c245229ed
7
+ data.tar.gz: 5a9721a8f3447821109b78c90a78cf2cf4baf3bbca81210144ff630dbf228945e80edb86cfa1ebf51ad2d39dc93257a702ddbd3c38d1564ac99940d68f6f96b3
@@ -1,3 +1,3 @@
1
1
  module FxLib
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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|
@@ -0,0 +1,5 @@
1
+ namespace :fx_lib do
2
+ task db_seed: :environment do
3
+ FxLib::ExchangeRate.fetch_data(ENV['FX_URL'],90)
4
+ end
5
+ end
@@ -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,13)
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,13)
36
+ date = DateTime.new(2013,12,16)
37
37
  rate = FxLib::ExchangeRate.at(date, 'GBP', 'USD')
38
- rate.should eq(1.6270)
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.3727')).not_to be_empty
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.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