@@ -48,6 +48,64 @@ def find(category_id)
4848 handle_response ( response , status )
4949 end
5050
51+ #
52+ # A +POST+ request is read-only and cannot create data. It is used to find products that match the filter criteria.
53+ # Thus, it can be used to preview all products that are included in a category that shares the respective filter criteria.
54+ #
55+ # $ curl 'https://api-shop.beyondshop.cloud/api/product-view/categories/preview?page=0&size=10&sortBy=NEWEST_FIRST' -i -X POST \
56+ # -H 'Content-Type: application/json' \
57+ # -H 'Content-Type: application/json' \
58+ # -d '{
59+ # "filters" : [ {
60+ # "key" : "manufacturer",
61+ # "values" : [ "Grape Vineyard" ]
62+ # }, {
63+ # "key" : "all_tags",
64+ # "values" : [ "Power Bar", "Bestseller", "High Protein" ]
65+ # }, {
66+ # "key" : "price_range",
67+ # "min" : 3.7,
68+ # "max" : 13.7
69+ # } ]
70+ # }'
71+ #
72+ # @param body [Hash] the request body
73+ # @option params [Integer] :size the page size
74+ # @option params [Integer] :page the page number
75+ # @option params [String] :sort_by the sorting applied to the list of products
76+ #
77+ # @return [OpenStruct]
78+ #
79+ # @example
80+ # body = {
81+ # filters => [
82+ # {
83+ # key => "manufacturer",
84+ # values => [ "Grape Vineyard" ]
85+ # },
86+ # {
87+ # key => "all_tags",
88+ # values => [ "Power Bar", "Bestseller", "High Protein" ]
89+ # },
90+ # {
91+ # key => "price_range",
92+ # min => 3.7,
93+ # max => 13.7
94+ # }
95+ # ]
96+ # }
97+ #
98+ # @products = session.categories_view.preview(body, { size: 100, page: 0, sort_by: "NEWEST_FIRST" })
99+ #
100+ def preview ( body , params = { } )
101+ response , status = BeyondApi ::Request . post ( @session ,
102+ "/product-view/categories/preview" ,
103+ body ,
104+ params )
105+
106+ handle_response ( response , status )
107+ end
108+
51109 #
52110 # A +GET+ request is used to list all products of a category.
53111 #
0 commit comments