opensearch-ruby 4.0.0.pre.beta.4 → 4.0.0.pre.beta.5

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: 042f372ee8559ded88873a96cba1bb5f635867e12f51e79dfc15d226df27249b
4
- data.tar.gz: 04fe73ce9dc643661f0834776736ec0a50cb816b4c25fa350a4d7e5947513301
3
+ metadata.gz: 3872c0c4466fe1c37a1732bf74624264530deb5da6e9a5abeb5343ca8b940ffb
4
+ data.tar.gz: 9c92adf323965443993e90da36d64b3200b717303c7dac47a0e20179e025af9d
5
5
  SHA512:
6
- metadata.gz: d03ac4de4e5cace0d3896a9441e6a0d86f5da3b56cf87e9e101e1a9de472ce6c0e23d2e9ae63a4227eb975d349a410ac14c091c98a8fc2da2e17e303a6c08778
7
- data.tar.gz: 5a98a0b9bab00c0783485cd7885de1a7abc79e8ef8bb3e6daf22c927d2761cf96ce37346a5576f96a750c720f6e392a34a5cf72c13f3e8c6f478051458c18b91
6
+ metadata.gz: f998b61dc76a8f5ff77be3dd75f5a52088cebc3f81a0ce7f011f90485d37a7a48b7701bf745b1d8487070b870131639cc5ac5ca3faa1e702efbd0532edc60f8f
7
+ data.tar.gz: cdbd89cb59925c945b065e3bf20dca9ca37fb51488b12f89b507b1ab2268e4f604d052a0f9d7c2a180b4d3ad55046741c1f4259dc2fdb3fffcf450467027300e
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -59,14 +59,12 @@ If you don't use Bundler, you may need to require the library explicitly (like `
59
59
 
60
60
  Currently these libraries will be automatically detected and used:
