opensearch-transport 1.0.1 → 2.0.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
  SHA256:
3
- metadata.gz: e414746942105120cd20aeda377568e039f869009de7d02de8162f70b8510d6d
4
- data.tar.gz: fdca1d3e46fb709f3881732758af151223d796bcbbd5270527cdf39a0b164b4a
3
+ metadata.gz: 486df12499ed36687f17b069b98ac2338d9d53f7f503923339b8f1dbfc7dfc09
4
+ data.tar.gz: 1435b4c6d75c01b8a0f0fab36ba0edaae8b00ac189eadcc2c285f2e135a2bce7
5
5
  SHA512:
6
- metadata.gz: 39aecd9063de2387b8defe7bd1ab2fa87e2545199b9c60ffeabd8e8febcd5350dec33990c5948994606757196284fe03fa56e060848026eb425a75fd2954b90d
7
- data.tar.gz: 38a4f956daf5351aabb2ab2308ab93d35fa576feee35a6a554c6f5b5578f8c629c21ea1eb21eaea8299692ccc2f75c4d5fc3ab4628ff2e029c06729a7fd9b4f8
6
+ metadata.gz: e48408e4ba9d03b463f5b1364c905ca944806bb58d5b9274ded620e0bd6d746a1bdc8fe5f31eb0df3f83eb4b5b8201fda19ab7de26402e38bc8fb76906299180
7
+ data.tar.gz: a48c523ccc5b575d9f97cc87367995d6f16ed83977b0634144a30a9d4384cc30ff998f628c7da2ad199caeb2b32ee7084ec6853386a4b1a5bca2a9b6f680211c
checksums.yaml.gz.sig CHANGED
Binary file
data/Gemfile CHANGED
@@ -37,8 +37,6 @@ if File.exist? File.expand_path('../opensearch/opensearch.gemspec', __dir__)
37
37
  gem 'opensearch-ruby', path: File.expand_path('../opensearch', __dir__), require: false
38
38
  end
39
39
 
40
- gem 'faraday', ENV['FARADAY_VERSION'], require: false if ENV.key?('FARADAY_VERSION')
41
-
42
40
  group :development, :test do
43
41
  gem 'rspec'
44
42
  if defined?(JRUBY_VERSION)
data/README.md CHANGED
@@ -28,22 +28,16 @@ Features overview:
28
28
  * Node reloading (based on cluster state) on errors or on demand
29
29
 
30
30
  For optimal performance, use a HTTP library which supports persistent ("keep-alive") connections,
