fx_lib 0.0.8 → 0.0.9

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: aaf7694cbee01abeb151032b02f5b2de86aba248
4
- data.tar.gz: a29a55a2adde1a6a206af08e61c6016b88d77069
3
+ metadata.gz: b52e0cd3901cf653cb191615e4211d6da2cdb515
4
+ data.tar.gz: 8a0e03bb3c63e8598d8a966c4546c92ba011aad8
5
5
  SHA512:
6
- metadata.gz: fdb2066b30071e14bacf787ffbef58df3b7f0cb04942faa5e7d0cec6a65745294d81921691bc47b1274a591f053c4a843391f04f4e4cfccbd565e5e51829442d
7
- data.tar.gz: 27b2230942b7c363fdb2e1447abf7c7d6b3f3cf63fd5a19108ca508fb3a6d32ec9795a59f63cebd4274caf3d9bcd6e2cddd87c06ff539b392582437896d1a2f1
6
+ metadata.gz: 8af56e438918b3a8b99c53bf6c9fff1c4d82686d95e122ac2893d85fdff50a93e5671f6e6620d71fc7d142269ae628061853bdaa760e7aadcd54b6ec44f96fc4
7
+ data.tar.gz: 3c66eb59b8224111eac5cdb4e7a1988d445739b42b876c33c8bab2741d07bd87cdcc6e21419558653fd9d5749ccc2a71da7a105b8efa0385b39608de9a8d060b
data/lib/fx_lib/engine.rb CHANGED
@@ -2,5 +2,11 @@ require 'rails'
2
2
 
3
3
  module FxLib
4
4
  class Engine < Rails::Engine
5
+
6
+ initializer "fx_lib.load_app_instance_data" do |app|
7
+ FxLib.setup do |config|
8
+ config.app_root = app.root
9
+ end
10
+ end
5
11
  end
6
12
  end
@@ -1,3 +1,3 @@
1
1
  module FxLib
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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
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.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - hsu