rsolr 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rsolr/char.rb +2 -2
- data/lib/rsolr/client.rb +2 -2
- data/lib/rsolr/response.rb +1 -1
- data/lib/rsolr/version.rb +1 -1
- data/spec/api/client_spec.rb +9 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e3ceb8a3a7f0e613a2ec1ea63e74f65c6a7f4f8
|
4
|
+
data.tar.gz: 0043fbd129fb4ea74585184df9efb71543689eb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91eed5ff5587efe17f84b90c1c5cc962a2a4fddda1824002d91a3d8a08ce0eca0123352a736f7f6ab0b119afc54c1705038f886f5e7fbaadbfc02c02f18bfddc
|
7
|
+
data.tar.gz: 403a89708dc1ef43fdd2e7b9b776695f766986aae39c6b9a0ca16a6e4c0f3ce65eb2c60f5f815a0d748439d1cf0d107cc5ab81828cf3992b7153e73761afecb5
|
data/lib/rsolr/char.rb
CHANGED
@@ -6,7 +6,7 @@ module RSolr::Char
|
|
6
6
|
# that isn't a word character
|
7
7
|
# @deprecated - this is incorrect Solr escaping
|
8
8
|
def escape value
|
9
|
-
warn "[DEPRECATION] `RSolr.escape` is deprecated (and incorrect). Use `
|
9
|
+
warn "[DEPRECATION] `RSolr.escape` is deprecated (and incorrect). Use `RSolr.solr_escape` instead."
|
10
10
|
value.gsub(/(\W)/, '\\\\\1')
|
11
11
|
end
|
12
12
|
|
@@ -21,4 +21,4 @@ module RSolr::Char
|
|
21
21
|
# }.join(delim)
|
22
22
|
# end
|
23
23
|
|
24
|
-
end
|
24
|
+
end
|
data/lib/rsolr/client.rb
CHANGED
@@ -289,7 +289,7 @@ class RSolr::Client
|
|
289
289
|
response[:body]
|
290
290
|
end
|
291
291
|
|
292
|
-
if result.is_a?(Hash)
|
292
|
+
if result.is_a?(Hash) || request[:method] == :head
|
293
293
|
result = RSolr::HashWithResponse.new(request, response, result)
|
294
294
|
end
|
295
295
|
|
@@ -326,7 +326,7 @@ class RSolr::Client
|
|
326
326
|
return response[:body] unless defined? JSON
|
327
327
|
|
328
328
|
begin
|
329
|
-
JSON.parse response[:body].to_s
|
329
|
+
JSON.parse response[:body].to_s
|
330
330
|
rescue JSON::ParserError
|
331
331
|
raise RSolr::Error::InvalidJsonResponse.new request, response
|
332
332
|
end
|
data/lib/rsolr/response.rb
CHANGED
data/lib/rsolr/version.rb
CHANGED
data/spec/api/client_spec.rb
CHANGED
@@ -201,28 +201,33 @@ describe "RSolr::Client" do
|
|
201
201
|
context "adapt_response" do
|
202
202
|
include ClientHelper
|
203
203
|
it 'should not try to evaluate ruby when the :qt is not :ruby' do
|
204
|
-
body = '{
|
204
|
+
body = '{"time"=>"NOW"}'
|
205
205
|
result = client.adapt_response({:params=>{}}, {:status => 200, :body => body, :headers => {}})
|
206
206
|
expect(result).to eq(body)
|
207
207
|
end
|
208
208
|
|
209
209
|
it 'should evaluate ruby responses when the :wt is :ruby' do
|
210
|
-
body = '{
|
210
|
+
body = '{"time"=>"NOW"}'
|
211
211
|
result = client.adapt_response({:params=>{:wt=>:ruby}}, {:status => 200, :body => body, :headers => {}})
|
212
|
-
expect(result).to eq({
|
212
|
+
expect(result).to eq({"time"=>"NOW"})
|
213
213
|
end
|
214
214
|
|
215
215
|
it 'should evaluate json responses when the :wt is :json' do
|
216
216
|
body = '{"time": "NOW"}'
|
217
217
|
result = client.adapt_response({:params=>{:wt=>:json}}, {:status => 200, :body => body, :headers => {}})
|
218
218
|
if defined? JSON
|
219
|
-
expect(result).to eq({
|
219
|
+
expect(result).to eq({"time"=>"NOW"})
|
220
220
|
else
|
221
221
|
# ruby 1.8 without the JSON gem
|
222
222
|
expect(result).to eq('{"time": "NOW"}')
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
226
|
+
it 'should return a response for a head request' do
|
227
|
+
result = client.adapt_response({:method=>:head,:params=>{}}, {:status => 200, :body => nil, :headers => {}})
|
228
|
+
expect(result.response[:status]).to eq 200
|
229
|
+
end
|
230
|
+
|
226
231
|
it "ought raise a RSolr::Error::InvalidRubyResponse when the ruby is indeed frugged, or even fruggified" do
|
227
232
|
expect {
|
228
233
|
client.adapt_response({:params=>{:wt => :ruby}}, {:status => 200, :body => "<woops/>", :headers => {}})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsolr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Latter
|
@@ -29,7 +29,7 @@ authors:
|
|
29
29
|
autorequire:
|
30
30
|
bindir: bin
|
31
31
|
cert_chain: []
|
32
|
-
date: 2015-
|
32
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: builder
|
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
requirements: []
|
174
174
|
rubyforge_project: rsolr
|
175
|
-
rubygems_version: 2.4.
|
175
|
+
rubygems_version: 2.4.8
|
176
176
|
signing_key:
|
177
177
|
specification_version: 4
|
178
178
|
summary: A Ruby client for Apache Solr
|