rdstation-ruby-client 2.8.0 → 2.8.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rdstation/retryable_request.rb +1 -1
- data/lib/rdstation/version.rb +1 -1
- data/spec/lib/rdstation/retryable_request_spec.rb +19 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 440807bc5aafd6c15cb69ad4c7ef4b50fbdcbddfac9e3441f4fff97675cf4ee3
|
4
|
+
data.tar.gz: 3c419ba39fd059e44d072c19b595147099f90295e69a946c02da95e4e856103e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c75f8c5d1957ccef3016093d1768e64b27e71ff7e47274efc9c6ee013cecb88befebfd2c38a476d4aecf68f1d92709747b882542ce9ea5bcd16cbc0faa7eee85
|
7
|
+
data.tar.gz: b66553b5cf10bc85f3f6c40704ebc999b3bd61ece59ef431bd903803e60cd29f27f88ea55750f4b650016c0173c88001ead4f305cfc313338fc1849d4b1fc05b
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,7 @@ module RDStation
|
|
7
7
|
retries = 0
|
8
8
|
begin
|
9
9
|
yield authorization
|
10
|
-
rescue ::RDStation::Error::ExpiredAccessToken => e
|
10
|
+
rescue ::RDStation::Error::ExpiredAccessToken, ::RDStation::Error::Unauthorized => e
|
11
11
|
raise if !retry_possible?(authorization) || retries >= MAX_RETRIES
|
12
12
|
|
13
13
|
retries += 1
|
data/lib/rdstation/version.rb
CHANGED
@@ -56,7 +56,7 @@ RSpec.describe RDStation::RetryableRequest do
|
|
56
56
|
and_return(new_credentials)
|
57
57
|
end
|
58
58
|
|
59
|
-
it 'refreshes the access_token and retries the request' do
|
59
|
+
it 'refreshes the access_token and retries the request when an ExpiredAccessToken error happen' do
|
60
60
|
dummy_request = double("dummy_request")
|
61
61
|
expect(dummy_request).to receive(:call).twice do |auth|
|
62
62
|
expired_token = ::RDStation::Error::ExpiredAccessToken.new({'error_message' => 'x'})
|
@@ -74,6 +74,24 @@ RSpec.describe RDStation::RetryableRequest do
|
|
74
74
|
end.not_to raise_error
|
75
75
|
end
|
76
76
|
|
77
|
+
it 'refreshes the access_token and retries the request an Unauthorized error happen' do
|
78
|
+
dummy_request = double("dummy_request")
|
79
|
+
expect(dummy_request).to receive(:call).twice do |auth|
|
80
|
+
expired_token = ::RDStation::Error::Unauthorized.new({'error_message' => 'x'})
|
81
|
+
raise expired_token unless auth.access_token == new_access_token
|
82
|
+
end
|
83
|
+
|
84
|
+
expect(RDStation.configuration.access_token_refresh_callback)
|
85
|
+
.to receive(:call)
|
86
|
+
.once do |authorization|
|
87
|
+
expect(authorization.access_token).to eq new_access_token
|
88
|
+
end
|
89
|
+
|
90
|
+
expect do
|
91
|
+
subject.retryable_request(auth) { |yielded_auth| dummy_request.call(yielded_auth) }
|
92
|
+
end.not_to raise_error
|
93
|
+
end
|
94
|
+
|
77
95
|
context 'and keeps raising retryable exception event after token refreshed' do
|
78
96
|
it 'retries only once' do
|
79
97
|
dummy_request = double("dummy_request")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdstation-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo L F Casaretto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|