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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tagalys.rb +5 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 164761d74a610b3f6c3003a1106e8f55e279b966
4
- data.tar.gz: acbf3a1596bc2d9e64fb505001ea4e499fa02cdb
3
+ metadata.gz: d506d35c0645d7a0f47600e9ed9dcaa815356c02
4
+ data.tar.gz: ef74a6ca39784a99a6d41e975b89a91d84ed3fd0
5
5
  SHA512:
6
- metadata.gz: 296e2d33ab0b4462f572adfa66828062df3292346776a541eb36d74bb4ccca3677f6c808bfdf4a22eeb66e8256880aad6ac67834b8302c9b592b97fb4a6174f2
7
- data.tar.gz: f0c80edbcc629c1c8599a2373c15743e47d0a66a571dc2eafb159c3d4ee6b4a34e7e7774a92a3d42092b8fce3b4b4e7da592b9a6403cec0de582cc75800fa0cf
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagalys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anbazhagan Palani