ezclient 1.7.0 → 1.7.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa2cb8306bd3eef023200502bf45328c0c449d3ee5c462587f6654ecdda6ed46
4
- data.tar.gz: 122807a192e55ce43ba40f6e639d5ef37c290e53cfd04bc36fa1cd36f51e5e77
3
+ metadata.gz: f95857956414f9377de79dd8b0b29bc54de9dcb57ef0cdcff1e2964f14030d3f
4
+ data.tar.gz: 0e37a6cda106514431b61640582e89b97434c59bd8e281549a1e1de528e18ab3
5
5
  SHA512:
6
- metadata.gz: 28f28f6623afc9200fdc949452e88d27157ac7ee8512329cfff5b2af078dc066cac27b8d8a509fd99834776493c9625268bb523f4f30d327b2ed5adbc5754c93
7
- data.tar.gz: c8b58ff10962b02ad3eb7948c5d912acff4f2c7c2bfdc0cd90fc10efbeb01428b8fcae963010245168cf1712306f52e11984de3ee0ac706b62c2d4cfb2e44143
6
+ metadata.gz: d3541368eac52018a2ef482e41d13fc785466da7be953d4a6a9f44ea86ce66a0498d844f8ff86cd5b6048fbb334ad508249273ad0fa8f91fadf3cca0e9430609
7
+ data.tar.gz: ada38c6791768ceb5a3f01877b0236b9400392b32dc4f32d0b9a4c6299bd685f13c38499c49b3e23c63f9461c4e18e3b9829242ce5a804043d06be9b6bc19194
data/.rubocop.yml CHANGED
@@ -16,9 +16,10 @@ AllCops:
16
16
  - gemfile/**/*
17
17
  Exclude:
18
18
  - vendor/**/*
19
+ - spec/files/**/*
19
20
 
20
- RSpec/Rails/HaveHttpStatus:
21
+ RSpec/SpecFilePathFormat:
21
22
  Enabled: false
22
23
 
23
- RSpec/SpecFilePathFormat:
24
+ RSpec/ExpectInLet:
24
25
  Enabled: false
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ezclient (1.7.0)
4
+ ezclient (1.7.2)
5
5
  http (>= 4)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (7.1.3.4)
10
+ activesupport (7.1.4)
11
11
  base64
12
12
  bigdecimal
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -23,7 +23,7 @@ GEM
23
23
  base64 (0.2.0)
24
24
  bigdecimal (3.1.8)
25
25
  coderay (1.1.3)
26
- concurrent-ruby (1.3.3)
26
+ concurrent-ruby (1.3.4)
27
27
  connection_pool (2.4.1)
28
28
  coveralls (0.7.2)
29
29
  multi_json (~> 1.3)
@@ -42,17 +42,17 @@ GEM
42
42
  ffi-compiler (1.3.2)
43
43
  ffi (>= 1.15.5)
44
44
  rake
45
- hashdiff (1.1.0)
45
+ hashdiff (1.1.1)
46
46
  http (5.2.0)
47
47
  addressable (~> 2.8)
48
48
  base64 (~> 0.1)
49
49
  http-cookie (~> 1.0)
50
50
  http-form_data (~> 2.2)
51
51
  llhttp-ffi (~> 0.5.0)
52
- http-cookie (1.0.6)
52
+ http-cookie (1.0.7)
53
53
  domain_name (~> 0.5)
54
54
  http-form_data (2.3.0)
55
- i18n (1.14.5)
55
+ i18n (1.14.6)
56
56
  concurrent-ruby (~> 1.0)
57
57
  json (2.7.2)
58
58
  language_server-protocol (3.17.0.3)
@@ -62,12 +62,12 @@ GEM
62
62
  method_source (1.1.0)
63
63
  mime-types (3.5.2)
64
64
  mime-types-data (~> 3.2015)
65
- mime-types-data (3.2024.0702)
66
- minitest (5.24.1)
65
+ mime-types-data (3.2024.0903)
66
+ minitest (5.25.1)
67
67
  multi_json (1.15.0)
68
68
  mutex_m (0.2.0)
69
- parallel (1.25.1)
70
- parser (3.3.4.0)
69
+ parallel (1.26.3)
70
+ parser (3.3.5.0)
71
71
  ast (~> 2.4.1)
72
72
  racc
73
73
  pry (0.14.2)
@@ -81,61 +81,53 @@ GEM
81
81
  regexp_parser (2.9.2)
