|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | | -require "beyond_api/utils" |
| 3 | +require 'beyond_api/utils' |
4 | 4 |
|
5 | 5 | module BeyondApi |
6 | | - autoload :ProductAttachments, "beyond_api/resources/products/attachments" |
7 | | - autoload :ProductAvailability, "beyond_api/resources/products/availability" |
8 | | - autoload :ProductCrossSells, "beyond_api/resources/products/cross_sells" |
9 | | - autoload :ProductCustomAttributes, "beyond_api/resources/products/custom_attributes" |
10 | | - autoload :ProductImages, "beyond_api/resources/products/images" |
11 | | - autoload :ProductSearches, "beyond_api/resources/products/searches" |
12 | | - autoload :ProductVariationProperties, "beyond_api/resources/products/variation_properties" |
13 | | - autoload :ProductVideos, "beyond_api/resources/products/videos" |
| 6 | + autoload :ProductAttachments, 'beyond_api/resources/products/attachments' |
| 7 | + autoload :ProductAvailability, 'beyond_api/resources/products/availability' |
| 8 | + autoload :ProductCrossSells, 'beyond_api/resources/products/cross_sells' |
| 9 | + autoload :ProductCustomAttributes, 'beyond_api/resources/products/custom_attributes' |
| 10 | + autoload :ProductImages, 'beyond_api/resources/products/images' |
| 11 | + autoload :ProductSearches, 'beyond_api/resources/products/searches' |
| 12 | + autoload :ProductVariationProperties, 'beyond_api/resources/products/variation_properties' |
| 13 | + autoload :ProductVideos, 'beyond_api/resources/products/videos' |
14 | 14 |
|
15 | 15 | class Products < Base |
16 | 16 | include BeyondApi::ProductAttachments |
@@ -43,7 +43,7 @@ class Products < Base |
43 | 43 | # @products = session.products.all(size: 100, page: 0) |
44 | 44 | # |
45 | 45 | def all(params = {}) |
46 | | - handle_all_request("/products", :products, params) |
| 46 | + handle_all_request('/products', :products, params) |
47 | 47 | end |
48 | 48 |
|
49 | 49 | # |
@@ -98,8 +98,8 @@ def all(params = {}) |
98 | 98 | # } |
99 | 99 | # }, |
100 | 100 | # "shippingPeriod" : { |
101 | | - # "minDays" : 2, |
102 | | - # "maxDays" : 4, |
| 101 | + # "min" : 2, |
| 102 | + # "max" : 4, |
103 | 103 | # "displayUnit" : "WEEKS" |
104 | 104 | # } |
105 | 105 | # }' |
@@ -157,16 +157,16 @@ def all(params = {}) |
157 | 157 | # } |
158 | 158 | # }, |
159 | 159 | # "shippingPeriod": { |
160 | | - # "minDays": 2, |
161 | | - # "maxDays": 4, |
| 160 | + # "min": 2, |
| 161 | + # "max": 4, |
162 | 162 | # "displayUnit": "WEEKS" |
163 | 163 | # } |
164 | 164 | # } |
165 | 165 | # |
166 | 166 | # @product = session.products.create(body) |
167 | 167 | # |
168 | 168 | def create(body) |
169 | | - response, status = BeyondApi::Request.post(@session, "/products", body) |
| 169 | + response, status = BeyondApi::Request.post(@session, '/products', body) |
170 | 170 |
|
171 | 171 | handle_response(response, status) |
172 | 172 | end |
@@ -271,13 +271,14 @@ def update(product_id, body) |
271 | 271 | # session.products.assign_variation_images_differentiator("f205294b-17dc-4f75-8b5e-5df72abb96df", "491fedf4-37a9-4bcf-98b8-cff2f82879b7") |
272 | 272 | # |
273 | 273 | def assign_variation_attribute_as_differentiator(product_id, variation_attribute_id) |
274 | | - response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator") |
| 274 | + response, status = BeyondApi::Request.post(@session, |
| 275 | + "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator") |
275 | 276 |
|
276 | 277 | handle_response(response, status, respond_with_true: true) |
277 | 278 | end |
278 | 279 |
|
279 | | - alias_method :create_variation, :create |
280 | | - alias_method :find_variation, :find |
281 | | - alias_method :update_variation, :update |
| 280 | + alias create_variation create |
| 281 | + alias find_variation find |
| 282 | + alias update_variation update |
282 | 283 | end |
283 | 284 | end |
0 commit comments