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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd43b9afdef13f46266c47a431904c61180c1444c1a31e927a199f423ed0fd4d
4
- data.tar.gz: 519f3d3d3b33047f8647f00d5480e33c0c7d626656c458082e01d2b975875275
3
+ metadata.gz: 06a7722694817af7e5d22e0865de23d0f9848a728309d6643756fa7645f387c9
4
+ data.tar.gz: 8ca2222d3c3a9b94446e473ee1000fd8ac2f50bf8129b1a6add3c137705ad874
5
5
  SHA512:
6
- metadata.gz: 7b3367c199eec9ae32daaa5c444f8c578c8d14f639688c05b97fadffd9504df7a502d403f49ea8fc1650c61ab50b698928f2c9f51826e821633b019e4b5cea01
7
- data.tar.gz: 01a91a2311290dbbb7fdffe7203f94d5c33e26124b5ad19a9b568ae3f6f4144f4bbfecec29a7b88d3b5f6d7059c31f18c80827b8f5a6db1f039680a537cc5a3a
6
+ metadata.gz: da4c04ba2325489d70440a8a3b3c892d637f6baf12a923cebe054401b8a377a9dc245ab79fefb82a512de3ab2b01bde9522d3b4fbccbe538168643e924fbb647
7
+ data.tar.gz: 51e9c6767acd5aad9a0ec05190a8f5c3fdba8011ebefece40311d14edaa83d5181ae8a8de6d162b72665bdc360b3fc2b69dbf109ff0657bafb54c9634eeee88f
@@ -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, retry_statuses: [401]
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$/
@@ -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
- # The :retry middleware use cached request's headers which doesn't retry
29
- # the request headers automatically
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IronBank
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  API_VERSION = 'v1'
6
6
  end
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.3
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-11 00:00:00.000000000 Z
14
+ date: 2018-10-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bump