82
82
  rest-client (1.6.7)
83
83
  mime-types (>= 1.16)
84
- rexml (3.3.2)
85
- strscan
84
+ rexml (3.3.7)
86
85
  rspec (3.13.0)
87
86
  rspec-core (~> 3.13.0)
88
87
  rspec-expectations (~> 3.13.0)
89
88
  rspec-mocks (~> 3.13.0)
90
- rspec-core (3.13.0)
89
+ rspec-core (3.13.1)
91
90
  rspec-support (~> 3.13.0)
92
- rspec-expectations (3.13.1)
91
+ rspec-expectations (3.13.3)
93
92
  diff-lcs (>= 1.2.0, < 2.0)
94
93
  rspec-support (~> 3.13.0)
95
94
  rspec-mocks (3.13.1)
96
95
  diff-lcs (>= 1.2.0, < 2.0)
97
96
  rspec-support (~> 3.13.0)
98
97
  rspec-support (3.13.1)
99
- rubocop (1.63.5)
98
+ rubocop (1.66.1)
100
99
  json (~> 2.3)
101
100
  language_server-protocol (>= 3.17.0)
102
101
  parallel (~> 1.10)
103
102
  parser (>= 3.3.0.2)
104
103
  rainbow (>= 2.2.2, < 4.0)
105
- regexp_parser (>= 1.8, < 3.0)
106
- rexml (>= 3.2.5, < 4.0)
107
- rubocop-ast (>= 1.31.1, < 2.0)
104
+ regexp_parser (>= 2.4, < 3.0)
105
+ rubocop-ast (>= 1.32.2, < 2.0)
108
106
  ruby-progressbar (~> 1.7)
109
107
  unicode-display_width (>= 2.4.0, < 3.0)
110
- rubocop-ast (1.31.3)
108
+ rubocop-ast (1.32.3)
111
109
  parser (>= 3.3.1.0)
112
- rubocop-capybara (2.21.0)
113
- rubocop (~> 1.41)
114
- rubocop-config-umbrellio (1.63.0.93)
115
- rubocop (~> 1.63.0)
116
- rubocop-performance (~> 1.21.0)
117
- rubocop-rails (~> 2.24.0)
110
+ rubocop-config-umbrellio (1.66.0.99)
111
+ rubocop (~> 1.66.0)
112
+ rubocop-factory_bot (~> 2.26.0)
113
+ rubocop-performance (~> 1.22.0)
114
+ rubocop-rails (~> 2.26.0)
118
115
  rubocop-rake (~> 0.6.0)
119
- rubocop-rspec (~> 2.29.0)
116
+ rubocop-rspec (~> 3.0.0)
120
117
  rubocop-sequel (~> 0.3.3)
121
118
  rubocop-factory_bot (2.26.1)
122
119
  rubocop (~> 1.61)
123
- rubocop-performance (1.21.1)
120
+ rubocop-performance (1.22.1)
124
121
  rubocop (>= 1.48.1, < 2.0)
125
122
  rubocop-ast (>= 1.31.1, < 2.0)
126
- rubocop-rails (2.24.1)
123
+ rubocop-rails (2.26.1)
127
124
  activesupport (>= 4.2.0)
128
125
  rack (>= 1.1)
129
- rubocop (>= 1.33.0, < 2.0)
126
+ rubocop (>= 1.52.0, < 2.0)
130
127
  rubocop-ast (>= 1.31.1, < 2.0)
131
128
  rubocop-rake (0.6.0)
132
129
  rubocop (~> 1.0)
133
- rubocop-rspec (2.29.2)
134
- rubocop (~> 1.40)
135
- rubocop-capybara (~> 2.17)
136
- rubocop-factory_bot (~> 2.22)
137
- rubocop-rspec_rails (~> 2.28)
138
- rubocop-rspec_rails (2.29.1)
130
+ rubocop-rspec (3.0.5)
139
131
  rubocop (~> 1.61)
140
132
  rubocop-sequel (0.3.4)
141
133
  rubocop (~> 1.0)
@@ -144,17 +136,16 @@ GEM
144
136
  docile (~> 1.1)
145
137
  simplecov-html (~> 0.11)
146
138
  simplecov_json_formatter (~> 0.1)
147
- simplecov-html (0.12.3)
139
+ simplecov-html (0.13.1)
148
140
  simplecov-lcov (0.8.0)
149
141
  simplecov_json_formatter (0.1.4)
