elastic-transport 8.2.1 → 8.2.3

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: 97ae80fff7c8f2354bcb14259c86df214ffe8e95cd3027c7716a3e04b51e0e84
4
- data.tar.gz: c8f303cbe8d6f12136ff6f19ac5975cc0ea9bbe9dc18c3602f72121b8b0bb99f
3
+ metadata.gz: 8f666d1e77cc7d01dcb75db01ae517ee1645e6630b02c32f7052f79a4c77de48
4
+ data.tar.gz: 4a6af2555238d92045f6d22a15000d4a8666813602d5f3486d3f1f627ceecf58
5
5
  SHA512:
6
- metadata.gz: 62af9d690c084cd40dae188cb5f959a7acd0d67fbf62a7b27abe0e57d3cb0b78644ea36dc04c5f2597f980de113850a0757860d81519759f2a8b965894c0e90c
7
- data.tar.gz: 59c4cafc61dfb858639934876eb004037c2e31e86a61d3863ed65083fa1d5f0bc2bb15833123c2a5d7d6c7434e9ca74b8fd6721800822141d7ec3af98169a7c6
6
+ metadata.gz: 1e17397db6f79a278db371ec799b15ce366e160e19c13d1fbdbb7b3bad8b36c0cefa77e0b5086083faba9348f42d79f52c3cb77d4554a653ac707a0bb505d435
7
+ data.tar.gz: 82ec2214beaae1a0423c09016140359e16b482fbc1c311906c96cb3cb8d2be54a1602cb6778c1fe624259fea92d2baf02932af223454eca4eba1403705813ba0
@@ -4,7 +4,7 @@ jobs:
4
4
  build:
5
5
  runs-on: ubuntu-latest
6
6
  steps:
7
- - uses: actions/checkout@v2
7
+ - uses: actions/checkout@v3
8
8
  - uses: ruby/setup-ruby@v1
9
9
  with:
10
10
  ruby-version: 3
@@ -15,11 +15,11 @@ jobs:
15
15
  strategy:
16
16
  fail-fast: false
17
17
  matrix:
18
- ruby: [ '2.7', '3.0', '3.1', '3.2', 'jruby-9.3', 'jruby-9.4' ]
19
- es_version: ['8.4-SNAPSHOT', '8.5-SNAPSHOT', '8.6-SNAPSHOT']
18
+ ruby: [ '3.0', '3.1', '3.2', 'jruby-9.3', 'jruby-9.4' ]
19
+ es_version: ['8.7-SNAPSHOT', '8.8-SNAPSHOT', '8.9-SNAPSHOT']
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v3
23
23
  - name: Increase system limits
24
24
  run: |
25
25
  sudo swapoff -a
@@ -53,11 +53,11 @@ jobs:
53
53
  strategy:
54
54
  fail-fast: false
55
55
  matrix:
56
- ruby: [ '2.7', '3.0', '3.1', '3.2', 'jruby-9.3' ]
57
- es_version: ['8.6-SNAPSHOT']
56
+ ruby: [ '3.0', '3.1', '3.2', 'jruby-9.3' ]
57
+ es_version: ['8.9-SNAPSHOT']
58
58
  runs-on: ubuntu-latest
59
59
  steps:
60
- - uses: actions/checkout@v2
60
+ - uses: actions/checkout@v3
61
61
  - name: Increase system limits
62
62
  run: |
63
63
  sudo swapoff -a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 8.2.3
