money-open-exchange-rates 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.markdown +1 -1
- data/lib/money/bank/open_exchange_rates_bank.rb +1 -1
- data/test/open_exchange_rates_bank_test.rb +21 -20
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d4627d2362f3d25776f0c16eac6dc34cd2b5ff9
|
4
|
+
data.tar.gz: cbeee2c8c0ba9be2e6b14104f72b13b18f4f2ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78e27850a154eec72b5ba6effbd4cdc0fcecaa23d75a4f2fc77b7e6da885cff9026ece0d2fa9cecca10c0d00921b11a64ddaf7011717fd5fbf79f6172f8d6fe0
|
7
|
+
data.tar.gz: 359705aa410f98fdd525f5d91da0b9437178461568725f1b12e2d7ffe53f8e5b91ac8a89e3b4470a0d853e1ce674d35f16d0baf9fba447f1779325b41ed7ae5a
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2011 Laurent Arnoud <laurent@spkdev.net>
|
3
|
+
Copyright (c) 2011-2015 Laurent Arnoud <laurent@spkdev.net>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.markdown
CHANGED
@@ -73,7 +73,7 @@ shpupti (1)
|
|
73
73
|
|
74
74
|
The MIT License
|
75
75
|
|
76
|
-
Copyright ©
|
76
|
+
Copyright © 2011-2015 Laurent Arnoud <laurent@spkdev.net>
|
77
77
|
|
78
78
|
---
|
79
79
|
[![Gem Version](https://badge.fury.io/rb/money-open-exchange-rates.svg)](https://rubygems.org/gems/money-open-exchange-rates)
|
@@ -12,7 +12,7 @@ class Money
|
|
12
12
|
# OpenExchangeRatesBank base class
|
13
13
|
class OpenExchangeRatesBank < Money::Bank::VariableExchange
|
14
14
|
OER_URL = 'http://openexchangerates.org/latest.json'
|
15
|
-
SECURE_OER_URL = OER_URL.
|
15
|
+
SECURE_OER_URL = OER_URL.gsub('http:', 'https:')
|
16
16
|
|
17
17
|
attr_accessor :cache, :app_id, :secure_connection
|
18
18
|
attr_reader :doc, :oer_rates, :rates_expiration, :ttl_in_seconds
|
@@ -161,6 +161,7 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
161
161
|
subject.secure_connection = true
|
162
162
|
subject.app_id = TEST_APP_ID
|
163
163
|
subject.source_url.must_equal "#{secure_url}?app_id=#{TEST_APP_ID}"
|
164
|
+
subject.source_url.must_include "https://"
|
164
165
|
end
|
165
166
|
end
|
166
167
|
|
@@ -256,34 +257,34 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
256
257
|
before do
|
257
258
|
subject.app_id = TEST_APP_ID
|
258
259
|
subject.ttl_in_seconds = 1000
|
259
|
-
@
|
260
|
-
|
260
|
+
@old_usd_eur_rate = 0.655
|
261
|
+
# see test/latest.json +52
|
262
|
+
@new_usd_eur_rate = 0.79085
|
263
|
+
subject.add_rate('USD', 'EUR', @old_usd_eur_rate)
|
261
264
|
subject.cache = temp_cache_path
|
262
|
-
stub(
|
263
|
-
|
264
|
-
end
|
265
|
+
stub(subject).read_from_url { File.read cache_path }
|
266
|
+
subject.save_rates
|
265
267
|
end
|
266
268
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
Timecop.freeze(new_time)
|
271
|
-
end
|
272
|
-
|
273
|
-
after do
|
274
|
-
Timecop.return
|
275
|
-
end
|
269
|
+
after do
|
270
|
+
File.delete temp_cache_path
|
271
|
+
end
|
276
272
|
|
273
|
+
describe 'when the ttl has expired' do
|
277
274
|
it 'should update the rates' do
|
278
|
-
subject.
|
279
|
-
|
275
|
+
subject.get_rate('USD', 'EUR').must_equal @old_usd_eur_rate
|
276
|
+
Timecop.freeze(Time.now + 1001) do
|
277
|
+
subject.get_rate('USD', 'EUR').wont_equal @old_usd_eur_rate
|
278
|
+
subject.get_rate('USD', 'EUR').must_equal @new_usd_eur_rate
|
279
|
+
end
|
280
280
|
end
|
281
281
|
|
282
282
|
it 'updates the next expiration time' do
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
283
|
+
Timecop.freeze(Time.now + 1001) do
|
284
|
+
exp_time = Time.now + 1000
|
285
|
+
subject.expire_rates
|
286
|
+
subject.rates_expiration.must_equal exp_time
|
287
|
+
end
|
287
288
|
end
|
288
289
|
end
|
289
290
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money-open-exchange-rates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest-line
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.6'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: pry
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|