tagalys 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tagalys.rb +13 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c612a1c338b89ca0674c1708ae4cd0fd930a32a1fa18bae017e0906eac021c2
|
4
|
+
data.tar.gz: 0fc17701c812406a8e02139943fdc84e277ace196163580f815bd813490c0f79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ff8343454f9e434992cbd9a3c4f6d1ba68222a8bacfd8bbed557481f6e3fd65da24e013a188af09445ba0079d7abdc9fa9e45e4bab18f64931185cdf4226df
|
7
|
+
data.tar.gz: e19a79c805243dc9cc6489bf6b44350a5deb16a1346c4c3f70be22d9b28ff02d866d4b8dfcecab4f3e5968e46d9118c29b7edd1d177e8d1c1d199476350cbf5a
|
data/lib/tagalys.rb
CHANGED
@@ -42,6 +42,18 @@ module Tagalys
|
|
42
42
|
search_response = request_tagalys('/search', request_body)
|
43
43
|
end
|
44
44
|
|
45
|
+
def surface_search(query = nil, query_count = 8, product_count = 3)
|
46
|
+
return { status: "Either query or filter should be present" } if query == nil
|
47
|
+
# return { status: "Filter should be a hash" } if filters && filters.class != Hash
|
48
|
+
request_body = {
|
49
|
+
identification: identification,
|
50
|
+
q: query.strip.length > 0 ? query : nil,
|
51
|
+
queries: query_count,
|
52
|
+
products: product_count,
|
53
|
+
}.compact
|
54
|
+
search_response = request_tagalys('/ss', request_body)
|
55
|
+
end
|
56
|
+
|
45
57
|
def get_page_details(page_name, filters = nil, sort = nil, page = 1, per_page = 30)
|
46
58
|
request_body = {
|
47
59
|
identification: identification,
|
@@ -116,14 +128,13 @@ module Tagalys
|
|
116
128
|
end
|
117
129
|
|
118
130
|
def request_tagalys(path, request_body)
|
119
|
-
uri = URI.parse("https://api-r1.tagalys.com/v1
|
131
|
+
uri = URI.parse("https://api-r1.tagalys.com/v1" + path)
|
120
132
|
header = {'Content-Type': 'application/json'}
|
121
133
|
http = Net::HTTP.new(uri.host, uri.port)
|
122
134
|
http.use_ssl = true
|
123
135
|
request = Net::HTTP::Post.new(uri.request_uri, header)
|
124
136
|
puts request_body.to_json
|
125
137
|
request.body = request_body.to_json
|
126
|
-
|
127
138
|
# Send the request
|
128
139
|
response = http.request(request)
|
129
140
|
return JSON.parse(response.body)
|