iron_bank 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iron_bank/client.rb +2 -2
- data/lib/iron_bank/error.rb +4 -0
- data/lib/iron_bank/faraday_middleware/retriable_auth.rb +2 -2
- data/lib/iron_bank/version.rb +1 -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: 06a7722694817af7e5d22e0865de23d0f9848a728309d6643756fa7645f387c9
|
4
|
+
data.tar.gz: 8ca2222d3c3a9b94446e473ee1000fd8ac2f50bf8129b1a6add3c137705ad874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da4c04ba2325489d70440a8a3b3c892d637f6baf12a923cebe054401b8a377a9dc245ab79fefb82a512de3ab2b01bde9522d3b4fbccbe538168643e924fbb647
|
7
|
+
data.tar.gz: 51e9c6767acd5aad9a0ec05190a8f5c3fdba8011ebefece40311d14edaa83d5181ae8a8de6d162b72665bdc360b3fc2b69dbf109ff0657bafb54c9634eeee88f
|
data/lib/iron_bank/client.rb
CHANGED
@@ -44,9 +44,9 @@ module IronBank
|
|
44
44
|
@connection ||= Faraday.new(faraday_config) do |conn|
|
45
45
|
conn.use :ddtrace, open_tracing_options if open_tracing_enabled?
|
46
46
|
conn.use instrumenter, instrumenter_options if instrumenter
|
47
|
-
conn.use :raise_error
|
48
47
|
conn.request :json
|
49
|
-
conn.request :retry, max: 2,
|
48
|
+
conn.request :retry, max: 2, exceptions: [IronBank::Unauthorized]
|
49
|
+
conn.use :raise_error
|
50
50
|
conn.request :retriable_auth, auth
|
51
51
|
conn.response :logger, IronBank.logger
|
52
52
|
conn.response :json, content_type: /\bjson$/
|
data/lib/iron_bank/error.rb
CHANGED
@@ -11,6 +11,7 @@ module IronBank
|
|
11
11
|
klass = begin
|
12
12
|
case status
|
13
13
|
when 400 then IronBank::BadRequest
|
14
|
+
when 401 then IronBank::Unauthorized
|
14
15
|
when 404 then IronBank::NotFound
|
15
16
|
when 422 then IronBank::UnprocessableEntity
|
16
17
|
when 429 then IronBank::TooManyRequests
|
@@ -32,6 +33,9 @@ module IronBank
|
|
32
33
|
# Raised when Zuora returns a 400 HTTP status code
|
33
34
|
class BadRequest < ClientError; end
|
34
35
|
|
36
|
+
# Raised when Zuora returns a 401 HTTP status code
|
37
|
+
class Unauthorized < Error; end
|
38
|
+
|
35
39
|
# Raised when Zuora returns a 404 HTTP status code
|
36
40
|
class NotFound < ClientError; end
|
37
41
|
|
@@ -25,8 +25,8 @@ module IronBank
|
|
25
25
|
def renew_auth_header
|
26
26
|
auth.renew_session
|
27
27
|
|
28
|
-
#
|
29
|
-
# the
|
28
|
+
# NOTE: Merging the refreshed auth headers into the original request
|
29
|
+
# (which will be retried via the `:retry` middleware.)
|
30
30
|
env.request_headers = env.request_headers.merge(auth.header)
|
31
31
|
end
|
32
32
|
end
|
data/lib/iron_bank/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_bank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mickael Pham
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-10-
|
14
|
+
date: 2018-10-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bump
|