fx_lib 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fx_lib/engine.rb +6 -0
- data/lib/fx_lib/version.rb +1 -1
- data/lib/fx_lib.rb +8 -0
- data/spec/acceptance/fx_lib_spec.rb +6 -0
- data/spec/acceptance/fx_table_spec.rb +0 -2
- 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: b52e0cd3901cf653cb191615e4211d6da2cdb515
|
4
|
+
data.tar.gz: 8a0e03bb3c63e8598d8a966c4546c92ba011aad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8af56e438918b3a8b99c53bf6c9fff1c4d82686d95e122ac2893d85fdff50a93e5671f6e6620d71fc7d142269ae628061853bdaa760e7aadcd54b6ec44f96fc4
|
7
|
+
data.tar.gz: 3c66eb59b8224111eac5cdb4e7a1988d445739b42b876c33c8bab2741d07bd87cdcc6e21419558653fd9d5749ccc2a71da7a105b8efa0385b39608de9a8d060b
|
data/lib/fx_lib/engine.rb
CHANGED
data/lib/fx_lib/version.rb
CHANGED
data/lib/fx_lib.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "fx_lib/version"
|
2
|
+
require "active_support/dependencies"
|
2
3
|
require "open-uri"
|
3
4
|
require "timeout"
|
4
5
|
require "nokogiri"
|
@@ -6,6 +7,13 @@ require "date"
|
|
6
7
|
require "time"
|
7
8
|
|
8
9
|
module FxLib
|
10
|
+
|
11
|
+
mattr_accessor :app_root
|
12
|
+
|
13
|
+
def self.setup
|
14
|
+
yield self
|
15
|
+
end
|
16
|
+
|
9
17
|
class ExchangeRate
|
10
18
|
def self.open_xml_file(url)
|
11
19
|
begin
|
@@ -4,6 +4,12 @@ require './lib/fx_lib.rb'
|
|
4
4
|
describe 'FxLib' do
|
5
5
|
url = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml"
|
6
6
|
|
7
|
+
it 'set up block yields self' do
|
8
|
+
FxLib.setup do |config|
|
9
|
+
assert_equal FxLib, config
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
#Tests for fetching data
|
8
14
|
it "should have a method ExchangeRate.fetch_data" do
|
9
15
|
lambda do
|
@@ -7,8 +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
|
-
puts FxRate.first.inspect
|
11
|
-
puts FxRate.last.inspect
|
12
10
|
expect(FxRate.where(currency: 'USD', rate: '1.3727')).not_to be_empty
|
13
11
|
end
|
14
12
|
end
|