beyond_api 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +1 -0
  6. data/CHANGELOG.md +4 -0
  7. data/CONTRIBUTING.md +48 -0
  8. data/GETTING_STARTED.md +0 -0
  9. data/Gemfile +6 -0
  10. data/Gemfile.lock +55 -0
  11. data/LICENSE +19 -0
  12. data/README.md +51 -0
  13. data/Rakefile +11 -0
  14. data/beyond_api.gemspec +31 -0
  15. data/bin/console +18 -0
  16. data/bin/setup +8 -0
  17. data/lib/beyond_api.rb +37 -0
  18. data/lib/beyond_api/connection.rb +30 -0
  19. data/lib/beyond_api/ext.rb +43 -0
  20. data/lib/beyond_api/request.rb +55 -0
  21. data/lib/beyond_api/resources/base.rb +17 -0
  22. data/lib/beyond_api/resources/carts.rb +547 -0
  23. data/lib/beyond_api/resources/categories.rb +168 -0
  24. data/lib/beyond_api/resources/categories_view.rb +142 -0
  25. data/lib/beyond_api/resources/checkout_settings.rb +48 -0
  26. data/lib/beyond_api/resources/newsletter_target.rb +97 -0
  27. data/lib/beyond_api/resources/order_settings.rb +80 -0
  28. data/lib/beyond_api/resources/orders.rb +968 -0
  29. data/lib/beyond_api/resources/payment_methods.rb +192 -0
  30. data/lib/beyond_api/resources/product_attribute_definitions.rb +109 -0
  31. data/lib/beyond_api/resources/product_settings.rb +28 -0
  32. data/lib/beyond_api/resources/products.rb +245 -0
  33. data/lib/beyond_api/resources/products/attachments.rb +119 -0
  34. data/lib/beyond_api/resources/products/availability.rb +177 -0
  35. data/lib/beyond_api/resources/products/custom_attributes.rb +141 -0
  36. data/lib/beyond_api/resources/products/images.rb +165 -0
  37. data/lib/beyond_api/resources/products/searches.rb +52 -0
  38. data/lib/beyond_api/resources/products/variation_properties.rb +87 -0
  39. data/lib/beyond_api/resources/products_view.rb +158 -0
  40. data/lib/beyond_api/resources/scopes.rb +31 -0
  41. data/lib/beyond_api/resources/script_tags.rb +122 -0
  42. data/lib/beyond_api/resources/shipping_zones.rb +324 -0
  43. data/lib/beyond_api/resources/shop.rb +561 -0
  44. data/lib/beyond_api/resources/signers.rb +63 -0
  45. data/lib/beyond_api/resources/token.rb +41 -0
  46. data/lib/beyond_api/resources/users.rb +376 -0
  47. data/lib/beyond_api/resources/variations.rb +145 -0
  48. data/lib/beyond_api/resources/variations/availability.rb +105 -0
  49. data/lib/beyond_api/resources/webhook_subscriptions.rb +176 -0
  50. data/lib/beyond_api/session.rb +121 -0
  51. data/lib/beyond_api/utils.rb +51 -0
  52. data/lib/beyond_api/version.rb +3 -0
  53. data/lib/generators/beyond_api/install_generator.rb +13 -0
  54. data/lib/generators/templates/beyond_api_initializer.rb +29 -0
  55. metadata +194 -0
