Skip to content

Commit 2d2282a

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 63280cb + 2e272d8 commit 2d2282a

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### v0.20.0.pre
2+
3+
* features
4+
* Add product search method
5+
* `Products#search`
6+
17
### v0.19.0.pre
28

39
* features

lib/beyond_api/resources/products/searches.rb

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,67 @@
44

55
module BeyondApi
66
module ProductSearches
7+
#
8+
# A +POST+ request is used to search for products by a search term. Optionally, you can also filter the search results.
9+
#
10+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/search' -i -X POST \
11+
# -H 'Content-Type: application/hal+json;charset=UTF-8' \
12+
# -H 'Accept: application/hal+json' \
13+
# -H 'Authorization: Bearer <Access token>'
14+
# -d '{
15+
# "search" : {
16+
# "term" : "Tony Highfinger, Poloshirt, Men",
17+
# "category" : "NAME"
18+
# },
19+
# "filters" : [ {
20+
# "key" : "status",
21+
# "values" : [ "PUBLISHED" ]
22+
# } ],
23+
# "paging" : {
24+
# "page" : 0,
25+
# "pageSize" : 20,
26+
# "sort" : {
27+
# "property" : "name",
28+
# "direction" : "ASC"
29+
# }
30+
# }
31+
# }'
32+
#
33+
# @beyond_api.scopes +prod:r+
34+
#
35+
# @param body [String] the request body
36+
#
37+
# @return [OpenStruct]
38+
#
39+
# @example
40+
# body = {
41+
# search: {
42+
# term: "Tony Highfinger, Poloshirt, Men",
43+
# category: "NAME"
44+
# },
45+
# filters: [ {
46+
# key: "status",
47+
# values: [ "PUBLISHED" ]
48+
# } ],
49+
# paging: {
50+
# page: 0,
51+
# page_size: 20,
52+
# sort: {
53+
# property: "name",
54+
# direction: "ASC"
55+
# }
56+
# }
57+
# }
58+
# @products = session.product.search(body)
59+
#
60+
def search(body)
61+
response, status = BeyondApi::Request.post(@session,
62+
"/products/search",
63+
body)
64+
65+
handle_response(response, status)
66+
end
67+
768
#
869
# A +GET+ request is used to search for a product by SKU.
970
#

lib/beyond_api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module BeyondApi
4-
VERSION = "0.19.0.pre"
4+
VERSION = "0.20.0.pre"
55
end

0 commit comments

Comments
 (0)