150
- strscan (3.1.0)
151
142
  term-ansicolor (1.2.2)
152
143
  tins (~> 0.8)
153
144
  thor (0.18.1)
154
145
  tins (0.13.2)
155
146
  tzinfo (2.0.6)
156
147
  concurrent-ruby (~> 1.0)
157
- unicode-display_width (2.5.0)
148
+ unicode-display_width (2.6.0)
158
149
  webmock (3.23.1)
159
150
  addressable (>= 2.8.0)
160
151
  crack (>= 0.3.2)
@@ -177,4 +168,4 @@ DEPENDENCIES
177
168
  webmock
178
169
 
179
170
  BUNDLED WITH
180
- 2.5.16
171
+ 2.5.18
data/ezclient.gemspec CHANGED
@@ -19,5 +19,5 @@ Gem::Specification.new do |spec|
19
19
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "http", ">= 4"
22
+ spec.add_dependency "http", ">= 4"
23
23
  end
@@ -28,9 +28,12 @@ class EzClient::Client
28
28
 
29
29
  keep_alive_timeout = options.delete(:keep_alive)
30
30
  api_auth = options.delete(:api_auth)
31
+ ssl_context = options[:ssl_context]
31
32
 
32
33
  if keep_alive_timeout
33
- client = persistent_client_registry.for(url, timeout: keep_alive_timeout)
34
+ client = persistent_client_registry.for(
35
+ url, ssl_context: ssl_context, timeout: keep_alive_timeout
36
+ )
34
37
  else
35
38
  client = HTTP::Client.new
36
39
  end
@@ -5,17 +5,31 @@ class EzClient::PersistentClientRegistry
5
5
  self.registry = {}
6
6
  end
7
7
 
8
- def for(url, timeout:)
8
+ def for(url, ssl_context:, timeout:)
9
9
  cleanup_registry!
10
- uri = HTTP::URI.parse(url)
11
- registry[uri.origin] ||= EzClient::PersistentClient.new(uri.origin, timeout)
10
+
11
+ origin = get_origin(url)
12
+ registry[origin] ||= {}
13
+
14
+ ssl_bucket = ssl_context&.cert ? get_cert_sha256(ssl_context.cert) : nil
15
+ registry[origin][ssl_bucket] ||= EzClient::PersistentClient.new(origin, timeout)
12
16
  end
13
17
 
14
18
  private
15
19
 
16
20
  attr_accessor :registry
17
21
 
22
+ def get_cert_sha256(cert)
23
+ Digest::SHA256.hexdigest(cert.to_der)
24
+ end
25
+
26
+ def get_origin(url)
27
+ HTTP::URI.parse(url).origin
28
+ end
29
+
18
30
  def cleanup_registry!
19
- registry.delete_if { |_origin, client| client.timed_out? }
31
+ registry.each_value do |ssl_buckets|
32
+ ssl_buckets.delete_if { |_ssl_bucket, client| client.timed_out? }
33
+ end
20
34
  end
21
35
  end
@@ -42,20 +42,6 @@ class EzClient::Response
42
42
  client_error? || server_error?
43
43
  end
44
44
 
45
- def inspect
46
- {
47
- req: {
48
- raw: http_request.inspect,
49
- hdrs: http_request.headers,
50
- },
51
- resp: {
52
- raw: http_response.inspect,
53
- hdrs: headers,
54
- body: body,
55
- },
56
- }.to_s
57
- end
58
-
59
45
  def to_s
60
46
  inspect
61
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EzClient
4
- VERSION = "1.7.0"
4
+ VERSION = "1.7.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuri Smirnov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: http
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '4'
27
- description:
28
26
  email:
29
27
  - tycooon@yandex.ru
30
28
  - oss@umbrellio.biz
@@ -57,7 +55,6 @@ homepage: https://github.com/umbrellio/ezclient
57
55
  licenses:
58
56
  - MIT
59
57
  metadata: {}
60
- post_install_message:
61
58
  rdoc_options: []
62
59
  require_paths:
63
60
  - lib
@@ -72,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
69
  - !ruby/object:Gem::Version
73
70
  version: '0'
74
71
  requirements: []
75
- rubygems_version: 3.5.16
76
- signing_key:
72
+ rubygems_version: 3.6.7
77
73
  specification_version: 4
78
74
  summary: An HTTP gem wrapper for easy persistent connections and more.
79
75
  test_files: []