|
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 | # |
@@ -166,7 +166,7 @@ def all(params = {}) |
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,14 +271,13 @@ 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, |
275 | | - "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator") |
| 274 | + response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variation-attributes/#{variation_attribute_id}/make-differentiator") |
276 | 275 |
|
277 | 276 | handle_response(response, status, respond_with_true: true) |
278 | 277 | end |
279 | 278 |
|
280 | | - alias create_variation create |
281 | | - alias find_variation find |
282 | | - alias update_variation update |
| 279 | + alias_method :create_variation, :create |
| 280 | + alias_method :find_variation, :find |
| 281 | + alias_method :update_variation, :update |
283 | 282 | end |
284 | 283 | end |
0 commit comments