money-open-exchange-rates 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +174 -0
- data/lib/money/bank/open_exchange_rates_bank.rb +1 -1
- data/lib/open_exchange_rates_bank/version.rb +1 -1
- data/test/integration/Gemfile +2 -0
- data/test/integration/Gemfile.lock +22 -0
- data/test/open_exchange_rates_bank_test.rb +66 -13
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4fb222d3e754934179c179c0f929cb81a9edea4
|
4
|
+
data.tar.gz: 2333bf1a480b635834bfb05c6b378782981073cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8971c43fdc68e4a969c4ec6660f59b4ad4f5d7b72abc2311e8f7011fb6f3a49e838b693f86304c8e738fa147f79b58381a61497609d13efb13c3de762a6bcabe
|
7
|
+
data.tar.gz: 886d5c8df122b357a33f6ea97c70fa2e2b1602da7b2b3545e674174dafc25752b3fb5dbf1c6ab495d804ff4d0ca9262838a8351345091f231d6645dc996a6ef8
|
data/History.md
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
|
2
|
+
v0.4.1 / 2015-12-06
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Add more test for latest and historical urls
|
6
|
+
* used the correct URL for secure historical
|
7
|
+
|
8
|
+
v0.4.0 / 2015-09-28
|
9
|
+
===================
|
10
|
+
|
11
|
+
* Add webmock helpers for tests
|
12
|
+
* No need for TEST_APP_ID with webmock
|
13
|
+
* Add ChangeLog
|
14
|
+
* Support historical data endpoint with date
|
15
|
+
* move version into a module not depending on money
|
16
|
+
* Remove encodings headers
|
17
|
+
* Better secure_connection tests
|
18
|
+
* Better temp_cache_path and read_from_url use on tests
|
19
|
+
* Update inch to 0.7
|
20
|
+
* Add Money::Bank::OpenExchangeRatesBank::VERSION
|
21
|
+
* Update minitest and timecop
|
22
|
+
* Use inch for doc suggest
|
23
|
+
* Improve doc for #valid_rates?
|
24
|
+
* Added jruby-9.0.0.0 to travis
|
25
|
+
* Rakefile: add --display-style-guide option to rubocop
|
26
|
+
* Improve code documentation
|
27
|
+
* Update money gem to 6.6
|
28
|
+
* Added license badge
|
29
|
+
* Improve code documentation
|
30
|
+
* Remove useless doc attr_reader
|
31
|
+
* Improve code documentation
|
32
|
+
* Improve documentation of OpenExchangeRatesBank class
|
33
|
+
* Run rubocop on default rake
|
34
|
+
* Added rake rubocop task
|
35
|
+
* Added inch documentation badge
|
36
|
+
* Rename README.markdown to README.md
|
37
|
+
* Update README
|
38
|
+
* Add jruby-head to travis
|
39
|
+
* Add travis notifications config
|
40
|
+
* Make rubocop happy
|
41
|
+
|
42
|
+
v0.3.1 / 2015-06-17
|
43
|
+
===================
|
44
|
+
|
45
|
+
* Fix secure oer url (see #22)
|
46
|
+
* Test fail for #22; https
|
47
|
+
* More clear spec for ttl (see #17)
|
48
|
+
* Add minitest-line for debug
|
49
|
+
* Update license date
|
50
|
+
* Update license date
|
51
|
+
|
52
|
+
v0.3.0 / 2015-06-14
|
53
|
+
===================
|
54
|
+
|
55
|
+
* add ruby-head to travis.yml
|
56
|
+
* gem: syntax check
|
57
|
+
* test: syntax check
|
58
|
+
* Syntax fix with rubocop
|
59
|
+
* Use tr instead of gsub
|
60
|
+
* update monetize to 1.3
|
61
|
+
* Tests for the secure_connection option
|
62
|
+
* Updated README to include secure_connection example
|
63
|
+
* Added the secure_connection option to enable HTTPS connections to OER
|
64
|
+
* travis: added 2.2.0 version
|
65
|
+
|
66
|
+
v0.2.3 / 2014-12-21
|
67
|
+
===================
|
68
|
+
|
69
|
+
* Bump to 0.2.3
|
70
|
+
* Upgrade money to 6.5.0 and monetize to 1.1.0
|
71
|
+
* update not present exchange rate and know exchange
|
72
|
+
* Update latest.json
|
73
|
+
* Doc save_rates and code cleanup
|
74
|
+
* adjust tests to intentionally remove AED from data file and test conversions to AED
|
75
|
+
* setup reverse rates (ie. XYZ -> USD)
|
76
|
+
* travis: cache bundler
|
77
|
+
* README: added badges [ci skip]
|
78
|
+
|
79
|
+
v0.2.0 / 2014-09-12
|
80
|
+
===================
|
81
|
+
|
82
|
+
* update contributors and authors
|
83
|
+
* travis: remove jruby-head
|
84
|
+
* use exchange_with and get_rate from VariableExchange
|
85
|
+
* tests: unify raise testing
|
86
|
+
* tests: @bank to subject
|
87
|
+
* Revert "travis: cache bundle remove 1.9.3,jruby"
|
88
|
+
* travis: cache bundle remove 1.9.3,jruby
|
89
|
+
* README: update
|
90
|
+
* update money gem to 6.2.1
|
91
|
+
* travis: added config
|
92
|
+
|
93
|
+
v0.1.7 / 2014-04-15
|
94
|
+
===================
|
95
|
+
|
96
|
+
* Bump to 0.1.7
|
97
|
+
* test: expire_rates implementation testing
|
98
|
+
* Remove useless boolean return for expire_rates
|
99
|
+
* Added pry gem for debug
|
100
|
+
* Add the ability to expire rates after a fixed amount of time
|
101
|
+
* test: use const for get rate
|
102
|
+
* update case description in spec
|
103
|
+
* getting rate implementation moved from #exchange_with to own method
|
104
|
+
* test: remove deprecation warning about money 6.1.0
|
105
|
+
* test: Remove RR deprecation warning
|
106
|
+
* Added license on gemspec
|
107
|
+
* README: typo
|
108
|
+
|
109
|
+
v0.1.5 / 2013-07-11
|
110
|
+
===================
|
111
|
+
|
112
|
+
* Added Rakefile for tests
|
113
|
+
* Merge pull request #10 from weynsee/remove_multi_json
|
114
|
+
* use vanilla json instead of multi_json
|
115
|
+
* require at least ruby 1.9.2
|
116
|
+
* fix failing tests
|
117
|
+
* use https protocol for rubygems.org to avoid warnings
|
118
|
+
|
119
|
+
v0.1.1 / 2012-10-01
|
120
|
+
===================
|
121
|
+
|
122
|
+
* Bump to v0.1.1
|
123
|
+
* Some cleanup in tests.
|
124
|
+
* Use TEST_APP_ID_PATH.
|
125
|
+
* Update README for tests and app_id.
|
126
|
+
* Refactoring to cope with Proc for cache, allowing greater flexibility
|
127
|
+
* Tidy up formatting
|
128
|
+
* Added app_id necessary for ongoing usage of OER API
|
129
|
+
|
130
|
+
v0.0.7 / 2012-07-23
|
131
|
+
===================
|
132
|
+
|
133
|
+
* Bump to v0.0.7
|
134
|
+
* Added contributors.
|
135
|
+
* Update documentation - update_rates must be called prior to attempting a currency conversation
|
136
|
+
* Raise unknown rate format if can't find an exchange rate (rather than FloatDomainError)
|
137
|
+
|
138
|
+
v0.0.6 / 2012-05-08
|
139
|
+
===================
|
140
|
+
|
141
|
+
* Added invalid json case for save_rates.
|
142
|
+
* Use cache for exchange test and use same_currency?
|
143
|
+
* Update spec for money 5.0.0 version.
|
144
|
+
* Make sure cache file isn't overwritten if json returns an error
|
145
|
+
* Don't error out when exchanging from a currency to itself even if there are no rates
|
146
|
+
* Restructure to prevent writing empty cache file, and add spec
|
147
|
+
|
148
|
+
v0.0.5 / 2012-03-29
|
149
|
+
===================
|
150
|
+
|
151
|
+
* Better tests.
|
152
|
+
* Fix over issue over integer type rate.
|
153
|
+
* overwrite cache file in a block to make sure it's closed after writing
|
154
|
+
* add failing test when calling update_rates after save_rates
|
155
|
+
* Remove warning: already initialized constant STRINGIFIED_KEYS
|
156
|
+
* make tests pass for money 4.0.2
|
157
|
+
* round numbers correctly to make tests pass in 1.8.7-p358
|
158
|
+
|
159
|
+
v0.0.4 / 2011-12-11
|
160
|
+
===================
|
161
|
+
|
162
|
+
* Skip exchange unknown by Money and fix tests.
|
163
|
+
* Sync latest openexchangerates.
|
164
|
+
|
165
|
+
v0.0.3 / 2011-10-19
|
166
|
+
===================
|
167
|
+
|
168
|
+
* Dont check file exist for a cache...
|
169
|
+
|
170
|
+
v0.0.2 / 2011-10-19
|
171
|
+
===================
|
172
|
+
|
173
|
+
* [bugfix] check file exist on filesystem.
|
174
|
+
* Initial commit.
|
@@ -21,7 +21,7 @@ class Money
|
|
21
21
|
OER_HISTORICAL_URL = 'http://openexchangerates.org/historical/%s.json'
|
22
22
|
# OpenExchangeRates secure url
|
23
23
|
SECURE_OER_URL = OER_URL.gsub('http:', 'https:')
|
24
|
-
SECURE_OER_HISTORICAL_URL =
|
24
|
+
SECURE_OER_HISTORICAL_URL = OER_HISTORICAL_URL.gsub('http:', 'https:')
|
25
25
|
|
26
26
|
# use https to fetch rates from Open Exchange Rates
|
27
27
|
# disabled by default to support free-tier users
|
@@ -0,0 +1,22 @@
|
|
1
|
+
GEM
|
2
|
+
specs:
|
3
|
+
i18n (0.7.0)
|
4
|
+
json (1.8.3)
|
5
|
+
monetize (1.3.1)
|
6
|
+
money (~> 6.6)
|
7
|
+
money (6.6.1)
|
8
|
+
i18n (>= 0.6.4, <= 0.7.0)
|
9
|
+
money-open-exchange-rates (0.4.0)
|
10
|
+
json (~> 1.8)
|
11
|
+
monetize (~> 1.3)
|
12
|
+
money (~> 6.6)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
money
|
19
|
+
money-open-exchange-rates
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
1.10.6
|
@@ -7,6 +7,9 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
7
7
|
Money::Bank::OpenExchangeRatesBank::OER_HISTORICAL_URL
|
8
8
|
end
|
9
9
|
let(:oer_secure_url) { Money::Bank::OpenExchangeRatesBank::SECURE_OER_URL }
|
10
|
+
let(:oer_historical_secure_url) do
|
11
|
+
Money::Bank::OpenExchangeRatesBank::SECURE_OER_HISTORICAL_URL
|
12
|
+
end
|
10
13
|
|
11
14
|
let(:temp_cache_path) do
|
12
15
|
data_file('tmp.json')
|
@@ -151,22 +154,72 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
151
154
|
subject.app_id = TEST_APP_ID
|
152
155
|
end
|
153
156
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
157
|
+
describe 'historical' do
|
158
|
+
before do
|
159
|
+
subject.date = '2015-01-01'
|
160
|
+
end
|
161
|
+
|
162
|
+
def historical_url
|
163
|
+
format("#{oer_historical_url}?app_id=#{TEST_APP_ID}",
|
164
|
+
subject.date)
|
165
|
+
end
|
166
|
+
|
167
|
+
def historical_secure_url
|
168
|
+
format("#{oer_historical_secure_url}?app_id=#{TEST_APP_ID}",
|
169
|
+
subject.date)
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should use the non-secure http url if secure_connection is nil' do
|
173
|
+
subject.secure_connection = nil
|
174
|
+
subject.source_url.must_equal historical_url
|
175
|
+
subject.source_url.must_include 'http://'
|
176
|
+
subject.source_url.must_include 'historical'
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'should use the non-secure http url if secure_connection is false' do
|
180
|
+
subject.secure_connection = false
|
181
|
+
subject.source_url.must_equal historical_url
|
182
|
+
subject.source_url.must_include 'http://'
|
183
|
+
subject.source_url.must_include 'historical'
|
184
|
+
end
|
159
185
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
186
|
+
it 'should use the secure https url if secure_connection is true' do
|
187
|
+
subject.secure_connection = true
|
188
|
+
subject.source_url.must_equal historical_secure_url
|
189
|
+
subject.source_url.must_include 'https://'
|
190
|
+
subject.source_url.must_include 'historical'
|
191
|
+
end
|
164
192
|
end
|
165
193
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
194
|
+
describe 'latest' do
|
195
|
+
def source_url
|
196
|
+
"#{oer_url}?app_id=#{TEST_APP_ID}"
|
197
|
+
end
|
198
|
+
|
199
|
+
def source_secure_url
|
200
|
+
"#{oer_secure_url}?app_id=#{TEST_APP_ID}"
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'should use the non-secure http url if secure_connection is nil' do
|
204
|
+
subject.secure_connection = nil
|
205
|
+
subject.source_url.must_equal source_url
|
206
|
+
subject.source_url.must_include 'http://'
|
207
|
+
subject.source_url.must_include 'latest'
|
208
|
+
end
|
209
|
+
|
210
|
+
it 'should use the non-secure http url if secure_connection is false' do
|
211
|
+
subject.secure_connection = false
|
212
|
+
subject.source_url.must_equal source_url
|
213
|
+
subject.source_url.must_include 'http://'
|
214
|
+
subject.source_url.must_include 'latest'
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'should use the secure https url if secure_connection is true' do
|
218
|
+
subject.secure_connection = true
|
219
|
+
subject.source_url.must_equal source_secure_url
|
220
|
+
subject.source_url.must_include 'https://'
|
221
|
+
subject.source_url.must_include 'latest'
|
222
|
+
end
|
170
223
|
end
|
171
224
|
end
|
172
225
|
|
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.4.
|
4
|
+
version: 0.4.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-
|
11
|
+
date: 2015-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|
@@ -187,12 +187,15 @@ extra_rdoc_files:
|
|
187
187
|
- README.md
|
188
188
|
files:
|
189
189
|
- Gemfile
|
190
|
+
- History.md
|
190
191
|
- LICENSE
|
191
192
|
- README.md
|
192
193
|
- lib/money/bank/open_exchange_rates_bank.rb
|
193
194
|
- lib/open_exchange_rates_bank/version.rb
|
194
195
|
- test/data/2015-01-01.json
|
195
196
|
- test/data/latest.json
|
197
|
+
- test/integration/Gemfile
|
198
|
+
- test/integration/Gemfile.lock
|
196
199
|
- test/open_exchange_rates_bank_test.rb
|
197
200
|
- test/test_helper.rb
|
198
201
|
homepage: http://github.com/spk/money-open-exchange-rates
|
@@ -215,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
218
|
version: '0'
|
216
219
|
requirements: []
|
217
220
|
rubyforge_project:
|
218
|
-
rubygems_version: 2.4.5
|
221
|
+
rubygems_version: 2.4.5.1
|
219
222
|
signing_key:
|
220
223
|
specification_version: 4
|
221
224
|
summary: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|