elasticsearch-api 6.0.1 → 6.0.2

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
  SHA1:
3
- metadata.gz: ba7cd7dc9a07db583b12281c41cf5d612ed43f02
4
- data.tar.gz: 2fedb5c237669e77184ab1e7bff1df3cb324614e
3
+ metadata.gz: c55a30f0db61dcdfbb873ba85a8510676ebc9465
4
+ data.tar.gz: 38ae6ef5d63796206875009ea7f2cc17aa09826b
5
5
  SHA512:
6
- metadata.gz: e963573fb73b41056f6fe8af032d5fa2b0f6818a5ea1f0f7ebb80a03e78745d946897b0cb3ca103763f2fcb53817d92e55f30b5abef01899f87a1bbd8392447f
7
- data.tar.gz: 5dde0d7b48b370a27d7c25aa418d1d00ac982fb6242c594aa7fad6665f7b020539cb0cfcd5dfb0970f39b7638ac9cc404ac2c69da634da144b78a1365bd988bd
6
+ metadata.gz: c3792d6c5feb6ca8d153fd5b078e7341ed2025b0517cb2b0bc95a73de78b3433659078de13df99c3ff480a17847347664398233e4e9a968ce01825639cadc96c
7
+ data.tar.gz: 8811d738df8d8be954ecbe8824fbfe42066fb5ef3549829efd4eb2bccd522fc4d64f345bcf64ac95e682e3fb2122fc217b5887da274e645c0811307618eb42a2
@@ -92,7 +92,7 @@ module Elasticsearch
92
92
  payload = body
93
93
  end
94
94
 
95
- perform_request(method, path, params, payload).body
95
+ perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body
96
96
  end
97
97
  end
98
98
  end
@@ -71,7 +71,7 @@ module Elasticsearch
71
71
  payload = body
72
72
  end
73
73
 
74
- perform_request(method, path, params, payload).body
74
+ perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body
75
75
  end
76
76
  end
77
77
  end
@@ -38,7 +38,7 @@ module Elasticsearch
38
38
  payload = body
39
39
  end
40
40
 
41
- perform_request(method, path, params, payload).body
41
+ perform_request(method, path, params, payload, {"Content-Type" => "application/x-ndjson"}).body
42
42
  end
43
43
  end
44
44
  end
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "6.0.1"
3
+ VERSION = "6.0.2"
4
4
  end
5
5
  end
@@ -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
@@ -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
 
@@ -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.1
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-01-28 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json