2
+
3
+ Tested versions of Ruby: (MRI) 3.0, 3.1, 3.2, JRuby 9.3 and JRuby 9.4
4
+
5
+ - Fixes enforcing UTF-8 in Response body, causing an error when the string is frozen, particularly when using webmock. [issue #63](https://github.com/elastic/elastic-transport-ruby/issues/63)
6
+
7
+ ## 8.2.2
8
+
9
+ Tested versions of Ruby: (MRI) 3.0, 3.1, 3.2, JRuby 9.3 and JRuby 9.4
10
+
11
+ - Refactors `apply_headers` in base and manticore implementation: When passing in an object to the initializer, `apply_headers` would mutate this object and in certain conditions, this would raise `RuntimeError` in JRuby 9.3 and `ConcurrencyError` in JRuby 9.4. This update clones the options object instead.
12
+
1
13
  ## 8.2.1
2
14
 
3
15
  Tested versions of Ruby: (MRI) 2.7, 3.0, 3.1, 3.2, JRuby 9.3 and JRuby 9.4. Ruby 2.7's end of life is coming in a few days, so this'll probably be the last release to test for Ruby 2.7.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # Elastic Transport
2
+ [![8.1 tests](https://github.com/elastic/elastic-transport-ruby/actions/workflows/tests.yml/badge.svg?branch=8.1)](https://github.com/elastic/elastic-transport-ruby/actions/workflows/tests.yml)
2
3
  [![Run tests](https://github.com/elastic/elastic-transport-ruby/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/elastic/elastic-transport-ruby/actions/workflows/tests.yml)
3
4
 
4
5
  This gem provides a low-level Ruby client for connecting to an [Elastic](http://elastic.co) cluster. It powers both the [Elasticsearch client](https://github.com/elasticsearch/elasticsearch-ruby/) and the [Elastic Enterprise Search](https://github.com/elastic/enterprise-search-ruby/) client.
@@ -15,7 +16,7 @@ response = client.perform_request('GET', '_cluster/health')
15
16
 
16
17
  **Refer to [the official documentation on Elastic Transport](https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/transport.html).**
17
18
 
18
- **Refer to [Advanced Configuration](https://elasticsearch-ruby_1881.docs-preview.app.elstc.co/guide/en/elasticsearch/client/ruby-api/master/advanced-config.html) to read about more configuration options.**
19
+ **Refer to [Advanced Configuration](https://www.elastic.co/guide/en/elasticsearch/client/ruby-api/current/advanced-config.html) to read about more configuration options.**
19
20
 
20
21
  ## Compatibility
21
22
 
@@ -23,8 +23,8 @@ require 'elastic/transport/version'
23
23
  Gem::Specification.new do |s|
24
24
  s.name = "elastic-transport"
25
25
  s.version = Elastic::Transport::VERSION
26
- s.authors = ['Karel Minarik', 'Emily Stolfo', 'Fernando Briano']
27
- s.email = ['support@elastic.co']
26
+ s.authors = ['Elastic Client Library Maintainers']
27
+ s.email = ['client-libs@elastic.co']
28
28
  s.summary = 'Low level Ruby client for Elastic services.'
29
29
  s.homepage = 'https://github.com/elastic/elastic-transport-ruby'
30
30
  s.license = 'Apache-2.0'
@@ -122,8 +122,7 @@ module Elastic
122
122
  # @yield [faraday] Access and configure the `Faraday::Connection` instance directly with a block
123
123
  #
124
124
  def initialize(arguments = {}, &block)
125
- @options = arguments.transform_keys(&:to_sym)
126
- @arguments = @options
125
+ @arguments = arguments.transform_keys(&:to_sym)
127
126
  @arguments[:logger] ||= @arguments[:log] ? DEFAULT_LOGGER.call() : nil
128
127
  @arguments[:tracer] ||= @arguments[:trace] ? DEFAULT_TRACER.call() : nil
129
128
  @arguments[:reload_connections] ||= false
@@ -134,7 +133,6 @@ module Elastic
134
133
  @arguments[:transport_options] ||= {}
135
134
  @arguments[:http] ||= {}
136
135
  @arguments[:enable_meta_header] = arguments.fetch(:enable_meta_header, true)
137
- @options[:http] ||= {}
138
136
 
139
137
  @hosts ||= __extract_hosts(@arguments[:hosts] ||
140
138
  @arguments[:host] ||
@@ -236,7 +234,7 @@ module Elastic
236
234
  end
237
235
 
238
236
  host_list = hosts.map { |host| __parse_host(host) }
239
- @options[:randomize_hosts] ? host_list.shuffle! : host_list
237
+ @arguments[:randomize_hosts] ? host_list.shuffle! : host_list
240
238
  end
241
239
 
242
240
  def __parse_host(host)
@@ -273,8 +271,8 @@ module Elastic
273
271
  raise ArgumentError, "Please pass host as a String, URI or Hash -- #{host.class} given."
274
272
  end
275
273
 
276
- @options[:http][:user] ||= host_parts[:user]
277
- @options[:http][:password] ||= host_parts[:password]
274
+ @arguments[:http][:user] ||= host_parts[:user]
275
+ @arguments[:http][:password] ||= host_parts[:password]
278
276
  host_parts[:port] = host_parts[:port].to_i if host_parts[:port]
279
277
  host_parts[:path].chomp!('/') if host_parts[:path]
280
278
  host_parts
@@ -431,7 +431,7 @@ module Elastic
431
431
  end
432
432
 
433
433
  def apply_headers(client, options)
434
- headers = options[:headers] || {}
434
+ headers = options[:headers].clone || {}
435
435
  headers[CONTENT_TYPE_STR] = find_value(headers, CONTENT_TYPE_REGEX) || DEFAULT_CONTENT_TYPE
436
436
  headers[USER_AGENT_STR] = find_value(headers, USER_AGENT_REGEX) || user_agent_header(client)
437
437
  client.headers[ACCEPT_ENCODING] = GZIP if use_compression?
@@ -162,7 +162,7 @@ module Elastic
162
162
  private
163
163
 
164
164
  def apply_headers(options)
165
- headers = options[:headers] || options.dig(:transport_options, :headers) || {}
165
+ headers = options[:headers].clone || options.dig(:transport_options, :headers).clone || {}
166
166
  headers[CONTENT_TYPE_STR] = find_value(headers, CONTENT_TYPE_REGEX) || DEFAULT_CONTENT_TYPE
167
167
  headers[USER_AGENT_STR] = find_value(headers, USER_AGENT_REGEX) || find_value(@request_options[:headers], USER_AGENT_REGEX) || user_agent_header
168
168
  headers[ACCEPT_ENCODING] = GZIP if use_compression?
@@ -19,8 +19,7 @@ module Elastic
19
19
  module Transport
20
20
  module Transport
21
21
  # Wraps the response from Elasticsearch.
22
- # It provides `body`, `status` and `headers` methods, but you can treat is as a hash and
23
- # access the keys directly.
22
+ # It provides `body`, `status` and `headers` methods
24
23
  class Response
25
24
  attr_reader :status, :body, :headers
26
25
 
@@ -29,7 +28,7 @@ module Elastic
29
28
  # @param headers [Hash] Response headers
30
29
  def initialize(status, body, headers = {})
31
30
  @status, @body, @headers = status, body, headers
32
- @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
31
+ @body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding) && !body.frozen?
33
32
  end
34
33
  end
35
34
  end
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elastic
19
19
  module Transport
20
- VERSION = '8.2.1'.freeze
20
+ VERSION = '8.2.3'.freeze
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,16 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.1
4
+ version: 8.2.3
5
5
  platform: ruby
6
6
  authors:
7
- - Karel Minarik
8
- - Emily Stolfo
9
- - Fernando Briano
7
+ - Elastic Client Library Maintainers
10
8
  autorequire:
11
9
  bindir: bin
12
10
  cert_chain: []
13
- date: 2023-03-23 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
14
12
  dependencies:
15
13
  - !ruby/object:Gem::Dependency
16
14
  name: faraday
@@ -255,7 +253,7 @@ description: 'Low level Ruby client for Elastic. See the `elasticsearch` or `ela
255
253
 
256
254
  '
257
255
  email:
258
- - support@elastic.co
256
+ - client-libs@elastic.co
259
257
  executables: []
260
258
  extensions: []
261
259
  extra_rdoc_files:
@@ -339,7 +337,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
337
  - !ruby/object:Gem::Version
340
338
  version: '0'
341
339
  requirements: []
342
- rubygems_version: 3.4.8
340
+ rubygems_version: 3.4.13
343
341
  signing_key:
344
342
  specification_version: 4
345
343
  summary: Low level Ruby client for Elastic services.