61
61
  - [Patron](https://github.com/toland/patron) through [faraday-patron](https://github.com/lostisland/faraday-patron)
62
- - [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.
62
+ - [Typhoeus](https://github.com/typhoeus/typhoeus) through [faraday-typhoeus](https://github.com/dleavitt/faraday-typhoeus)
63
63
  - [HTTPClient](https://rubygems.org/gems/httpclient) through [faraday-httpclient](https://github.com/lostisland/faraday-httpclient)
64
64
  - [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent) through [faraday-net_http_persistent](https://github.com/lostisland/faraday-net_http_persistent)
65
65
 
66
66
  **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.
67
67
 
68
- **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.
69
-
70
68
  ## DSL Features
71
69
 
72
70
  The `opensearch-dsl` library provides a Ruby API for the `OpenSearch Query DSL`.
@@ -19,7 +19,7 @@ module OpenSearch
19
19
  'filter_path' # Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with "-".
20
20
  ]).freeze
21
21
 
22
- DEFAULT_SERIALIZER = MultiJson
22
+ DEFAULT_SERIALIZER = Transport::Transport::Serializer::JSON.new
23
23
 
24
24
  def self.serializer
25
25
  settings[:serializer] || DEFAULT_SERIALIZER
@@ -366,10 +366,8 @@ module OpenSearch
366
366
  #
367
367
  def __auto_detect_adapter
368
368
  # Get the Faraday adapter list without initializing it.
369
- adapter = if Faraday::Adapter.respond_to?(:registered_middleware) # Faraday 2.x
369
+ adapter = if Faraday::Adapter.respond_to?(:registered_middleware)
370
370
  ->(name) { Faraday::Adapter.registered_middleware[name] }
371
- elsif Faraday::Adapter.respond_to?(:fetch_middleware) # Faraday 1.x
372
- ->(name) { Faraday::Adapter.fetch_middleware(name) }
373
371
  else
374
372
  {} # fallback behavior that should never happen
375
373
  end
@@ -37,7 +37,7 @@ module OpenSearch
37
37
  DEFAULT_RELOAD_AFTER = 10_000 # Requests
38
38
  DEFAULT_RESURRECT_AFTER = 60 # Seconds
39
39
  DEFAULT_MAX_RETRIES = 3 # Requests
40
- DEFAULT_SERIALIZER_CLASS = Serializer::MultiJson
40
+ DEFAULT_SERIALIZER_CLASS = Serializer::JSON
41
41
  SANITIZED_PASSWORD = '*' * rand(1..14)
42
42
 
43
43
  attr_reader :hosts, :options, :connections, :counter, :last_request_at, :protocol
@@ -38,21 +38,25 @@ module OpenSearch
38
38
  end
39
39
  end
40
40
 
41
- # A default JSON serializer (using [MultiJSON](http://rubygems.org/gems/multi_json))
41
+ # A default JSON serializer (using [json](http://rubygems.org/gems/json))
42
42
  #
43
- class MultiJson
43
+ class JSON
44
44
  include Base
45
45
 
46
46
  # De-serialize a Hash from JSON string
47
47
  #
48
48
  def load(string, options = {})
49
- ::MultiJson.load(string, options)
49
+ ::JSON.parse(string, options)
50
50
  end
51
51
 
52
52
  # Serialize a Hash to JSON string
53
53
  #
54
54
  def dump(object, options = {})
55
- ::MultiJson.dump(object, options)
55
+ if options.delete(:pretty)
56
+ ::JSON.pretty_generate(object, options)
57
+ else
58
+ ::JSON.generate(object, options)
59
+ end
56
60
  end
57
61
  end
58
62
  end
@@ -27,11 +27,11 @@
27
27
  require 'uri'
28
28
  require 'time'
29
29
  require 'timeout'
30
- require 'multi_json'
30
+ require 'json'
31
31
  require 'faraday'
32
32
 
33
33
  require 'opensearch/transport/transport/loggable'
34
- require 'opensearch/transport/transport/serializer/multi_json'
34
+ require 'opensearch/transport/transport/serializer/json'
35
35
  require 'opensearch/transport/transport/sniffer'
36
36
  require 'opensearch/transport/transport/response'
37
37
  require 'opensearch/transport/transport/errors'
@@ -25,5 +25,5 @@
25
25
  # under the License.
26
26
 
27
27
  module OpenSearch
28
- VERSION = '4.0.0-beta.4'.freeze
28
+ VERSION = '4.0.0-beta.5'.freeze
29
29
  end
@@ -64,7 +64,6 @@ Gem::Specification.new do |s|
64
64
 
65
65
  s.required_ruby_version = '>= 3.0'
66
66
 
67
- s.add_dependency 'faraday', '>= 1.0', '< 3'
67
+ s.add_dependency 'faraday', '~> 2.0'
68
68
  s.add_dependency "logger"
69
- s.add_dependency 'multi_json', '>= 1.0'
70
69
  end
data/spec/spec_helper.rb CHANGED
@@ -48,7 +48,7 @@ if defined?(JRUBY_VERSION)
48
48
  require 'pry-nav'
49
49
  else
50
50
  require 'faraday/patron'
51
- require 'faraday/typhoeus' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2')
51
+ require 'faraday/typhoeus'
52
52
  require 'opensearch/transport/transport/http/curb'
53
53
  require 'curb'
54
54
  end
@@ -37,7 +37,7 @@ class OpenSearch::Transport::ClientIntegrationTest < Minitest::Test
37
37
  # Require the library so autodetection finds it.
38
38
  require 'typhoeus'
39
39
  # Require the adapter so autodetection finds it.
40
- require 'faraday/typhoeus' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2')
40
+ require 'faraday/typhoeus'
41
41
 
42
42
  transport = OpenSearch::Transport::Transport::HTTP::Faraday.new \
43
43
  :hosts => [ { host: @host, port: @port } ] do |f|
@@ -30,11 +30,11 @@ class OpenSearch::Transport::Transport::SerializerTest < Minitest::Test
30
30
 
31
31
  context "Serializer" do
32
32
 
33
- should "use MultiJson by default" do
34
- ::MultiJson.expects(:load)
35
- ::MultiJson.expects(:dump)
36
- OpenSearch::Transport::Transport::Serializer::MultiJson.new.load('{}')
37
- OpenSearch::Transport::Transport::Serializer::MultiJson.new.dump({})
33
+ should "use JSON by default" do
34
+ ::JSON.expects(:parse)
35
+ ::JSON.expects(:generate)
36
+ OpenSearch::Transport::Transport::Serializer::JSON.new.load('{}')
37
+ OpenSearch::Transport::Transport::Serializer::JSON.new.dump({})
38
38
  end
39
39
 
40
40
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opensearch-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre.beta.4
4
+ version: 4.0.0.pre.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
@@ -31,28 +31,22 @@ cert_chain:
31
31
  m0rB25J1sO2yjlalRdBoV5p7OKaWG4CGMr+q6vCC2za7yrtZiYOOv+KpWmheTwds
32
32
  P1nbdIL2eAXGfNU3cbtYisS1sSYi7VSkS52pVk8Jgtw=
33
33
  -----END CERTIFICATE-----
34
- date: 2025-04-18 00:00:00.000000000 Z
34
+ date: 2025-05-01 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: faraday
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '1.0'
43
- - - "<"
40
+ - - "~>"
44
41
  - !ruby/object:Gem::Version
45
- version: '3'
42
+ version: '2.0'
46
43
  type: :runtime
47
44
  prerelease: false
48
45
  version_requirements: !ruby/object:Gem::Requirement
49
46
  requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: '1.0'
53
- - - "<"
47
+ - - "~>"
54
48
  - !ruby/object:Gem::Version
55
- version: '3'
49
+ version: '2.0'
56
50
  - !ruby/object:Gem::Dependency
57
51
  name: logger
58
52
  requirement: !ruby/object:Gem::Requirement
@@ -67,20 +61,6 @@ dependencies:
67
61
  - - ">="
68
62
  - !ruby/object:Gem::Version
69
63
  version: '0'
70
- - !ruby/object:Gem::Dependency
71
- name: multi_json
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '1.0'
77
- type: :runtime
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '1.0'
84
64
  description: |
85
65
  OpenSearch Ruby is a Ruby client for OpenSearch. You can use the client to
86
66
  execute OpenSearch API commands, and build OpenSearch queries and aggregations
@@ -649,7 +629,7 @@ files:
649
629
  - lib/opensearch/transport/transport/http/manticore.rb
650
630
  - lib/opensearch/transport/transport/loggable.rb
651
631
  - lib/opensearch/transport/transport/response.rb
652
- - lib/opensearch/transport/transport/serializer/multi_json.rb
632
+ - lib/opensearch/transport/transport/serializer/json.rb
653
633
  - lib/opensearch/transport/transport/sniffer.rb
654
634
  - lib/opensearch/version.rb
655
635
  - opensearch-ruby.gemspec
metadata.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- ���'Õ��� 鍅�T��"�آ��6�pF�u���.Jg��a�X�0��N�1B��x4|à�q��TF�����(�L����ㆍ*�'#λ���4&��,RmC{��
2
- �����@�ԗ�I�*�H�� d����%fm�����Jvy2O��&��rRyA��X=́8h
3
- à=���z�Ҵ���*>c�@��}p���{
1
+ p��_%&X��f�\���{��J<�1Jv`
2
+ ^Ƥ���󟰙Q^�AuOz��Mȥ���J=�gn3Y[��([W@�L�߁��N�9=��)EF(��qh������[H(d_���
3
+ #4ܻ ����" Hɥ��Þ�I��]n丞�e/|f �?.�PA#��1.�x#1�# K�7��{���+6��L.JOb2�ܣ�v�������@���k�O�/(@��(;�������);t��)��!n�w��u