picky-client 4.3.0 → 4.3.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/picky-client/client.rb
CHANGED
@@ -8,7 +8,7 @@ module Picky
|
|
8
8
|
# * data: A hash in the form of { :id => 1234, :attr1 => 'attr1', :attr2 => 'attr2', ... }.
|
9
9
|
#
|
10
10
|
def replace index_name, data
|
11
|
-
|
11
|
+
send_off Net::HTTP::Post.new(self.path), index_name, data
|
12
12
|
end
|
13
13
|
|
14
14
|
# TODO Rename?
|
@@ -18,14 +18,14 @@ module Picky
|
|
18
18
|
# * data: A hash in the form of { :id => 1234 }.
|
19
19
|
#
|
20
20
|
def remove index_name, data
|
21
|
-
|
21
|
+
send_off Net::HTTP::Delete.new(self.path), index_name, data
|
22
22
|
end
|
23
23
|
|
24
24
|
# Sends a request to the Picky server.
|
25
25
|
#
|
26
26
|
# Note: Data is JSON encoded.
|
27
27
|
#
|
28
|
-
def
|
28
|
+
def send_off request, index_name, data
|
29
29
|
request.form_data = { :index => index_name, :data => ActiveSupport::JSON.encode(data) }
|
30
30
|
Net::HTTP.new(self.host, self.port).start { |http| http.request request }
|
31
31
|
end
|
@@ -6,7 +6,7 @@ describe Picky::Client do
|
|
6
6
|
|
7
7
|
describe 'replace' do
|
8
8
|
it 'delegates to the request method' do
|
9
|
-
client.should_receive(:
|
9
|
+
client.should_receive(:send_off).once.with anything, :some_index_name, :some_data
|
10
10
|
|
11
11
|
client.replace :some_index_name, :some_data
|
12
12
|
end
|
@@ -14,7 +14,7 @@ describe Picky::Client do
|
|
14
14
|
|
15
15
|
describe 'remove' do
|
16
16
|
it 'delegates to the request method' do
|
17
|
-
client.should_receive(:
|
17
|
+
client.should_receive(:send_off).once.with anything, :some_index_name, :some_data
|
18
18
|
|
19
19
|
client.remove :some_index_name, :some_data
|
20
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &70133345256740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.7.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70133345256740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70133345272040 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70133345272040
|
36
36
|
description: Picky Client
|
37
37
|
email: florian.hanke+picky-client@gmail.com
|
38
38
|
executables: []
|