beyond_api 0.22.2.pre → 0.24.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06a1046cb7637b192f79fca4be07b902cf3045963b3f978062a8fd84944284e0
4
- data.tar.gz: c8aacd61559f7fe51597e4e63b0172aaddf84bed4fb01f5831961fb602f4c7e0
3
+ metadata.gz: 6da6567d2a64ac33b9c160fccaf6c8cd694b752450517b20ac60a9040c8227b6
4
+ data.tar.gz: c88ebfdc202da7b8b17d14031bd1502b319a5754c3f575e96ba258b1641932dc
5
5
  SHA512:
6
- metadata.gz: b7e4d641196968088a2954559271e4cf12c15b1afe3938a54a9f57e9612ec8ba59b4f842fc8abd74b7e356c24b4ee4255c8878b856ab0afafc2c86c4f8c0bd46
7
- data.tar.gz: 6cb10e858271f8f87bb6a77e370cf3ff096aee683f57817acb653228c86b132a3db2d3eebf7633dcf5f0bb18c8d0230e84d196a19b8fe6d9dbc3ba607ad9a248
6
+ metadata.gz: f954f6572aed87a243514cf798da0550e12013f26b1c0668379662318c959b0697ae74ab26795711298f3b05636cc7293622e6e9e7ef97cf51ad59463fcc4d98
7
+ data.tar.gz: f48e8d78fa746d5166faca83e9713456f172626f49c5f2e2af3e6a999a30bdc480d9e48eadeff49ba60cfe0a8f4a1f5120f8b01b215e7ab1ae537a1805fccfb3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### v0.24.0.pre
2
+
3
+ * features
4
+ * Add category preview method
5
+ * `CategoriesView#preview`
6
+
7
+ ### v0.23.0.pre
8
+
9
+ * feature
10
+ * Add optional `paginated: false` parameter to `session.categories_view.products(paginated: false)`
11
+
1
12
  ### v0.22.1.pre
2
13
 
3
14
  * enhancements
@@ -15,6 +26,7 @@
15
26
 
16
27
  * features
17
28
  * Add `Variations#sort_images` method
29
+
18
30
  ### v0.20.0.pre
19
31
 
20
32
  * features
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.22.2.pre)
4
+ beyond_api (0.24.0.pre)
5
5
  faraday (~> 1.9.0)
6
6
 
7
7
  GEM
@@ -48,6 +48,64 @@ module BeyondApi
48
48
  handle_response(response, status)
49
49
  end
50
50
 
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
+
51
109
  #
52
110
  # A +GET+ request is used to list all products of a category.
53
111
  #
@@ -65,11 +123,9 @@ module BeyondApi
65
123
  # @products = session.categories_view.products("681beef2-cd3e-4ce3-8034-4d07c1184447", { size: 100, page: 0 })
66
124
  #
67
125
  def products(category_id, params = {})
68
- response, status = BeyondApi::Request.get(@session,
69
- "/product-view/categories/#{category_id}/products",
70
- params)
126
+ path = "/product-view/categories/#{category_id}/products"
71
127
 
72
- handle_response(response, status)
128
+ handle_all_request(path, :products, params)
73
129
  end
74
130
 
75
131
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeyondApi
4
- VERSION = "0.22.2.pre"
4
+ VERSION = "0.24.0.pre"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2.pre
4
+ version: 0.24.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unai Abrisketa
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2023-04-21 00:00:00.000000000 Z
14
+ date: 2023-10-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  - !ruby/object:Gem::Version
244
244
  version: 1.3.1
245
245
  requirements: []
246
- rubygems_version: 3.3.7
246
+ rubygems_version: 3.3.3
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Ruby client to access the Beyond API