Module: BeyondApi::ProductSearches
- Included in:
- Products
- Defined in:
- lib/beyond_api/resources/products/searches.rb
Instance Method Summary collapse
-
#search(body) ⇒ OpenStruct
A
POST
request is used to search for products by a search term. -
#search_by_sku(sku) ⇒ OpenStruct
A
GET
request is used to search for a product by SKU. -
#search_tags_starting_by(starts_with, params = {}) ⇒ OpenStruct
A
GET
request is used to search used tags by a starting string.
Instance Method Details
#search(body) ⇒ OpenStruct
A POST
request is used to search for products by a search term. Optionally, you can also filter the search results.
$ curl 'https://api-shop.beyondshop.cloud/api/products/search' -i -X POST \
-H 'Content-Type: application/hal+json;charset=UTF-8' \
-H 'Accept: application/hal+json' \
-H 'Authorization: Bearer <Access token>'
-d '{
"search" : {
"term" : "Tony Highfinger, Poloshirt, Men",
"category" : "NAME"
},
"filters" : [ {
"key" : "status",
"values" : [ "PUBLISHED" ]
} ],
"paging" : {
"page" : 0,
"pageSize" : 20,
"sort" : {
"property" : "name",
"direction" : "ASC"
}
}
}'
60 61 62 63 64 65 66 |
# File 'lib/beyond_api/resources/products/searches.rb', line 60 def search(body) response, status = BeyondApi::Request.post(@session, "/products/search", body) handle_response(response, status) end |
#search_by_sku(sku) ⇒ OpenStruct
A GET
request is used to search for a product by SKU.
$ curl 'https://api-shop.beyondshop.cloud/api/products/search/find-by-sku?sku=vino020' -i -X GET \
-H 'Authorization: Bearer <Access token>'
83 84 85 86 87 |
# File 'lib/beyond_api/resources/products/searches.rb', line 83 def search_by_sku(sku) response, status = BeyondApi::Request.get(@session, "/products/search/find-by-sku", sku: sku) handle_response(response, status) end |
#search_tags_starting_by(starts_with, params = {}) ⇒ OpenStruct
A GET
request is used to search used tags by a starting string. All strings are sorted by usage, starting with the biggest.
$ curl 'https://api-shop.beyondshop.cloud/api/products/search/tags?startsWith=aw' -i -X GET \
-H 'Authorization: Bearer <Access token>'
106 107 108 109 110 111 |
# File 'lib/beyond_api/resources/products/searches.rb', line 106 def (starts_with, params = {}) response, status = BeyondApi::Request.get(@session, "/products/search/tags", params.merge(starts_with: starts_with)) handle_response(response, status) end |