iron_bank 2.1.0 → 2.2.0

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
  SHA1:
3
- metadata.gz: 901b217a92f89e748bd3e766c6d079ed15da7805
4
- data.tar.gz: bacc2026bf92a9dceb35592c4c1306cac08cfaf5
3
+ metadata.gz: 5c9852ebba532db566a9ed0bbf43d99d5b50365f
4
+ data.tar.gz: 9990defc4ab42f7d0974a6fd5ce47f0891e1164d
5
5
  SHA512:
6
- metadata.gz: 592874e55ed11e85cdcb6877becf2b2d5635536414781c5c5e20e66d68859d5743b7a86559e8f962fdb5c29a96b219323e74af262dd54286a67fcecd584dd2af
7
- data.tar.gz: 658224c2ae4b3f8ae18fea954a68d5ee73a05966d07d299a06985eec6599df655b58f9d325cf655ebbeac6d4af52bf60258512a7439b3211b5951aac99c4538c
6
+ metadata.gz: 2591ae85f81d91d81d8663995d5db8a0a00a5e2b3b58e4f62d05c0ec5505f62d8ce13d694468f7f5ec708d8387febc09b4cd37a73180a829f35b26affe19add4
7
+ data.tar.gz: 15cb858aa462d1904cb20d26493d04ff25a201194d0ec81ea8dba8b4ee0c7b786ae543e313110e2221ad9e02807c3ce74fddfeda47257c49114890c9d5e1193b
data/.reek.yml CHANGED
@@ -20,6 +20,7 @@ detectors:
20
20
  - IronBank::Configuration#logger
21
21
  - IronBank::Configuration#open_tracing_enabled
22
22
  - IronBank::Configuration#open_tracing_service_name
23
+ - IronBank::Configuration#retry_options
23
24
  - IronBank::Configuration#schema_directory
24
25
 
25
26
  BooleanParameter:
@@ -68,6 +69,8 @@ detectors:
68
69
 
69
70
  TooManyInstanceVariables:
70
71
  max_instance_variables: 6
72
+ exclude:
73
+ - IronBank::Configuration
71
74
 
72
75
  TooManyStatements:
73
76
  exclude:
@@ -16,12 +16,6 @@ module IronBank
16
16
  #
17
17
  class InvalidHostname < Error; end
18
18
 
19
- RETRIABLE_ERRORS = [
20
- IronBank::LockCompetitionError,
21
- IronBank::TemporaryError,
22
- IronBank::UnauthorizedError
23
- ].freeze
24
-
25
19
  # Alias each actions as a `Client` instance method
26
20
  IronBank::Actions.constants.each do |action|
27
21
  method_name = IronBank::Utils.underscore(action)
@@ -47,18 +41,9 @@ module IronBank
47
41
  validate_domain
48
42
  reset_connection if auth.expired?
49
43
 
50
- retry_options = {
51
- max: 4,
52
- interval: 0.1,
53
- interval_randomness: 0.05,
54
- backoff_factor: 5,
55
- exceptions: RETRIABLE_ERRORS,
56
- retry_if: ->(_, ex) { RETRIABLE_ERRORS.include?(ex.class) }
57
- }
58
-
59
44
  @connection ||= Faraday.new(faraday_config) do |conn|
60
45
  conn.request :json
61
- conn.request :retry, retry_options
46
+ conn.request :retry, IronBank.configuration.retry_options
62
47
 
63
48
  conn.response :raise_error
64
49
  conn.response :renew_auth, auth
@@ -78,6 +63,23 @@ module IronBank
78
63
 
79
64
  private
80
65
 
66
+ DEFAULT_RETRY_OPTIONS = begin
67
+ retriable_errors = [
68
+ IronBank::LockCompetitionError,
69
+ IronBank::TemporaryError,
70
+ IronBank::UnauthorizedError
71
+ ]
72
+
73
+ {
74
+ max: 4,
75
+ interval: 0.1,
76
+ interval_randomness: 0.05,
77
+ backoff_factor: 5,
78
+ exceptions: retriable_errors,
79
+ retry_if: ->(_, ex) { retriable_errors.include?(ex.class) }
80
+ }
81
+ end.freeze
82
+
81
83
  attr_reader :domain, :client_id, :client_secret, :auth_type
82
84
 
83
85
  def auth
@@ -32,6 +32,9 @@ module IronBank
32
32
  # Open Tracing service name
33
33
  attr_accessor :open_tracing_service_name
34
34
 
35
+ # Faraday retry options
36
+ attr_writer :retry_options
37
+
35
38
  # Directory where the XML describe files are located.
36
39
  attr_reader :schema_directory
37
40
 
@@ -82,5 +85,9 @@ module IronBank
82
85
  def credentials?
83
86
  credentials.values.all?
84
87
  end
88
+
89
+ def retry_options
90
+ @retry_options ||= IronBank::Client::DEFAULT_RETRY_OPTIONS
91
+ end
85
92
  end
86
93
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IronBank
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.0'
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: 2.1.0
4
+ version: 2.2.0
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: 2019-03-19 00:00:00.000000000 Z
14
+ date: 2019-03-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bump