stretcher 1.16.0 → 1.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stretcher.rb +1 -0
- data/lib/stretcher/index.rb +2 -2
- data/lib/stretcher/server.rb +3 -3
- data/lib/stretcher/util.rb +1 -1
- data/lib/stretcher/version.rb +1 -1
- data/spec/lib/stretcher_index_spec.rb +1 -1
- data/stretcher.gemspec +2 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45e7f0125d5ba9baba24e71c12522d6150501edf
|
4
|
+
data.tar.gz: 6f5f9ec4b5e7fc75209c919e2d8e6abb2564a8ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9287ac799f24dbe74738968c57e693f10ddceb3589226f6e235485af7bd3cd24482877b83f877eb65210235f7480133ba5b9a29209dcc2d10f62f837c44ef05
|
7
|
+
data.tar.gz: 4ed876dad2d9820b0f3a3959745bf66d5a6e7d75c28c247af9b5fb5d7213d2de8eae9490c9a7b1af818e5df8441c4413be660cc8853894e587b27525b759f81b
|
data/lib/stretcher.rb
CHANGED
data/lib/stretcher/index.rb
CHANGED
@@ -50,8 +50,8 @@ module Stretcher
|
|
50
50
|
index_meta[key] = d.delete(key) if system_fields.include?(key.to_s)
|
51
51
|
end
|
52
52
|
|
53
|
-
post_data << ({action => index_meta}
|
54
|
-
post_data << (d
|
53
|
+
post_data << (MultiJson.dump({action => index_meta}) + "\n")
|
54
|
+
post_data << (MultiJson.dump(d) + "\n") unless action == :delete
|
55
55
|
post_data
|
56
56
|
}
|
57
57
|
@server.bulk body, options
|
data/lib/stretcher/server.rb
CHANGED
@@ -7,9 +7,9 @@ module Stretcher
|
|
7
7
|
def self.build_client(uri, options={})
|
8
8
|
http = Faraday.new(:url => uri) do |builder|
|
9
9
|
builder.response :mashify
|
10
|
-
builder.response :
|
10
|
+
builder.response :multi_json, :content_type => /\bjson$/
|
11
11
|
|
12
|
-
builder.request :
|
12
|
+
builder.request :multi_json
|
13
13
|
|
14
14
|
builder.options[:read_timeout] = options[:read_timeout] || 4
|
15
15
|
builder.options[:open_timeout] = options[:open_timeout] || 2
|
@@ -125,7 +125,7 @@ module Stretcher
|
|
125
125
|
# server.msearch(data)
|
126
126
|
def msearch(body=[])
|
127
127
|
raise ArgumentError, "msearch takes an array!" unless body.is_a?(Array)
|
128
|
-
fmt_body = body.map(
|
128
|
+
fmt_body = body.map {|l| MultiJson.dump(l) }.join("\n") + "\n"
|
129
129
|
|
130
130
|
res = request(:get, path_uri("/_msearch"), {}, fmt_body)
|
131
131
|
|
data/lib/stretcher/util.rb
CHANGED
@@ -3,7 +3,7 @@ module Stretcher
|
|
3
3
|
|
4
4
|
# cURL formats a Faraday req. Useful for logging
|
5
5
|
def self.curl_format(req)
|
6
|
-
body = "-d '#{req.body.is_a?(Hash) ? req.body
|
6
|
+
body = "-d '#{req.body.is_a?(Hash) ? MultiJson.dump(req.body) : req.body}'" if req.body
|
7
7
|
headers = req.headers.map {|name, value| "'-H #{name}: #{value}'" }.sort.join(' ')
|
8
8
|
method = req.method.to_s.upcase
|
9
9
|
url = Util.qurl(req.path,req.params)
|
data/lib/stretcher/version.rb
CHANGED
@@ -58,7 +58,7 @@ describe Stretcher::Index do
|
|
58
58
|
options = { :mappings => { :movie => { :properties => { :category => { :type => 'string' } } } } }
|
59
59
|
|
60
60
|
server.logger.should_receive(:debug) do |&block|
|
61
|
-
block.call.should == %{curl -XPUT http://localhost:9200/foo -d '#{options
|
61
|
+
block.call.should == %{curl -XPUT http://localhost:9200/foo -d '#{MultiJson.dump(options)}' '-H Accept: application/json' '-H Content-Type: application/json' '-H User-Agent: Stretcher Ruby Gem #{Stretcher::VERSION}'}
|
62
62
|
end
|
63
63
|
|
64
64
|
index.create(options)
|
data/stretcher.gemspec
CHANGED
@@ -30,6 +30,8 @@ Gem::Specification.new do |gem|
|
|
30
30
|
gem.add_dependency('faraday_middleware', '~> 0.9.0')
|
31
31
|
gem.add_dependency('excon', '>= 0.16')
|
32
32
|
gem.add_dependency('hashie', '>= 1.2.0')
|
33
|
+
gem.add_dependency('multi_json', '>= 1.0')
|
34
|
+
gem.add_dependency('faraday_middleware-multi_json', "~> 0.0.5")
|
33
35
|
|
34
36
|
gem.add_development_dependency 'rspec', '>= 2.5.0'
|
35
37
|
gem.add_development_dependency 'coveralls'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stretcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Cholakian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: multi_json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday_middleware-multi_json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.5
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rspec
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|