httpi 3.0.0 → 3.0.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: b488ad4ac7b6d32a313798d387be88d00976ffe2533a1413836bd7e102cfda83
4
- data.tar.gz: f555c552fbdfa36b727c75e5bf2b3a9a19559098145ce3f969c94f250380b185
3
+ metadata.gz: cd06f829b3d33418dfe3ef465949f504f6acde0e9f5988edea9615e700bb8f23
4
+ data.tar.gz: '00197cf31c50d34768c76325d42cc8dc325774ffe5a2ecaf6feb33f7d22c382c'
5
5
  SHA512:
6
- metadata.gz: fccd5e6e95668a6b49e440eee050a2e8f7e456434e6a973bd2cc8d54c97854c1961fc5e941456ff6e3a4356a03bb6b8a7aad023fd7b8d74f0d73a2e1a18fd682
7
- data.tar.gz: 825d197e0ccb00ba983aba28a40cb6c0f1789bc6ae9cb3ba82363548330fd66609c5c4e904285038d67de6c95850f1ccaca3901f7698b7317657e754f1035f7d
6
+ metadata.gz: 81a2a86d8a7784711c0a72995a21262c7bcdfb17d9127a06a9573c50f7eaffde7e544c07b332e905da3fb1b177d867d34c2b59a75f0605182a6d278db9eda4a6
7
+ data.tar.gz: e59a0468efe743db6a4b4d7eff007714cb739e928396b7ff8797896a346e7808a2635185ccf1a9eb53db64d149626782a4f3dc530f3e9644c21923ce6a4a0f3d
@@ -0,0 +1,22 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "Ruby",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/ruby:1-3.2-bullseye"
7
+
8
+ // Features to add to the dev container. More info: https://containers.dev/features.
9
+ // "features": {},
10
+
11
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
12
+ // "forwardPorts": [],
13
+
14
+ // Use 'postCreateCommand' to run commands after the container is created.
15
+ // "postCreateCommand": "ruby --version",
16
+
17
+ // Configure tool-specific properties.
18
+ // "customizations": {},
19
+
20
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
21
+ // "remoteUser": "root"
22
+ }
@@ -14,9 +14,10 @@ jobs:
14
14
  - ubuntu
15
15
 
16
16
  ruby:
17
- - "2.6"
18
- - "2.7"
19
17
  - "3.0"
18
+ - "3.1"
19
+ - "3.2"
20
+ - "3.3"
20
21
 
21
22
  experimental: [false]
22
23
  env: [""]
@@ -33,7 +34,7 @@ jobs:
33
34
  experimental: true
34
35
 
35
36
  steps:
36
- - uses: actions/checkout@v2
37
+ - uses: actions/checkout@v3
37
38
 
38
39
  - name: Install dependencies
