money-open-exchange-rates 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d1aa20a7e00ad9b92ff6f516af74c9f26a0b4a4cfacdbab246833806976cb7
|
4
|
+
data.tar.gz: 61646aab5bbcfb00e362df9f6fe8e0bc80b9ef553a99ac6bfd26fa1c7d8f5c93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61eea8294a9b0b0a311db01d9b792c3831adc1d1711af486f9c43bac434bb5ced1dde20527624f16054e56cda867306bbf43f63dda9a17ef536da302cc77c250
|
7
|
+
data.tar.gz: 118f24d214bd24f7264aa575e87de2f04e115ebca9d83ce70c24abdd1cc0d93b2995f192ec760314717bbbed846ab75273ff851812a9fb6fd16a114043f63d76
|
data/History.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
|
2
|
+
1.4.1 / 2023-05-07
|
3
|
+
==================
|
4
|
+
|
5
|
+
* Merge pull request #69 from @fuentesjr / identify-access-restricted-errors
|
6
|
+
* Fixing typo in scoping of must_raise in access restricted test
|
7
|
+
* Raise a new AccessRestricted error when account is restricted by oer
|
8
|
+
|
2
9
|
1.4.0 / 2020-09-11
|
3
10
|
==================
|
4
11
|
|
@@ -17,6 +17,9 @@ class Money
|
|
17
17
|
# APP_ID not set error
|
18
18
|
class NoAppId < StandardError; end
|
19
19
|
|
20
|
+
# Access restricted (e.g. usage/request limit exceeded for account)
|
21
|
+
class AccessRestricted < StandardError; end
|
22
|
+
|
20
23
|
# OpenExchangeRatesBank base class
|
21
24
|
class OpenExchangeRatesBank < Money::Bank::VariableExchange
|
22
25
|
VERSION = ::OpenExchangeRatesBank::VERSION
|
@@ -371,6 +374,10 @@ class Money
|
|
371
374
|
# @return [Hash] key is country code (ISO 3166-1 alpha-3) value Float
|
372
375
|
def exchange_rates
|
373
376
|
doc = JSON.parse(read_from_cache || read_from_url)
|
377
|
+
if doc['error'] && doc['message'] == 'access_restricted'
|
378
|
+
raise AccessRestricted
|
379
|
+
end
|
380
|
+
|
374
381
|
self.rates_timestamp = doc[TIMESTAMP_KEY]
|
375
382
|
@oer_rates = doc[RATES_KEY]
|
376
383
|
end
|
@@ -25,6 +25,9 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
25
25
|
let(:oer_historical_path) do
|
26
26
|
data_file('2015-01-01.json')
|
27
27
|
end
|
28
|
+
let(:oer_access_restricted_error_path) do
|
29
|
+
data_file('access_restricted_error.json')
|
30
|
+
end
|
28
31
|
|
29
32
|
describe 'exchange' do
|
30
33
|
before do
|
@@ -96,6 +99,13 @@ describe Money::Bank::OpenExchangeRatesBank do
|
|
96
99
|
subject.update_rates
|
97
100
|
end
|
98
101
|
|
102
|
+
it 'should raise AccessRestricted error when restricted by oer' do
|
103
|
+
subject.cache = nil
|
104
|
+
filepath = oer_access_restricted_error_path
|
105
|
+
subject.stubs(:api_response).returns File.read(filepath)
|
106
|
+
_(proc { subject.update_rates }).must_raise Money::Bank::AccessRestricted
|
107
|
+
end
|
108
|
+
|
99
109
|
it 'should update itself with exchange rates from OpenExchangeRates' do
|
100
110
|
subject.oer_rates.keys.each do |currency|
|
101
111
|
next unless Money::Currency.find(currency)
|
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: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Arnoud
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/money/bank/open_exchange_rates_bank.rb
|
144
144
|
- lib/open_exchange_rates_bank/version.rb
|
145
145
|
- test/data/2015-01-01.json
|
146
|
+
- test/data/access_restricted_error.json
|
146
147
|
- test/data/latest.json
|
147
148
|
- test/integration/Gemfile
|
148
149
|
- test/integration/Gemfile.lock
|
@@ -153,7 +154,7 @@ homepage: http://github.com/spk/money-open-exchange-rates
|
|
153
154
|
licenses:
|
154
155
|
- MIT
|
155
156
|
metadata: {}
|
156
|
-
post_install_message:
|
157
|
+
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|
159
160
|
- lib
|
@@ -168,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
172
|
+
rubygems_version: 3.3.15
|
173
|
+
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: A gem that calculates the exchange rate using published rates from open-exchange-rates.
|
175
176
|
test_files:
|