elasticsearch-api 7.16.1 → 7.16.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/elasticsearch-api.gemspec +8 -1
- data/lib/elasticsearch/api/utils.rb +2 -1
- data/lib/elasticsearch/api/version.rb +1 -1
- data/spec/elasticsearch/api/utils_spec.rb +9 -21
- data/spec/spec_helper.rb +4 -0
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c30590e2629d036e98030e2ad56ab10506b416302e7dfc36a607b896a8493e7
|
4
|
+
data.tar.gz: 95dbb9003133b3bb3067f266f4817a5913aa010aa1ef81beb23a943ffea6dc58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d9efbd6779e057fb1b71cc92967aee52ff5e099e604cadd8bc96cad08bcee6c98d93b7605b29989ffda8db38b028daa55405f58ba049f220e45e69a94cb6942
|
7
|
+
data.tar.gz: c0729f9e7fa8a405194ea93d3dac8bccaf12f7014a2ee1be828bdbcb7553b5928628bf0edfab30e0e86be815c8252c86c94904d0ecb723eb171a23c98c0655ad
|
data/elasticsearch-api.gemspec
CHANGED
@@ -62,10 +62,17 @@ Gem::Specification.new do |s|
|
|
62
62
|
# Gems for testing integrations
|
63
63
|
s.add_development_dependency 'jsonify'
|
64
64
|
s.add_development_dependency 'hashie'
|
65
|
+
# Temporary support for Ruby 2.6, since it's EOL March 2022:
|
66
|
+
if RUBY_VERSION < '2.7.0'
|
67
|
+
s.add_development_dependency 'jbuilder', '< 7.0.0'
|
68
|
+
else
|
69
|
+
s.add_development_dependency 'activesupport'
|
70
|
+
s.add_development_dependency 'jbuilder'
|
71
|
+
end
|
65
72
|
|
66
73
|
s.add_development_dependency 'cane'
|
67
74
|
s.add_development_dependency 'escape_utils' unless defined? JRUBY_VERSION
|
68
|
-
|
75
|
+
|
69
76
|
s.add_development_dependency 'require-prof' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
70
77
|
s.add_development_dependency 'simplecov'
|
71
78
|
s.add_development_dependency 'test-unit', '~> 2'
|
@@ -14,6 +14,7 @@
|
|
14
14
|
# KIND, either express or implied. See the License for the
|
15
15
|
# specific language governing permissions and limitations
|
16
16
|
# under the License.
|
17
|
+
require 'erb'
|
17
18
|
|
18
19
|
module Elasticsearch
|
19
20
|
module API
|
@@ -29,7 +30,7 @@ module Elasticsearch
|
|
29
30
|
# @api private
|
30
31
|
def __escape(string)
|
31
32
|
return string if string == '*'
|
32
|
-
|
33
|
+
ERB::Util.url_encode(string.to_s)
|
33
34
|
end
|
34
35
|
|
35
36
|
# Create a "list" of values from arguments, ignoring nil values and encoding special characters.
|
@@ -30,7 +30,7 @@ describe Elasticsearch::API::Utils do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'encodes special characters' do
|
33
|
-
expect(utils.__escape('foo bar')).to eq('foo
|
33
|
+
expect(utils.__escape('foo bar')).to eq('foo%20bar')
|
34
34
|
expect(utils.__escape('foo/bar')).to eq('foo%2Fbar')
|
35
35
|
expect(utils.__escape('foo^bar')).to eq('foo%5Ebar')
|
36
36
|
end
|
@@ -38,18 +38,6 @@ describe Elasticsearch::API::Utils do
|
|
38
38
|
it 'does not encode asterisks' do
|
39
39
|
expect(utils.__escape('*')).to eq('*')
|
40
40
|
end
|
41
|
-
|
42
|
-
it 'users CGI.escape by default' do
|
43
|
-
expect(CGI).to receive(:escape).and_call_original
|
44
|
-
expect(utils.__escape('foo bar')).to eq('foo+bar')
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'uses the escape_utils gem when available', unless: defined?(JRUBY_VERSION) do
|
48
|
-
require 'escape_utils'
|
49
|
-
expect(CGI).not_to receive(:escape)
|
50
|
-
expect(EscapeUtils).to receive(:escape_url).and_call_original
|
51
|
-
expect(utils.__escape('foo bar')).to eq('foo+bar')
|
52
|
-
end
|
53
41
|
end
|
54
42
|
|
55
43
|
describe '#__listify' do
|
@@ -77,7 +65,7 @@ describe Elasticsearch::API::Utils do
|
|
77
65
|
context 'when the escape option is set to false' do
|
78
66
|
|
79
67
|
it 'does not escape the characters' do
|
80
|
-
expect(utils.__listify(['foo', 'bar^bam'], :
|
68
|
+
expect(utils.__listify(['foo', 'bar^bam'], escape: false)).to eq('foo,bar^bam')
|
81
69
|
end
|
82
70
|
end
|
83
71
|
end
|
@@ -107,19 +95,19 @@ describe Elasticsearch::API::Utils do
|
|
107
95
|
|
108
96
|
let(:result) do
|
109
97
|
utils.__bulkify [
|
110
|
-
{ :
|
111
|
-
{ :
|
112
|
-
{ :
|
98
|
+
{ index: { _index: 'myindexA', _id: '1', data: { title: 'Test' } } },
|
99
|
+
{ update: { _index: 'myindexB', _id: '2', data: { doc: { title: 'Update' } } } },
|
100
|
+
{ delete: { _index: 'myindexC', _id: '3' } }
|
113
101
|
]
|
114
102
|
end
|
115
103
|
|
116
104
|
let(:expected_string) do
|
117
105
|
<<-PAYLOAD.gsub(/^\s+/, '')
|
118
|
-
{"index":{"_index":"myindexA","
|
106
|
+
{"index":{"_index":"myindexA","_id":"1"}}
|
119
107
|
{"title":"Test"}
|
120
|
-
{"update":{"_index":"myindexB","
|
108
|
+
{"update":{"_index":"myindexB","_id":"2"}}
|
121
109
|
{"doc":{"title":"Update"}}
|
122
|
-
{"delete":{"_index":"myindexC","
|
110
|
+
{"delete":{"_index":"myindexC","_id":"3"}}
|
123
111
|
PAYLOAD
|
124
112
|
end
|
125
113
|
|
@@ -379,7 +367,7 @@ describe Elasticsearch::API::Utils do
|
|
379
367
|
end
|
380
368
|
|
381
369
|
let(:unsupported_params) do
|
382
|
-
[ { :
|
370
|
+
[ { foo: { explanation: 'NOT_SUPPORTED'} }, :moo ]
|
383
371
|
end
|
384
372
|
|
385
373
|
|
data/spec/spec_helper.rb
CHANGED
@@ -25,6 +25,10 @@ else
|
|
25
25
|
require 'pry-byebug'
|
26
26
|
end
|
27
27
|
require 'ansi'
|
28
|
+
require 'yaml'
|
29
|
+
require 'active_support/isolated_execution_state' unless RUBY_VERSION < '2.7.0'
|
30
|
+
require 'jbuilder'
|
31
|
+
require 'jsonify'
|
28
32
|
require 'elasticsearch'
|
29
33
|
require 'elasticsearch-api'
|
30
34
|
require 'elasticsearch-transport'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.16.
|
4
|
+
version: 7.16.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
224
|
+
name: activesupport
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
@@ -235,7 +235,7 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
238
|
+
name: jbuilder
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - ">="
|
@@ -249,7 +249,21 @@ dependencies:
|
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
251
|
- !ruby/object:Gem::Dependency
|
252
|
-
name:
|
252
|
+
name: cane
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: escape_utils
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
254
268
|
requirements:
|
255
269
|
- - ">="
|
@@ -705,7 +719,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
705
719
|
- !ruby/object:Gem::Version
|
706
720
|
version: '0'
|
707
721
|
requirements: []
|
708
|
-
rubygems_version: 3.
|
722
|
+
rubygems_version: 3.3.3
|
709
723
|
signing_key:
|
710
724
|
specification_version: 4
|
711
725
|
summary: Ruby API for Elasticsearch.
|