39
40
  run: sudo apt-get install libcurl4-openssl-dev
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### Unreleased
2
+
3
+ * Improvement: [#237](https://github.com/savonrb/httpi/pull/237) Implemented `adapter_client_setup`.
4
+
5
+ ### 3.0.2 (2024-02-10)
6
+
7
+ * Add support for ruby 3.1, 3.2, 3.3. Drop support for ruby 2.7 and below.
8
+
9
+ ### 3.0.1 (2021-12-17)
10
+
11
+ * Fix: [#230](https://github.com/savonrb/httpi/pull/230) Make rack a runtime dependency.
12
+
1
13
  ### 3.0.0 (2021-10-19)
2
14
 
3
15
  * Improvement: [#225](https://github.com/savonrb/httpi/pull/225) Make rack and socksify dependencies optional.
data/Gemfile CHANGED
@@ -10,12 +10,12 @@ gem 'httpclient', '~> 2.3', :require => false
10
10
  gem 'curb', '~> 0.8', :require => false, :platforms => [:ruby]
11
11
  gem 'em-http-request', :require => false, :platforms => [:ruby]
12
12
  gem 'em-synchrony', :require => false, :platforms => [:ruby, :jruby]
13
- gem 'excon', '~> 0.21', :require => false, :platforms => [:ruby, :jruby]
13
+ gem 'excon', '~> 0.71', :require => false, :platforms => [:ruby, :jruby]
14
14
  gem 'net-http-persistent', '~> 4.0', :require => false
15
15
  gem 'http', :require => false
16
16
 
17
17
  # adapter extensions
18
- gem 'rack'
18
+ gem 'rack', '< 3'
19
19
  gem 'socksify'
20
20
 
21
21
  # coverage
data/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  A common interface for Ruby's HTTP libraries.
4
4
 
5
- [Documentation](https://www.rubydoc.info/gems/httpi) |
6
- [Mailing list](https://groups.google.com/forum/#!forum/httpirb)
5
+ [Documentation](https://www.rubydoc.info/gems/httpi)
7
6
 
8
7
  [![Development](https://github.com/savonrb/httpi/actions/workflows/development.yml/badge.svg)](https://github.com/savonrb/httpi/actions/workflows/development.yml)
9
8
 
@@ -39,10 +38,6 @@ HTTPI.adapter = :httpclient
39
38
  HTTPI.request(:custom, request)
40
39
  ```
41
40
 
42
- ### Rack Mock Adapter
43
-
44
- To use the Rack mock adapter, please add the `rack` gem to your gemfile.
45
-
46
41
  ### SOCKS Proxy Support
47
42
 
48
43
  To use the the SOCKS proxy support, please add the `socksify` gem to your gemfile, and add the following code:
data/httpi.gemspec CHANGED
@@ -8,14 +8,24 @@ Gem::Specification.new do |s|
8
8
  s.version = HTTPI::VERSION
9
9
  s.authors = ['Daniel Harrington', 'Martin Tepper']
10
10
  s.email = 'me@rubiii.com'
11
- s.homepage = "http://github.com/savonrb/#{s.name}"
11
+ s.homepage = "https://github.com/savonrb/httpi"
12
12
  s.summary = "Common interface for Ruby's HTTP libraries"
13
13
  s.description = s.summary
14
+ s.metadata = { 'bug_tracker_uri' => 'https://github.com/savonrb/httpi/issues',
15
+ 'changelog_uri' => 'https://github.com/savonrb/httpi/blob/master/CHANGELOG.md',
16
+ 'source_code_uri' => s.homepage,
17
+ 'wiki_uri' => 'https://github.com/savonrb/httpi/wiki',
18
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/httpi' }
14
19
 
15
- s.required_ruby_version = '>= 2.3'
20
+ s.required_ruby_version = '>= 3.0'
16
21
 
17
22
  s.license = 'MIT'
18
23
 
24
+ s.add_dependency 'rack', '< 3'
25
+ s.add_dependency 'nkf'
26
+ s.add_dependency 'base64'
27
+ s.add_dependency 'mutex_m'
28
+
19
29
  s.add_development_dependency 'rubyntlm', '~> 0.3.2'
20
30
  s.add_development_dependency 'rake', '~> 13.0'
21
31
  s.add_development_dependency 'rspec', '~> 3.5'
@@ -23,6 +33,8 @@ Gem::Specification.new do |s|
23
33
  s.add_development_dependency 'puma', '~> 5.0'
24
34
  s.add_development_dependency 'webmock'
25
35
 
36
+ s.metadata["rubygems_mfa_required"] = "true"
37
+
26
38
  s.files = `git ls-files`.split("\n")
27
39
  s.require_path = 'lib'
28
40
  end
data/lib/httpi/adapter.rb CHANGED
@@ -34,6 +34,8 @@ module HTTPI
34
34
  @adapter ||= default_adapter
35
35
  end
36
36
 
37
+ attr_accessor :client_setup_block
38
+
37
39
  def identify(adapter_class)
38
40
  ADAPTER_CLASS_MAP[adapter_class]
39
41
  end
data/lib/httpi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HTTPI
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.2'
3
3
  end
data/lib/httpi.rb CHANGED
@@ -154,7 +154,8 @@ module HTTPI
154
154
  # Executes an HTTP request for the given +method+.
155
155
  def request(method, request, adapter = nil, redirects = 0)
156
156
  adapter_class = load_adapter(adapter, request)
157
-
157
+
158
+ Adapter.client_setup_block.call(adapter_class.client) if Adapter.client_setup_block
158
159
  yield adapter_class.client if block_given?
159
160
  log_request(method, request, Adapter.identify(adapter_class.class))
160
161
 
@@ -174,6 +175,10 @@ module HTTPI
174
175
  Adapter.use = adapter
175
176
  end
176
177
 
178
+ def adapter_client_setup=(block)
179
+ Adapter.client_setup_block = block
180
+ end
181
+
177
182
  private
178
183
 
179
184
  def request_and_adapter_from(args)
@@ -215,7 +215,8 @@ describe HTTPI::Adapter::HTTPClient do
215
215
  end
216
216
  end
217
217
 
218
- it "supports NTLM authentication" do
218
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
219
+ xit "supports NTLM authentication" do
219
220
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
220
221
 
221
222
  request.auth.ntlm("tester", "vReqSoafRe5O")
@@ -33,6 +33,18 @@ describe HTTPI do
33
33
  end
34
34
  end
35
35
 
36
+ describe ".adapter_client_setup=" do
37
+ after do
38
+ HTTPI.adapter_client_setup = nil
39
+ end
40
+
41
+ it "sets the adapter client setup block" do
42
+ block = proc { }
43
+ HTTPI.adapter_client_setup = block
44
+ expect(HTTPI::Adapter.client_setup_block).to eq(block)
45
+ end
46
+ end
47
+
36
48
  describe ".query_builder" do
37
49
  it "gets flat builder by default" do
38
50
  expect(client.query_builder).to eq(HTTPI::QueryBuilder::Flat)
@@ -281,6 +293,18 @@ describe HTTPI do
281
293
 
282
294
  client.request(:custom, request, :httpclient)
283
295
  end
296
+
297
+ describe "client setup block present" do
298
+ around do |example|
299
+ HTTPI::Adapter.client_setup_block = proc { |client| client.base_url = 'https://google.com' }
300
+ example.run
301
+ HTTPI::Adapter.client_setup_block = nil
302
+ end
303
+
304
+ it 'calls client setup block' do
305
+ client.request(:get, request, :httpclient) { |client| expect(client.base_url).to eq('https://google.com') }
306
+ end
307
+ end
284
308
  end
285
309
 
286
310
  HTTPI::REQUEST_METHODS.each do |method|
@@ -138,7 +138,8 @@ describe HTTPI::Adapter::NetHTTP do
138
138
  to raise_error(HTTPI::NotSupportedError, /does not support HTTP digest authentication/)
139
139
  end
140
140
 
141
- it "supports ntlm authentication" do
141
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
142
+ xit "supports ntlm authentication" do
142
143
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
143
144
  request.auth.ntlm("tester", "vReqSoafRe5O")
144
145
 
@@ -166,7 +167,8 @@ describe HTTPI::Adapter::NetHTTP do
166
167
  HTTPI::Adapter::NetHTTP.any_instance.unstub(:check_net_ntlm_version!)
167
168
  end
168
169
 
169
- it "does check ntlm when ntlm authentication is requested" do
170
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
171
+ xit "does check ntlm when ntlm authentication is requested" do
170
172
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
171
173
  request.auth.ntlm("tester", "vReqSoafRe5O")
172
174
 
@@ -183,7 +185,8 @@ describe HTTPI::Adapter::NetHTTP do
183
185
  HTTPI::Adapter::NetHTTP.any_instance.unstub(:ntlm_version)
184
186
  end
185
187
 
186
- it "does not crash when authenticate header is missing (on second request)" do
188
+ # TODO: ntlm_openssl3 https://github.com/WinRb/rubyntlm/issues/57
189
+ xit "does not crash when authenticate header is missing (on second request)" do
187
190
  request = HTTPI::Request.new(@server.url + "ntlm-auth")
188
191
  request.auth.ntlm("tester", "vReqSoafRe5O")
189
192
 
metadata CHANGED
@@ -1,16 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Harrington
8
8
  - Martin Tepper
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-10-18 00:00:00.000000000 Z
12
+ date: 2024-02-11 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rack
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "<"
19
+ - !ruby/object:Gem::Version
20
+ version: '3'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "<"
26
+ - !ruby/object:Gem::Version
27
+ version: '3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: nkf
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: base64
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: mutex_m
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
14
70
  - !ruby/object:Gem::Dependency
15
71
  name: rubyntlm
16
72
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +157,7 @@ executables: []
101
157
  extensions: []
102
158
  extra_rdoc_files: []
103
159
  files:
160
+ - ".devcontainer/devcontainer.json"
104
161
  - ".github/workflows/development.yml"
105
162
  - ".gitignore"
106
163
  - ".rspec"
@@ -173,11 +230,17 @@ files:
173
230
  - spec/support/error_helper.rb
174
231
  - spec/support/fixture.rb
175
232
  - spec/support/matchers.rb
176
- homepage: http://github.com/savonrb/httpi
233
+ homepage: https://github.com/savonrb/httpi
177
234
  licenses:
178
235
  - MIT
179
- metadata: {}
180
- post_install_message:
236
+ metadata:
237
+ bug_tracker_uri: https://github.com/savonrb/httpi/issues
238
+ changelog_uri: https://github.com/savonrb/httpi/blob/master/CHANGELOG.md
239
+ source_code_uri: https://github.com/savonrb/httpi
240
+ wiki_uri: https://github.com/savonrb/httpi/wiki
241
+ documentation_uri: https://www.rubydoc.info/gems/httpi
242
+ rubygems_mfa_required: 'true'
243
+ post_install_message:
181
244
  rdoc_options: []
182
245
  require_paths:
183
246
  - lib
@@ -185,15 +248,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
248
  requirements:
186
249
  - - ">="
187
250
  - !ruby/object:Gem::Version
188
- version: '2.3'
251
+ version: '3.0'
189
252
  required_rubygems_version: !ruby/object:Gem::Requirement
190
253
  requirements:
191
254
  - - ">="
192
255
  - !ruby/object:Gem::Version
193
256
  version: '0'
194
257
  requirements: []
195
- rubygems_version: 3.2.7
196
- signing_key:
258
+ rubygems_version: 3.4.10
259
+ signing_key:
197
260
  specification_version: 4
198
261
  summary: Common interface for Ruby's HTTP libraries
199
262
  test_files: []