rummageable 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rummageable/implementation.rb +6 -6
- data/lib/rummageable/version.rb +1 -1
- data/test/rummageable_test.rb +4 -4
- metadata +4 -4
@@ -1,13 +1,13 @@
|
|
1
1
|
module Rummageable
|
2
2
|
class Implementation
|
3
3
|
def index(documents, index_name)
|
4
|
-
documents = [documents]
|
5
|
-
documents.each do |document|
|
6
|
-
validate_structure document
|
7
|
-
end
|
4
|
+
documents = documents.is_a?(Hash) ? [documents] : documents
|
8
5
|
url = Rummageable.rummager_host + index_name + "/documents"
|
9
|
-
|
10
|
-
|
6
|
+
documents.each_slice(CHUNK_SIZE).each do |slice|
|
7
|
+
slice.each do |document|
|
8
|
+
validate_structure document
|
9
|
+
end
|
10
|
+
body = JSON.dump(slice)
|
11
11
|
RestClient.post url, body, content_type: :json, accept: :json
|
12
12
|
end
|
13
13
|
end
|
data/lib/rummageable/version.rb
CHANGED
data/test/rummageable_test.rb
CHANGED
@@ -108,12 +108,12 @@ class RummageableTest < MiniTest::Unit::TestCase
|
|
108
108
|
def test_should_post_to_rummageable_host_determined_by_rummager_service_name
|
109
109
|
document = {"title" => "TITLE"}
|
110
110
|
stub_request(:post, "#{API}/documents")
|
111
|
-
stub_request(:post, "
|
111
|
+
stub_request(:post, "#{Plek.current.find("whitehall-search")}/documents")
|
112
112
|
with_rummager_service_name("whitehall-search") do
|
113
113
|
Rummageable.index(document)
|
114
114
|
end
|
115
115
|
assert_not_requested(:post, "#{API}/documents")
|
116
|
-
assert_requested(:post, "
|
116
|
+
assert_requested(:post, "#{Plek.current.find("whitehall-search")}/documents")
|
117
117
|
end
|
118
118
|
|
119
119
|
def test_should_delete_a_document_by_its_link
|
@@ -181,12 +181,12 @@ class RummageableTest < MiniTest::Unit::TestCase
|
|
181
181
|
def test_should_delete_to_rummageable_host_determined_by_rummager_service_name
|
182
182
|
link = "http://example.com/foo"
|
183
183
|
stub_request(:delete, "#{API}/documents/http:%2F%2Fexample.com%2Ffoo")
|
184
|
-
stub_request(:delete, "
|
184
|
+
stub_request(:delete, "#{Plek.current.find("whitehall-search")}/documents/http:%2F%2Fexample.com%2Ffoo")
|
185
185
|
with_rummager_service_name("whitehall-search") do
|
186
186
|
Rummageable.delete(link)
|
187
187
|
end
|
188
188
|
assert_not_requested(:delete, "#{API}/#{API}/documents/http:%2F%2Fexample.com%2Ffoo")
|
189
|
-
assert_requested(:delete, "
|
189
|
+
assert_requested(:delete, "#{Plek.current.find("whitehall-search")}/documents/http:%2F%2Fexample.com%2Ffoo")
|
190
190
|
end
|
191
191
|
|
192
192
|
def test_should_defer_to_plek_for_the_location_of_the_rummager_host
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rummageable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- GovUK Beta Team
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2013-01-10 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
106
106
|
- - ">="
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
108
|
+
hash: -4255739336630407155
|
109
109
|
segments:
|
110
110
|
- 0
|
111
111
|
version: "0"
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
hash:
|
117
|
+
hash: -4255739336630407155
|
118
118
|
segments:
|
119
119
|
- 0
|
120
120
|
version: "0"
|