31
- such as [Patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus).
32
- Most such HTTP libraries are used through the [Faraday](https://rubygems.org/gems/faraday) HTTP library
33
- and its [adapters](https://github.com/lostisland/awesome-faraday/#adapters).
34
-
35
- Include the library's gem and adapter gem, and require the library and adapter in your code, and it will be automatically used.
36
- If you don't use Bundler, you may need to require the library explicitly (like `require 'faraday/patron'`).
31
+ such as [patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus).
32
+ Just require the library (`require 'patron'`) in your code, and it will be automatically used.
37
33
 
38
34
  Currently these libraries will be automatically detected and used:
39
- - [Patron](https://github.com/toland/patron) through [faraday-patron](https://github.com/lostisland/faraday-patron)
40
- - [Typhoeus](https://github.com/typhoeus/typhoeus) through [faraday-typhoeus](https://github.com/dleavitt/faraday-typhoeus) for Faraday 2 or higher, or Faraday's built-in adapter for Faraday 1.
41
- - [HTTPClient](https://rubygems.org/gems/httpclient) through [faraday-httpclient](https://github.com/lostisland/faraday-httpclient)
42
- - [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent) through [faraday-net_http_persistent](https://github.com/lostisland/faraday-net_http_persistent)
43
-
44
- **Note on [Typhoeus](https://github.com/typhoeus/typhoeus)**: You need to use v1.4.0 or up since older versions are not compatible with Faraday 1.0 or higher.
35
+ - [Patron](https://github.com/toland/patron)
36
+ - [Typhoeus](https://github.com/typhoeus/typhoeus)
37
+ - [HTTPClient](https://rubygems.org/gems/httpclient)
38
+ - [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent)
45
39
 
46
- **Note on [Faraday](https://rubygems.org/gems/faraday)**: If you use Faraday 2.0 or higher, if the adapter is in a separate gem, you will likely need to declare that gem as well. Only the Net::HTTP adapter gem is included by default. Faraday 1.x includes most common adapter gems already.
40
+ **Note on [Typhoeus](https://github.com/typhoeus/typhoeus)**: You need to use v1.4.0 or up since older versions are not compatible with Faraday 1.0.
47
41
 
48
42
  For detailed information, see example configurations [below](#transport-implementations).
49
43
 
@@ -356,22 +350,10 @@ as a transport implementation.
356
350
  It will auto-detect and use an _adapter_ for _Faraday_ based on gems loaded in your code,
357
351
  preferring HTTP clients with support for persistent connections.
358
352
 
359
- Faraday uses adapters, usually in separate gems, to connect to the HTTP library. You need to
360
- make sure that your code refers to both the HTTP library gem and the adapter gem. See this
361
- list of [Faraday adapters](https://github.com/lostisland/awesome-faraday/#adapters) for details.
362
-
363
- To use the [_Patron_](https://github.com/toland/patron) HTTP, for example, you need to refer to these gems:
364
-
365
- ```ruby
366
- gem 'patron'
367
- gem 'faraday-patron'
368
- ```
369
-
370
- If you don't use Bundler, you may need to require the libraries explicitly in your code:
353
+ To use the [_Patron_](https://github.com/toland/patron) HTTP, for example, just require it:
371
354
 
372
355
  ```ruby
373
356
  require 'patron'
374
- require 'faraday/patron'
375
357
  ```
376
358
 
377
359
  Then, create a new client, and the _Patron_ gem will be used as the "driver":
@@ -414,6 +396,8 @@ constructor, use the `transport_options` key:
414
396
 
415
397
  To configure the _Faraday_ instance directly, use a block:
416
398
 
399
+ require 'patron'
400
+
417
401
  client = OpenSearch::Client.new(host: 'localhost', port: '9200') do |f|
418
402
  f.response :logger
419
403
  f.adapter :patron
@@ -422,6 +406,8 @@ To configure the _Faraday_ instance directly, use a block:
422
406
  You can use any standard Faraday middleware and plugins in the configuration block. You can also initialize the transport class yourself, and pass it to the client constructor as the `transport` argument:
423
407
 
424
408
  ```ruby
409
+ require 'patron'
410
+
425
411
  transport_configuration = lambda do |f|
426
412
  f.response :logger
427
413
  f.adapter :patron
@@ -330,23 +330,14 @@ module OpenSearch
330
330
  # @api private
331
331
  #
332
332
  def __auto_detect_adapter
333
- # Get the Faraday adapter list without initializing it.
334
- if Faraday::Adapter.respond_to?(:registered_middleware) # Faraday 2.x
335
- adapter = ->(name) { Faraday::Adapter.registered_middleware[name] }
336
- elsif Faraday::Adapter.respond_to?(:fetch_middleware) # Faraday 1.x
337
- adapter = ->(name) { Faraday::Adapter.fetch_middleware(name) }
338
- else
339
- adapter = {} # fallback behavior that should never happen
340
- end
341
- # Pick an adapter that has both the client and adapter defined.
342
333
  case
343
- when defined?(::Patron) && adapter[:patron]
334
+ when defined?(::Patron)
344
335
  :patron
345
- when defined?(::Typhoeus) && adapter[:typhoeus]
336
+ when defined?(::Typhoeus)
346
337
  :typhoeus
347
- when defined?(::HTTPClient) && adapter[:httpclient]
338
+ when defined?(::HTTPClient)
348
339
  :httpclient
349
- when defined?(::Net::HTTP::Persistent) && adapter[:net_http_persistent]
340
+ when defined?(::Net::HTTP::Persistent)
350
341
  :net_http_persistent
351
342
  else
352
343
  ::Faraday.default_adapter
@@ -26,6 +26,6 @@
26
26
 
27
27
  module OpenSearch
28
28
  module Transport
29
- VERSION = '1.0.1'.freeze
29
+ VERSION = '2.0.0'.freeze
30
30
  end
31
31
  end
@@ -61,7 +61,7 @@ Gem::Specification.new do |s|
61
61
  s.required_ruby_version = '>= 2.4'
62
62
 
63
63
  s.add_dependency 'multi_json'
64
- s.add_dependency 'faraday', '>= 1.0', '< 3'
64
+ s.add_dependency 'faraday', '~> 1'
65
65
 
66
66
  s.add_development_dependency 'ansi'
67
67
  s.add_development_dependency 'bundler'
@@ -70,15 +70,12 @@ Gem::Specification.new do |s|
70
70
  s.add_development_dependency 'opensearch-ruby'
71
71
  s.add_development_dependency 'hashie'
72
72
  s.add_development_dependency 'httpclient'
73
- s.add_development_dependency 'faraday-httpclient'
74
73
  s.add_development_dependency 'manticore' if defined? JRUBY_VERSION
75
74
  s.add_development_dependency 'minitest'
76
75
  s.add_development_dependency 'minitest-reporters'
77
76
  s.add_development_dependency 'mocha'
78
77
  s.add_development_dependency 'net-http-persistent'
79
- s.add_development_dependency 'faraday-net_http_persistent'
80
78
  s.add_development_dependency 'patron' unless defined? JRUBY_VERSION
81
- s.add_development_dependency 'faraday-patron' unless defined? JRUBY_VERSION
82
79
  s.add_development_dependency 'pry'
83
80
  s.add_development_dependency 'rake', '~> 13'
84
81
  s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
@@ -87,7 +84,6 @@ Gem::Specification.new do |s|
87
84
  s.add_development_dependency 'simplecov'
88
85
  s.add_development_dependency 'test-unit', '~> 2'
89
86
  s.add_development_dependency 'typhoeus', '~> 1.4'
90
- s.add_development_dependency 'faraday-typhoeus' if !ENV.key?('FARADAY_VERSION') && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6')
91
87
  s.add_development_dependency 'yard'
92
88
 
93
89
  s.description = <<-DESC.gsub(/^ /, '')
@@ -247,7 +247,7 @@ describe OpenSearch::Transport::Client do
247
247
  end unless jruby?
248
248
  end
249
249
 
250
- context 'when the adapter is patron', unless: jruby? do
250
+ context 'when the adapter is patron' do
251
251
  let(:adapter) do
252
252
  client.transport.connections.all.first.connection.builder.adapter
253
253
  end
@@ -275,7 +275,7 @@ describe OpenSearch::Transport::Client do
275
275
  end
276
276
  end unless jruby?
277
277
 
278
- context 'when the adapter is specified as a string key', unless: jruby? do
278
+ context 'when the adapter is specified as a string key' do
279
279
  let(:adapter) do
280
280
  client.transport.connections.all.first.connection.builder.adapter
281
281
  end
@@ -305,7 +305,7 @@ describe OpenSearch::Transport::Client do
305
305
  end
306
306
  end
307
307
 
308
- context 'when the Faraday adapter is configured', unless: jruby? do
308
+ context 'when the Faraday adapter is configured' do
309
309
 
310
310
  let(:client) do
311
311
  described_class.new do |faraday|
data/spec/spec_helper.rb CHANGED
@@ -29,8 +29,6 @@ if ENV['COVERAGE'] && ENV['CI'].nil?
29
29
  end
30
30
 
31
31
  require 'opensearch-transport'
32
- require 'faraday/httpclient'
33
- require 'faraday/net_http_persistent'
34
32
  require 'logger'
35
33
  require 'ansi/code'
36
34
  require 'hashie/mash'
@@ -39,8 +37,6 @@ if defined?(JRUBY_VERSION)
39
37
  require 'pry-nav'
40
38
  else
41
39
  require 'pry-byebug'
42
- require 'faraday/patron'
43
- require 'faraday/typhoeus' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2')
44
40
  require 'opensearch/transport/transport/http/curb'
45
41
  require 'curb'
46
42
  end
@@ -34,10 +34,8 @@ class OpenSearch::Transport::ClientIntegrationTest < Minitest::Test
34
34
  end
35
35
 
36
36
  should "allow to customize the Faraday adapter to Typhoeus" do
37
- # Require the library so autodetection finds it.
38
37
  require 'typhoeus'
39
- # Require the adapter so autodetection finds it.
40
- require 'faraday/typhoeus' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2')
38
+ require 'typhoeus/adapters/faraday'
41
39
 
42
40
  transport = OpenSearch::Transport::Transport::HTTP::Faraday.new \
43
41
  :hosts => [ { host: @host, port: @port } ] do |f|
@@ -46,18 +44,11 @@ class OpenSearch::Transport::ClientIntegrationTest < Minitest::Test
46
44
  end
47
45
 
48
46
  client = OpenSearch::Transport::Client.new transport: transport
49
- response = client.perform_request 'GET', ''
50
-
51
- assert_respond_to(response.body, :to_hash)
52
- assert_not_nil response.body['name']
53
- assert_equal 'application/json; charset=UTF-8', response.headers['content-type']
47
+ client.perform_request 'GET', ''
54
48
  end unless jruby?
55
49
 
56
50
  should "allow to customize the Faraday adapter to NetHttpPersistent" do
57
- # Require the library so autodetection finds it.
58
51
  require 'net/http/persistent'
59
- # Require the adapter so autodetection finds it.
60
- require 'faraday/net_http_persistent'
61
52
 
62
53
  transport = OpenSearch::Transport::Transport::HTTP::Faraday.new \
63
54
  :hosts => [ { host: @host, port: @port } ] do |f|
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayesh Hathila
@@ -33,7 +33,7 @@ cert_chain:
33
33
  yXikuH6LEVykA8pgOcB9gKsB2/zMd2ZlSj2monM8Qw9EfB14ZSDTYS8VYuwWCeF0
34
34
  eFmXXk0ufQFKl1Yll7quHkmQ0PzKkvXTpONBT6qPkXE=
35
35
  -----END CERTIFICATE-----
36
- date: 2022-07-26 00:00:00.000000000 Z
36
+ date: 2022-05-31 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: multi_json
@@ -53,22 +53,16 @@ dependencies:
53
53
  name: faraday
54
54
  requirement: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: '1.0'
59
- - - "<"
56
+ - - "~>"
60
57
  - !ruby/object:Gem::Version
61
- version: '3'
58
+ version: '1'
62
59
  type: :runtime
63
60
  prerelease: false
64
61
  version_requirements: !ruby/object:Gem::Requirement
65
62
  requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - - "<"
63
+ - - "~>"
70
64
  - !ruby/object:Gem::Version
71
- version: '3'
65
+ version: '1'
72
66
  - !ruby/object:Gem::Dependency
73
67
  name: ansi
74
68
  requirement: !ruby/object:Gem::Requirement
@@ -167,20 +161,6 @@ dependencies:
167
161
  - - ">="
168
162
  - !ruby/object:Gem::Version
169
163
  version: '0'
170
- - !ruby/object:Gem::Dependency
171
- name: faraday-httpclient
172
- requirement: !ruby/object:Gem::Requirement
173
- requirements:
174
- - - ">="
175
- - !ruby/object:Gem::Version
176
- version: '0'
177
- type: :development
178
- prerelease: false
179
- version_requirements: !ruby/object:Gem::Requirement
180
- requirements:
181
- - - ">="
182
- - !ruby/object:Gem::Version
183
- version: '0'
184
164
  - !ruby/object:Gem::Dependency
185
165
  name: minitest
186
166
  requirement: !ruby/object:Gem::Requirement
@@ -237,20 +217,6 @@ dependencies:
237
217
  - - ">="
238
218
  - !ruby/object:Gem::Version
239
219
  version: '0'
240
- - !ruby/object:Gem::Dependency
241
- name: faraday-net_http_persistent
242
- requirement: !ruby/object:Gem::Requirement
243
- requirements:
244
- - - ">="
245
- - !ruby/object:Gem::Version
246
- version: '0'
247
- type: :development
248
- prerelease: false
249
- version_requirements: !ruby/object:Gem::Requirement
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- version: '0'
254
220
  - !ruby/object:Gem::Dependency
255
221
  name: patron
256
222
  requirement: !ruby/object:Gem::Requirement
@@ -265,20 +231,6 @@ dependencies:
265
231
  - - ">="
266
232
  - !ruby/object:Gem::Version
267
233
  version: '0'
268
- - !ruby/object:Gem::Dependency
269
- name: faraday-patron
270
- requirement: !ruby/object:Gem::Requirement
271
- requirements:
272
- - - ">="
273
- - !ruby/object:Gem::Version
274
- version: '0'
275
- type: :development
276
- prerelease: false
277
- version_requirements: !ruby/object:Gem::Requirement
278
- requirements:
279
- - - ">="
280
- - !ruby/object:Gem::Version
281
- version: '0'
282
234
  - !ruby/object:Gem::Dependency
283
235
  name: pry
284
236
  requirement: !ruby/object:Gem::Requirement
@@ -391,20 +343,6 @@ dependencies:
391
343
  - - "~>"
392
344
  - !ruby/object:Gem::Version
393
345
  version: '1.4'
394
- - !ruby/object:Gem::Dependency
395
- name: faraday-typhoeus
396
- requirement: !ruby/object:Gem::Requirement
397
- requirements:
398
- - - ">="
399
- - !ruby/object:Gem::Version
400
- version: '0'
401
- type: :development
402
- prerelease: false
403
- version_requirements: !ruby/object:Gem::Requirement
404
- requirements:
405
- - - ">="
406
- - !ruby/object:Gem::Version
407
- version: '0'
408
346
  - !ruby/object:Gem::Dependency
409
347
  name: yard
410
348
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file