@@ -0,0 +1,192 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "beyond_api/utils"
4
+
5
+ module BeyondApi
6
+ class PaymentMethods < Base
7
+ include BeyondApi::Utils
8
+
9
+ #
10
+ # A +POST+ request is used to activate a payment method.
11
+ #
12
+ # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/da313b73-ea6b-49c7-8a3d-d707934098b8/activate' -i -X POST \
13
+ # -H 'Accept: application/hal+json' \
14
+ # -H 'Authorization: Bearer <Access token>'
15
+ #
16
+ # @beyond_api.scopes pymt:u
17
+ #
18
+ # @param payment_method_id [String] the payment method UUID
19
+ #
20
+ # @return true
21
+ #
22
+ # @example
23
+ # session.payment_methods.activate("268a8629-55cd-4890-9013-936b9b5ea14c")
24
+ #
25
+ def activate(payment_method_id)
26
+ response, status = BeyondApi::Request.post(@session, "/payment-methods/#{payment_method_id}/activate")
27
+
28
+ handle_response(response, status, respond_with_true: true)
29
+ end
30
+
31
+ #
32
+ # A +GET+ request is used to list all payment methods in a paged way.
33
+ #
34
+ # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods' -i -X GET \
35
+ # -H 'Content-Type: application/hal+json' \
36
+ # -H 'Accept: application/hal+json' \
37
+ # -H 'Authorization: Bearer <Access token>'
38
+ #
39
+ # @beyond_api.scopes +pymt:r
40
+ #
41
+ # @option params [Integer] :size the page size
42
+ # @option params [Integer] :page the page number
43
+ #
44
+ # @return [OpenStruct]
45
+ #
46
+ # @example
47
+ # session.payment_methods.all(size: 100, page: 0)
48
+ #
49
+ def all(params = {})
50
+ response, status = BeyondApi::Request.get(@session, "/payment-methods", params)
51
+
52
+ handle_response(response, status)
53
+ end
54
+
55
+ #
56
+ # A +POST+ request is used to deactivate a payment method.
57
+ #
58
+ # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/157f930f-328a-4d7a-974d-66bc3b4dd28e/deactivate' -i -X POST \
59
+ # -H 'Accept: application/hal+json' \
60
+ # -H 'Authorization: Bearer <Access token>'
61
+ #
62
+ # @beyond_api.scopes pymt:u
63
+ #
64
+ # @param payment_method_id [String] the payment method UUID
65
+ #
66
+ # @return true
67
+ #
68
+ # @example
69
+ # session.payment_methods.deactivate("268a8629-55cd-4890-9013-936b9b5ea14c")
70
+ #
71
+ def deactivate(payment_method_id)
72
+ response, status = BeyondApi::Request.post(@session, "/payment-methods/#{payment_method_id}/deactivate")
73
+
74
+ handle_response(response, status, respond_with_true: true)
75
+ end
76
+
77
+ #
78
+ # A +GET+ request is used to activate a webhook subscription.
79
+ #
80
+ # @beyond_api.scopes +pymt:r
81
+ #
82
+ # @param payment_method_id [String] the paument method UUID
83
+ #
84
+ # @return [OpenStruct]
85
+ #
86
+ # @example
87
+ # session.payment_methods.find("268a8629-55cd-4890-9013-936b9b5ea14c")
88
+ #
89
+ def find(payment_method_id)
90
+ response, status = BeyondApi::Request.get(@session, "/payment-methods/#{payment_method_id}")
91
+
92
+ handle_response(response, status)
93
+ end
94
+
95
+ #
96
+ # A +PUT+ request is used to sort payment methods.
97
+ #
98
+ # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods' -i -X PUT \
99
+ # -H 'Content-Type: text/uri-list' \
100
+ # -H 'Authorization: Bearer <Access token>' \
101
+ # -d 'https://api-shop.beyondshop.cloud/api/payment-methods/80fa2f12-53e4-42c4-8991-c5a3ddb7596e
102
+ # https://api-shop.beyondshop.cloud/api/payment-methods/8b54c275-b766-44be-9ed5-c1e269594e0f
103
+ # https://api-shop.beyondshop.cloud/api/payment-methods/779d08fb-a26d-447e-aef8-ed3642f05e5b
104
+ # https://api-shop.beyondshop.cloud/api/payment-methods/c02de15b-1e6d-4990-9318-83749
105
+ #
106
+ # @beyond_api.scopes +pymt:u
107
+ #
108
+ # @param payment_method_ids [Array] the payment method UUIDs
109
+ #
110
+ # @return [OpenStruct]
111
+ #
112
+ # @example
113
+ # payment_method_ids = [
114
+ # '6f3bc033-c2d1-4f44-80e3-1b668f6bd699',
115
+ # '6f3bc033-c2d1-4f44-80e3-1b618f6sd692',
116
+ # '6f3bc033-c2d1-4f44-80e3-1b628f6br698'
117
+ # ]
118
+ #
119
+ # session.payment_methods.sort(paymen)
120
+ #
121
+ def sort(payment_method_ids)
122
+ body = []
123
+ payment_method_ids.each do |payment_method|
124
+ body << "#{@session.api_url}/payment-methods/#{payment_method}"
125
+ end
126
+ response, status = BeyondApi::Request.put(@session, "/payment-methods", body)
127
+
128
+ handle_response(response, status, respond_with_true: true)
129
+ end
130
+
131
+ #
132
+ # A +PUT+ request is used to update a payment method.
133
+ #
134
+ # $ curl 'https://api-shop.beyondshop.cloud/api/payment-methods/dc00a5af-d21e-49f0-99f2-ef67ca6fa782' -i -X PUT \
135
+ # -H 'Content-Type: application/json' \
136
+ # -H 'Accept: application/hal+json' \
137
+ # -H 'Authorization: Bearer <Access token>' \
138
+ # -d '{
139
+ # "name" : "Another name",
140
+ # "description" : "Pay by Converge.",
141
+ # "taxClass" : "REGULAR",
142
+ # "discountOrFee" : {
143
+ # "type" : "ABSOLUTE",
144
+ # "absoluteValue" : {
145
+ # "taxModel" : "GROSS",
146
+ # "currency" : "EUR",
147
+ # "amount" : 2.0
148
+ # }
149
+ # },
150
+ # "serviceableCountries" : [ "DE" ],
151
+ # "minimumOrderValue" : {
152
+ # "currency" : "EUR",
153
+ # "amount" : 10.0
154
+ # }
155
+ # }'
156
+ #
157
+ # @beyond_api.scopes +pymt:u
158
+ #
159
+ # @param payment_method_id [String] the payment method UUID
160
+ # @param body [Hash] the request body
161
+ #
162
+ # @return [OpenStruct]
163
+ #
164
+ # @example
165
+ # body = {
166
+ # "name" => "Another name",
167
+ # "description" => "Pay by Converge.",
168
+ # "tax_class" => "REGULAR",
169
+ # "discount_or_fee" => {
170
+ # "type" => "ABSOLUTE",
171
+ # "absolute_value" => {
172
+ # "tax_model" => "GROSS",
173
+ # "currency" => "EUR",
174
+ # "amount" => 2.0
175
+ # }
176
+ # },
177
+ # "serviceable_countries" => [ "DE" ],
178
+ # "minimum_order_value" => {
179
+ # "currency" => "EUR",
180
+ # "amount" => 10.0
181
+ # }
182
+ # }
183
+ #
184
+ # @payment_method = session.payment_methods.update("6f3bc033-c2d1-4f44-80e3-1b668f6bd699", body)
185
+ #
186
+ def update(payment_method_id, body)
187
+ response, status = BeyondApi::Request.put(@session, "/payment-methods/#{payment_method_id}", body)
188
+
189
+ handle_response(response, status)
190
+ end
191
+ end
192
+ end
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "beyond_api/utils"
4
+
5
+ module BeyondApi
6
+ class ProductAttributeDefinitions < Base
7
+ include BeyondApi::Utils
8
+
9
+ #
10
+ # A +GET+ request will list the available product attribute definitions.
11
+ #
12
+ # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X GET \
13
+ # -H 'Authorization: Bearer <Access token>'
14
+ #
15
+ # @beyond_api.scopes +prad:r+
16
+ #
17
+ # @option param [Integer] :size the page size
18
+ # @option param [Integer] :page the page number
19
+ #
20
+ # @return [OpenStruct]
21
+ #
22
+ # @example
23
+ # @product_attribute_definitions = session.product_attribute_definitions.all(size: 100, page: 0)
24
+ #
25
+ def all(params = {})
26
+ response, status = BeyondApi::Request.get(@session, "/product-attribute-definitions", params)
27
+
28
+ handle_response(response, status)
29
+ end
30
+
31
+ #
32
+ # A +POST+ request is used to create a product attribute definition.
33
+ #
34
+ # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions' -i -X POST \
35
+ # -H 'Content-Type: application/json' \
36
+ # -H 'Authorization: Bearer <Access token>' \
37
+ # -d '{
38
+ # "key" : "filling_capacity",
39
+ # "type" : "NUMBER",
40
+ # "displayName" : "Filling Capacity",
41
+ # "format" : "#,###.## ml"
42
+ # }'
43
+ #
44
+ # @beyond_api.scopes +prad:c+
45
+ #
46
+ # @param product_attribute_name [String] the product attribute key
47
+ #
48
+ # @return [OpenStruct]
49
+ #
50
+ # @example
51
+ # body = {
52
+ # "key": "filling_capacity",
53
+ # "type": "NUMBER",
54
+ # "displayName": "Filling Capacity",
55
+ # "format": "#,###.## ml"
56
+ # }
57
+ # @product_attribute_definition = session.product_attribute_definitions.create(body)
58
+ #
59
+ def create(product_attribute_name)
60
+ response, status = BeyondApi::Request.post(@session, "/product-attribute-definitions")
61
+
62
+ handle_response(response, status)
63
+ end
64
+
65
+ #
66
+ # A +DELETE+ request is used to delete a product attachment.
67
+ #
68
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products/00add006-beaa-46fe-bb73-f8ebae15082d/attachments/9a44e585-571a-4253-9248-54a4c418c7e2' -i -X DELETE \
69
+ # -H 'Content-Type: application/hal+json' \
70
+ # -H 'Accept: application/hal+json' \
71
+ # -H 'Authorization: Bearer <Access token>'
72
+ #
73
+ # @beyond_api.scopes +prad:d+
74
+ #
75
+ # @param product_attribute_name [String] the product attribute key
76
+ #
77
+ # @return [true]
78
+ #
79
+ # @example
80
+ # session.product_attribute_definitions.delete("filling_capacity")
81
+ #
82
+ def delete(product_attribute_name)
83
+ response, status = BeyondApi::Request.get(@session, "/product-attribute-definitions/#{product_attribute_name}")
84
+
85
+ handle_response(response, status, respond_with_true: true)
86
+ end
87
+
88
+ #
89
+ # A +GET+ request is used to retrieve a single product attribute definition by name.
90
+ #
91
+ # $ curl 'https://api-shop.beyondshop.cloud/api/product-attribute-definitions/filling_capacity' -i -X GET \
92
+ # -H 'Authorization: Bearer <Access token>'
93
+ #
94
+ # @beyond_api.scopes +prad:r+
95
+ #
96
+ # @param product_attribute_name [String] the product attribute key
97
+ #
98
+ # @return [OpenStruct]
99
+ #
100
+ # @example
101
+ # @product_attribute_definition = session.product_attribute_definitions.find("filling_capacity")
102
+ #
103
+ def find(product_attribute_name)
104
+ response, status = BeyondApi::Request.get(@session, "/product-attribute-definitions/#{product_attribute_name}")
105
+
106
+ handle_response(response, status)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "beyond_api/utils"
4
+
5
+ module BeyondApi
6
+ class ProductSettings < Base
7
+ include BeyondApi::Utils
8
+
9
+ #
10
+ # A +GET+ request is used to retrieve the product settings.
11
+ #
12
+ # $ curl 'https://api-shop.beyondshop.cloud/api/product-settings' -i -X GET \
13
+ # -H 'Authorization: Bearer <Access token>'
14
+ #
15
+ # @beyond_api.scopes +prst:r+
16
+ #
17
+ # @return [OpenStruct]
18
+ #
19
+ # @example
20
+ # @product_settings = session.product_settings.all
21
+ #
22
+ def all
23
+ response, status = BeyondApi::Request.get(@session, "/product_settings")
24
+
25
+ handle_response(response, status)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,245 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "beyond_api/utils"
4
+
5
+ module BeyondApi
6
+ class Products < Base
7
+ include BeyondApi::Utils
8
+
9
+ #
10
+ # A +GET+ request will list all of the products in a paged manner. The returned data is an excerpt projection, which includes a small subset of product properties.
11
+ #
12
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products' -i -X GET \
13
+ # -H 'Content-Type: application/hal+json' \
14
+ # -H 'Accept: application/hal+json' \
15
+ # -H 'Authorization: Bearer <Access token>'
16
+ #
17
+ # @beyond_api.scopes +prod:r+
18
+ #
19
+ # @option params [Integer] :size the page size
20
+ # @option params [Integer] :page the page number
21
+ #
22
+ # @return [OpenStruct]
23
+ #
24
+ # @example
25
+ # @products = session.products.all(size: 100, page: 0)
26
+ #
27
+ def all(params = {})
28
+ response, status = BeyondApi::Request.get(@session, "/products", params)
29
+
30
+ handle_response(response, status)
31
+ end
32
+
33
+ #
34
+ # A +POST+ request is used to create a product.
35
+ #
36
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products' -i -X POST \
37
+ # -H 'Content-Type: application/json' \
38
+ # -H 'Authorization: Bearer <Access token>' \
39
+ # -d '{
40
+ # "sku" : "123456789-001",
41
+ # "name" : "Rioja Castillo de Puerto (2013)",
42
+ # "description" : "Spain\nRioja Tempranillo",
43
+ # "manufacturer" : "Grape Vineyard",
44
+ # "essentialFeatures" : "Dry. 12% alcohol. Best vine variety.",
45
+ # "tags" : [ "Bestseller", "Red Wine", "Sale" ],
46
+ # "productIdentifiers" : [ {
47
+ # "type" : "EAN",
48
+ # "value" : "9780134308135"
49
+ # } ],
50
+ # "salesPrice" : {
51
+ # "taxModel" : "NET",
52
+ # "amount" : 8.7,
53
+ # "currency" : "EUR"
54
+ # },
55
+ # "listPrice" : {
56
+ # "taxModel" : "NET",
57
+ # "amount" : 10.95,
58
+ # "currency" : "EUR"
59
+ # },
60
+ # "manufacturerPrice" : {
61
+ # "taxModel" : "NET",
62
+ # "amount" : 99.95,
63
+ # "currency" : "EUR"
64
+ # },
65
+ # "onSale" : true,
66
+ # "visible" : true,
67
+ # "taxClass" : "REGULAR",
68
+ # "shippingWeight" : 100,
69
+ # "maxOrderQuantity" : 6,
70
+ # "shippingDimension" : {
71
+ # "length" : 1500,
72
+ # "width" : 1000,
73
+ # "height" : 2000
74
+ # },
75
+ # "refPrice" : {
76
+ # "refQuantity" : 1,
77
+ # "unit" : "LITER",
78
+ # "quantity" : 0.75,
79
+ # "price" : {
80
+ # "taxModel" : "NET",
81
+ # "amount" : 11.6,
82
+ # "currency" : "EUR"
83
+ # }
84
+ # },
85
+ # "shippingPeriod" : {
86
+ # "minDays" : 2,
87
+ # "maxDays" : 4,
88
+ # "displayUnit" : "WEEKS"
89
+ # }
90
+ # }'
91
+ #
92
+ # @beyond_api.scopes +prod:c+
93
+ #
94
+ # @param body [Hash] the request body
95
+ #
96
+ # @return [OpenStruct]
97
+ #
98
+ # @example
99
+ # body = {
100
+ # "sku": "123456789-001",
101
+ # "name": "Rioja Castillo de Puerto (2013)",
102
+ # "description": "Spain\nRioja Tempranillo",
103
+ # "manufacturer": "Grape Vineyard",
104
+ # "essentialFeatures": "Dry. 12% alcohol. Best vine variety.",
105
+ # "tags": ["Bestseller", "Red Wine", "Sale"],
106
+ # "productIdentifiers": [{
107
+ # "type": "EAN",
108
+ # "value": "9780134308135"
109
+ # }],
110
+ # "salesPrice": {
111
+ # "taxModel": "NET",
112
+ # "amount": 8.7,
113
+ # "currency": "EUR"
114
+ # },
115
+ # "listPrice": {
116
+ # "taxModel": "NET",
117
+ # "amount": 10.95,
118
+ # "currency": "EUR"
119
+ # },
120
+ # "manufacturerPrice": {
121
+ # "taxModel": "NET",
122
+ # "amount": 99.95,
123
+ # "currency": "EUR"
124
+ # },
125
+ # "onSale": true,
126
+ # "visible": true,
127
+ # "taxClass": "REGULAR",
128
+ # "shippingWeight": 100,
129
+ # "maxOrderQuantity": 6,
130
+ # "shippingDimension": {
131
+ # "length": 1500,
132
+ # "width": 1000,
133
+ # "height": 2000
134
+ # },
135
+ # "refPrice": {
136
+ # "refQuantity": 1,
137
+ # "unit": "LITER",
138
+ # "quantity": 0.75,
139
+ # "price": {
140
+ # "taxModel": "NET",
141
+ # "amount": 11.6,
142
+ # "currency": "EUR"
143
+ # }
144
+ # },
145
+ # "shippingPeriod": {
146
+ # "minDays": 2,
147
+ # "maxDays": 4,
148
+ # "displayUnit": "WEEKS"
149
+ # }
150
+ # }
151
+ #
152
+ # @product = session.products.create(body)
153
+ #
154
+ def create(body)
155
+ response, status = BeyondApi::Request.post(@session, "/products", body)
156
+
157
+ handle_response(response, status)
158
+ end
159
+
160
+ #
161
+ # A +DELETE+ request is used to delete a product or variation product. When a variation product is deleted, all its variations are deleted as well.
162
+ #
163
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products/c06c61af-f99a-4698-90fa-8c3199ca732f' -i -X DELETE \
164
+ # -H 'Accept: application/hal+json' \
165
+ # -H 'Authorization: Bearer <Access token>'
166
+ #
167
+ # @beyond_api.scopes +prod:d+
168
+ #
169
+ # @param product_id [String] the product UUID
170
+ #
171
+ # @return true
172
+ #
173
+ # @example
174
+ # session.products.delete("f461fb56-1984-4ade-bd4e-007c273cc923")
175
+ #
176
+ def delete(product_id)
177
+ response, status = BeyondApi::Request.delete(@session, "/products/#{product_id}")
178
+
179
+ handle_response(response, status, respond_with_true: true)
180
+ end
181
+
182
+ #
183
+ # A +GET+ request is used to retrieve the details of a product.
184
+ #
185
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products/75ebcb57-aefb-4963-8225-060c528e070d' -i -X GET \
186
+ # -H 'Content-Type: application/json' \
187
+ # -H 'Accept: application/hal+json' \
188
+ # -H 'Authorization: Bearer <Access token>'
189
+ #
190
+ # @beyond_api.scopes +prod:r+
191
+ #
192
+ # @param product_id [String] the product UUID
193
+ #
194
+ # @return [OpenStruct]
195
+ #
196
+ # @example
197
+ # @product = session.products.find("f461fb56-1984-4ade-bd4e-007c273cc923")
198
+ #
199
+ def find(product_id)
200
+ response, status = BeyondApi::Request.get(@session, "/products/#{product_id}")
201
+
202
+ handle_response(response, status)
203
+ end
204
+
205
+ #
206
+ # A +PATCH+ request is used to update a product partially with json content type.
207
+ #
208
+ # @beyond_api.scopes +prod:u+
209
+ #
210
+ # $ curl 'https://api-shop.beyondshop.cloud/api/products/b69e3f47-03b8-40d2-843c-ae89a3d9bcdd' -i -X PATCH \
211
+ # -H 'Content-Type: application/json' \
212
+ # -H 'Accept: application/hal+json' \
213
+ # -H 'Authorization: Bearer <Access token>' \
214
+ # -d '{
215
+ # "name" : "patched name",
216
+ # "description" : "patched description. <p><br></p><blockquote> <ol><li><strong>\n<h1></h1><h6></h6><em><a href=\"http://example.com\" target=\"_blank\"><u>this is my test html</u></a>\n</em></strong> </li></ol> </blockquote>",
217
+ # "productIdentifiers" : null,
218
+ # "manufacturer" : "patched manufacturer"
219
+ # }'
220
+ #
221
+ # @param product_id [String] the product UUID
222
+ # @param body [Hash] the request body
223
+ #
224
+ # @return [OpenStruct]
225
+ #
226
+ # @example
227
+ # body = {
228
+ # "name": "patched name",
229
+ # "description": "patched description. <p><br></p><blockquote> <ol><li><strong>\n<h1></h1><h6></h6><em><a href=\"http://example.com\" target=\"_blank\"><u>this is my test html</u></a>\n</em></strong> </li></ol> </blockquote>",
230
+ # "productIdentifiers": null,
231
+ # "manufacturer": "patched manufacturer"
232
+ # }
233
+ # @product = session.products.update("75ebcb57-aefb-4963-8225-060c528e070d", body)
234
+ #
235
+ def update(product_id, body)
236
+ response, status = BeyondApi::Request.patch(@session, "/products/#{product_id}", body)
237
+
238
+ handle_response(response, status)
239
+ end
240
+
241
+ alias_method :create_variation, :create
242
+ alias_method :find_variation, :find
243
+ alias_method :update_variation, :update
244
+ end
245
+ end