inquisitio 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/inquisitio/searcher.rb +4 -4
- data/lib/inquisitio/version.rb +1 -1
- data/test/results_test.rb +3 -3
- data/test/searcher_test.rb +8 -8
- 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: 5beb1d995aa120b59b2a6f45c0f2c3827e40f5eb
|
4
|
+
data.tar.gz: 4b0f184f436c0042c3096b74dc4a6dfa82b0c109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92252a7a9af735589d88d89181ad5377383c1350350d85182f6cb02d7011175a84965e5ff32550a4f293e1f44150eeb50b50295b4bf668d087a2b65e3cfa5c1b
|
7
|
+
data.tar.gz: 5f975e567a4c08fb553090446eee45e44cf2d086334ed05fab01afee966c3136fe8fb11eb4d9e1144bf21291b1d2d716a9f3e3e9a6316a880b354e6dd376b2d4
|
data/CHANGELOG.md
CHANGED
data/lib/inquisitio/searcher.rb
CHANGED
@@ -28,16 +28,16 @@ module Inquisitio
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def ids
|
31
|
-
@ids ||= map{|r|r['data']['
|
31
|
+
@ids ||= map{|r|r['data']['id'].first}.flatten.map(&:to_i)
|
32
32
|
end
|
33
33
|
|
34
34
|
def records
|
35
35
|
@records ||= begin
|
36
36
|
klasses = {}
|
37
37
|
results.map do |result|
|
38
|
-
klass = result['data']['
|
38
|
+
klass = result['data']['type'].first
|
39
39
|
klasses[klass] ||= []
|
40
|
-
klasses[klass] << result['data']['
|
40
|
+
klasses[klass] << result['data']['id'].first
|
41
41
|
end
|
42
42
|
|
43
43
|
klasses.map {|klass, ids|
|
@@ -127,7 +127,7 @@ module Inquisitio
|
|
127
127
|
|
128
128
|
def search_url
|
129
129
|
@search_url ||= begin
|
130
|
-
return_fields = params[:returns].empty?? [:
|
130
|
+
return_fields = params[:returns].empty?? [:type, :id] : params[:returns]
|
131
131
|
|
132
132
|
SearchUrlBuilder.build(
|
133
133
|
query: params[:criteria],
|
data/lib/inquisitio/version.rb
CHANGED
data/test/results_test.rb
CHANGED
@@ -6,9 +6,9 @@ module Inquisitio
|
|
6
6
|
super
|
7
7
|
@search_endpoint = 'http://my.search-endpoint.com'
|
8
8
|
Inquisitio.config.search_endpoint = @search_endpoint
|
9
|
-
@result_1 = {'data' => {'
|
10
|
-
@result_2 = {'data' => {'
|
11
|
-
@result_3 = {'data' => {'
|
9
|
+
@result_1 = {'data' => {'id' => ['1'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
|
10
|
+
@result_2 = {'data' => {'id' => ['2'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
|
11
|
+
@result_3 = {'data' => {'id' => ['20'], 'title' => ["Foobar2"], 'type' => ["Module_Dog"]}}
|
12
12
|
@expected_results = [@result_1, @result_2, @result_3]
|
13
13
|
@start = 5
|
14
14
|
@found = 8
|
data/test/searcher_test.rb
CHANGED
@@ -6,9 +6,9 @@ module Inquisitio
|
|
6
6
|
super
|
7
7
|
@search_endpoint = 'http://my.search-endpoint.com'
|
8
8
|
Inquisitio.config.search_endpoint = @search_endpoint
|
9
|
-
@result_1 = {'data' => {'
|
10
|
-
@result_2 = {'data' => {'
|
11
|
-
@result_3 = {'data' => {'
|
9
|
+
@result_1 = {'data' => {'id' => ['1'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
|
10
|
+
@result_2 = {'data' => {'id' => ['2'], 'title' => ["Foobar"], 'type' => ["Cat"]}}
|
11
|
+
@result_3 = {'data' => {'id' => ['20'], 'title' => ["Foobar2"], 'type' => ["Module_Dog"]}}
|
12
12
|
@expected_results = [@result_1, @result_2, @result_3]
|
13
13
|
@start = 5
|
14
14
|
@found = 8
|
@@ -177,13 +177,13 @@ module Inquisitio
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def test_returns_with_array_gets_correct_url
|
180
|
-
searcher = Searcher.returns('
|
181
|
-
assert searcher.send(:search_url).include? "&return-fields=
|
180
|
+
searcher = Searcher.returns('id', 'foobar')
|
181
|
+
assert searcher.send(:search_url).include? "&return-fields=id,foobar"
|
182
182
|
end
|
183
183
|
|
184
184
|
def test_returns_appends_variable
|
185
|
-
searcher = Searcher.returns('
|
186
|
-
assert_equal ['
|
185
|
+
searcher = Searcher.returns('id').returns('foobar')
|
186
|
+
assert_equal ['id', 'foobar'], searcher.params[:returns]
|
187
187
|
end
|
188
188
|
|
189
189
|
def test_with_saves_variable
|
@@ -279,7 +279,7 @@ module Inquisitio
|
|
279
279
|
def test_should_return_type_and_id_by_default
|
280
280
|
searcher = Searcher.where('Star Wars')
|
281
281
|
assert_equal [], searcher.params[:returns]
|
282
|
-
assert searcher.send(:search_url).include? "&return-fields=
|
282
|
+
assert searcher.send(:search_url).include? "&return-fields=type,id"
|
283
283
|
searcher.send(:search_url)
|
284
284
|
end
|
285
285
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inquisitio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Walker
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
13
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: excon
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.2.0
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: This wraps AWS CloudSearch in a Ruby Gem
|