elasticsearch-api 6.0.1 → 6.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 +4 -4
- data/lib/elasticsearch/api/actions/bulk.rb +1 -1
- data/lib/elasticsearch/api/actions/msearch.rb +1 -1
- data/lib/elasticsearch/api/actions/msearch_template.rb +1 -1
- data/lib/elasticsearch/api/namespace/common.rb +2 -2
- data/lib/elasticsearch/api/version.rb +1 -1
- data/test/test_helper.rb +2 -2
- data/test/unit/bulk_test.rb +2 -1
- data/test/unit/msearch_template_test.rb +2 -1
- data/test/unit/msearch_test.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55a30f0db61dcdfbb873ba85a8510676ebc9465
|
4
|
+
data.tar.gz: 38ae6ef5d63796206875009ea7f2cc17aa09826b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3792d6c5feb6ca8d153fd5b078e7341ed2025b0517cb2b0bc95a73de78b3433659078de13df99c3ff480a17847347664398233e4e9a968ce01825639cadc96c
|
7
|
+
data.tar.gz: 8811d738df8d8be954ecbe8824fbfe42066fb5ef3549829efd4eb2bccd522fc4d64f345bcf64ac95e682e3fb2122fc217b5887da274e645c0811307618eb42a2
|
@@ -17,8 +17,8 @@ module Elasticsearch
|
|
17
17
|
|
18
18
|
# Delegates the `perform_request` method to the wrapped client
|
19
19
|
#
|
20
|
-
def perform_request(method, path, params={}, body=nil)
|
21
|
-
client.perform_request method, path, params, body
|
20
|
+
def perform_request(method, path, params={}, body=nil, headers=nil)
|
21
|
+
client.perform_request method, path, params, body, headers
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
data/test/test_helper.rb
CHANGED
@@ -46,8 +46,8 @@ module Elasticsearch
|
|
46
46
|
class FakeClient
|
47
47
|
include Elasticsearch::API
|
48
48
|
|
49
|
-
def perform_request(method, path, params, body)
|
50
|
-
puts "PERFORMING REQUEST:", "--> #{method.to_s.upcase} #{path} #{params} #{body}"
|
49
|
+
def perform_request(method, path, params, body, headers={"Content-Type" => "application/json"})
|
50
|
+
puts "PERFORMING REQUEST:", "--> #{method.to_s.upcase} #{path} #{params} #{body} #{headers}"
|
51
51
|
FakeResponse.new(200, 'FAKE', {})
|
52
52
|
end
|
53
53
|
end
|
data/test/unit/bulk_test.rb
CHANGED
@@ -8,7 +8,7 @@ module Elasticsearch
|
|
8
8
|
subject { FakeClient.new }
|
9
9
|
|
10
10
|
should "post correct payload to the endpoint" do
|
11
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
11
|
+
subject.expects(:perform_request).with do |method, url, params, body, headers|
|
12
12
|
assert_equal 'POST', method
|
13
13
|
assert_equal '_bulk', url
|
14
14
|
assert_equal Hash.new, params
|
@@ -32,6 +32,7 @@ module Elasticsearch
|
|
32
32
|
{"data":"MYDATA"}
|
33
33
|
PAYLOAD
|
34
34
|
end
|
35
|
+
assert_equal 'application/x-ndjson', headers["Content-Type"]
|
35
36
|
true
|
36
37
|
end.returns(FakeResponse.new)
|
37
38
|
|
@@ -14,7 +14,7 @@ module Elasticsearch
|
|
14
14
|
end
|
15
15
|
|
16
16
|
should "serialize and post header/data pairs" do
|
17
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
17
|
+
subject.expects(:perform_request).with do |method, url, params, body, headers|
|
18
18
|
assert_equal 'GET', method
|
19
19
|
assert_equal '_msearch/template', url
|
20
20
|
assert_equal Hash.new, params
|
@@ -24,6 +24,7 @@ module Elasticsearch
|
|
24
24
|
{"index":"bar"}
|
25
25
|
{"id":"query_foo","params":{"q":"foo"}}
|
26
26
|
PAYLOAD
|
27
|
+
assert_equal 'application/x-ndjson', headers["Content-Type"]
|
27
28
|
true
|
28
29
|
end.returns(FakeResponse.new)
|
29
30
|
|
data/test/unit/msearch_test.rb
CHANGED
@@ -14,7 +14,7 @@ module Elasticsearch
|
|
14
14
|
end
|
15
15
|
|
16
16
|
should "post correct payload to the endpoint" do
|
17
|
-
subject.expects(:perform_request).with do |method, url, params, body|
|
17
|
+
subject.expects(:perform_request).with do |method, url, params, body, headers|
|
18
18
|
assert_equal 'GET', method
|
19
19
|
assert_equal '_msearch', url
|
20
20
|
assert_equal Hash.new, params
|
@@ -26,6 +26,7 @@ module Elasticsearch
|
|
26
26
|
{"search_type":"count"}
|
27
27
|
{"facets":{"tags":{}}}
|
28
28
|
PAYLOAD
|
29
|
+
assert_equal 'application/x-ndjson', headers["Content-Type"]
|
29
30
|
true
|
30
31
|
end.returns(FakeResponse.new)
|
31
32
|
|
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: 6.0.
|
4
|
+
version: 6.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|