tagalys 0.0.6 → 0.0.7
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/lib/tagalys.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d506d35c0645d7a0f47600e9ed9dcaa815356c02
|
4
|
+
data.tar.gz: ef74a6ca39784a99a6d41e975b89a91d84ed3fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f3832a70cd4adc016ddfc42debfccf5fee5cb6ce2d37b011c8c96810ff523ed9ae81bbda4a6c97e82edd705f3b1d33935f308bf59c39cd030d21b30e8b4aef1
|
7
|
+
data.tar.gz: 49908f6ee074600638464b2c3a6958f7e8ca9f6a2df644aed780b3d62ed74f033749e1315389247d2100b001b2e895159ad31c4aa2fd7731d9101e1d5f86c41b
|
data/lib/tagalys.rb
CHANGED
@@ -4,10 +4,12 @@ class Tagalys
|
|
4
4
|
require 'uri'
|
5
5
|
require 'json'
|
6
6
|
|
7
|
-
def search(query, filters=
|
7
|
+
def search(query=nil, filters=nil)
|
8
|
+
return { status: "Either query or filter should be present" } if query == nil && filters == nil
|
9
|
+
return { status: "Filter should be a hash" } if filters && filters.class != Hash
|
8
10
|
request_body = {
|
9
11
|
identification: identification,
|
10
|
-
q: query,
|
12
|
+
q: query.strip.length > 0 ? query : nil,
|
11
13
|
qf: filters,
|
12
14
|
request: [
|
13
15
|
"total",
|
@@ -16,7 +18,7 @@ class Tagalys
|
|
16
18
|
"sort_options",
|
17
19
|
"filters"
|
18
20
|
]
|
19
|
-
}
|
21
|
+
}.compact
|
20
22
|
search_response = request_tagalys('/search', request_body)
|
21
23
|
end
|
22
24
|
|