File tree Expand file tree Collapse file tree 3 files changed +68
-1
lines changed
Expand file tree Collapse file tree 3 files changed +68
-1
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 44
55module 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 #
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module BeyondApi
4- VERSION = "0.19 .0.pre"
4+ VERSION = "0.20 .0.pre"
55end
You can’t perform that action at this time.
0 commit comments