beyond_api 0.23.0.pre → 0.24.1.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: 88d9a67d129db14679f16fd1728f729befc0c1f835da84004a7ae6b372747d74
4
- data.tar.gz: 6f94b54fdc048cb9e4c9eddb4d19cb5376891d9e04d663b4e9fc8c6139de16f7
3
+ metadata.gz: 9d8675fa4225b9cbbab16aed477c2bc119be330cde5be9249e363263c292e7df
4
+ data.tar.gz: 4672536fd5daf3777a55cf253d699447c77c61d26905d65736fde17a4fa42b1e
5
5
  SHA512:
6
- metadata.gz: 621abe68a32f9cffc620b3af736b108d8e7ffe05c06be660216d8e1adb55f3695fde69be2324d52454f3f11593c98d2191f62df437df009bb536416c2809d16b
7
- data.tar.gz: 5d9e908136b7ad10760379b5f12078e9d11bd7d8d58b65cc12d8ccb5161ea10a2be816f161356d00f4881a81831f7630bdc56175101ba7458ead3e3a5b86bd34
6
+ metadata.gz: 4b194a0f1819933338bd3241807a65372e4f6a44c440dcd3b7b575a39d188bff7fd4e5af7b97556984f95c5ccce820e73ac0de23691458cadac51588874095af
7
+ data.tar.gz: d47dad7d298e7b9093a545e28083ea42d0ed3d717d65d7ad6e6bbb0f04c4dd694d66778cd376e4882be956a2eb4c3b7083c62025c7c4d13beb0a91650f39a82e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ### v0.24.1.pre
2
+
3
+ * bug-fixes
4
+ * Fix image upload
5
+
6
+ ### v0.24.0.pre
7
+
8
+ * features
9
+ * Add category preview method
10
+ * `CategoriesView#preview`
11
+
1
12
  ### v0.23.0.pre
2
13
 
3
14
  * feature
@@ -20,6 +31,7 @@
20
31
 
21
32
  * features
22
33
  * Add `Variations#sort_images` method
34
+
23
35
  ### v0.20.0.pre
24
36
 
25
37
  * features
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- beyond_api (0.23.0.pre)
4
+ beyond_api (0.24.1.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
  #
@@ -221,7 +221,7 @@ module BeyondApi
221
221
  response, status = BeyondApi::Request.upload_by_form(@session,
222
222
  "/products/#{product_id}/images",
223
223
  images_path,
224
- file_name: images_name)
224
+ file_name: images_name.map { |e| URI.encode_www_form([e]) })
225
225
 
226
226
  handle_response(response, status)
227
227
  end
@@ -226,7 +226,7 @@ module BeyondApi
226
226
  response, status = BeyondApi::Request.upload_by_form(@session,
227
227
  "/products/#{product_id}/variations/#{variation_id}/images",
228
228
  images_path,
229
- file_name: images_name)
229
+ file_name: images_name.map { |e| URI.encode_www_form([e]) })
230
230
 
231
231
  handle_response(response, status)
232
232
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BeyondApi
4
- VERSION = "0.23.0.pre"
4
+ VERSION = "0.24.1.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.23.0.pre
4
+ version: 0.24.1.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-05-25 00:00:00.000000000 Z
14
+ date: 2023-11-20 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