gummi 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -7,11 +7,12 @@ module Gummi
|
|
7
7
|
attr_reader :took, :total, :hits, :facets
|
8
8
|
|
9
9
|
def initialize(response, converter, per_page, page)
|
10
|
+
@success = !!response
|
10
11
|
@response = Hashie::Mash.new response
|
11
|
-
@took = @response.hits.took
|
12
|
-
@total = @response.hits.total
|
13
|
-
@hits = @response.hits.hits
|
14
|
-
@facets = @response.facets
|
12
|
+
@took = @response.hits.took if @response.hits
|
13
|
+
@total = @response.hits.total if @response.hits
|
14
|
+
@hits = @response.hits.hits if @response.hits
|
15
|
+
@facets = @response.facets || Hashie::Mash.new
|
15
16
|
@converter = converter
|
16
17
|
@per_page = per_page
|
17
18
|
@page = page
|
@@ -24,6 +25,10 @@ module Gummi
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
28
|
+
def success?
|
29
|
+
@success
|
30
|
+
end
|
31
|
+
|
27
32
|
private
|
28
33
|
|
29
34
|
attr_reader :response, :converter, :per_page, :page, :hits
|
@@ -29,6 +29,8 @@ module Gummi
|
|
29
29
|
|
30
30
|
def execute
|
31
31
|
Gummi::DbLayer::Document::Search::Result.new client.search(to_client_args), document_class, per_page, page
|
32
|
+
rescue Faraday::Error::ConnectionFailed
|
33
|
+
Gummi::DbLayer::Document::Search::Result.new nil, document_class, per_page, page
|
32
34
|
end
|
33
35
|
|
34
36
|
private
|
@@ -6,10 +6,11 @@ module Gummi
|
|
6
6
|
attr_reader :took
|
7
7
|
|
8
8
|
def initialize(search_result, converter)
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
9
|
+
@success = search_result.success?
|
10
|
+
@search_result = search_result
|
11
|
+
@took = @search_result.took if @search_result
|
12
|
+
@documents = @search_result.documents if @search_result
|
13
|
+
@converter = converter
|
13
14
|
end
|
14
15
|
|
15
16
|
def facets
|
@@ -31,6 +32,10 @@ module Gummi
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
35
|
+
def success?
|
36
|
+
@success
|
37
|
+
end
|
38
|
+
|
34
39
|
# Leaflet::Collection has many methods we want to make use of.
|
35
40
|
# E.g. kaminari and will_paginate support.
|
36
41
|
# Also, we want to have Enumerable and #decorate at our fingertips.
|
data/lib/gummi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gummi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: virtus
|
@@ -269,18 +269,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
269
|
- - ! '>='
|
270
270
|
- !ruby/object:Gem::Version
|
271
271
|
version: '0'
|
272
|
-
segments:
|
273
|
-
- 0
|
274
|
-
hash: 3793066994442374579
|
275
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
273
|
none: false
|
277
274
|
requirements:
|
278
275
|
- - ! '>='
|
279
276
|
- !ruby/object:Gem::Version
|
280
277
|
version: '0'
|
281
|
-
segments:
|
282
|
-
- 0
|
283
|
-
hash: 3793066994442374579
|
284
278
|
requirements: []
|
285
279
|
rubyforge_project:
|
286
280
|
rubygems_version: 1.8.23
|