Skip to content

Commit 48678d4

Browse files
author
unabris
committed
Merge remote-tracking branch 'upstream/master'
2 parents d1908de + c5a442d commit 48678d4

File tree

7 files changed

+42
-7
lines changed

7 files changed

+42
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
### v0.7.0.pre
2+
3+
* features
4+
* Add `Products#assign_variation_images_differentiator` method
5+
6+
* deprecations
7+
* `Variations#adjust_stock_level` receives parameter `relative_amount` instead of `body`
8+
19
### v0.6.0.pre
210

311
* bug-fixes

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
beyond_api (0.6.0.pre)
4+
beyond_api (0.7.0.pre)
55
faraday (~> 0.15)
66

77
GEM

lib/beyond_api/resources/products.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,33 @@ def update(product_id, body)
252252
handle_response(response, status)
253253
end
254254

255+
#
256+
# A +PUT+ request is used to assign a variation images differentiator for a variation product. The differentiator can be one of the variation attributes defined by the merchant, e.g. name, size, or color.
257+
#
258+
# @beyond_api.scopes +prod:u+
259+
#
260+
# $ curl 'https://api-shop.beyondshop.cloud/api/products/30839efc-47f7-4d55-aa13-aac7532982b6/variation-images-differentiator' -i -X PUT \
261+
# -H 'Content-Type: application/hal+json' \
262+
# -H 'Accept: application/hal+json' \
263+
# -H 'Authorization: Bearer <Access token>' \
264+
# -d '{
265+
# "differentiator" : "size"
266+
# }'
267+
#
268+
# @param product_id [String] the product UUID
269+
# @param differentiator [String] the differentiator
270+
#
271+
# @return [true]
272+
#
273+
# @example
274+
# session.products.assign_variation_images_differentiator("30839efc-47f7-4d55-aa13-aac7532982b6", "size")
275+
#
276+
def assign_variation_images_differentiator(product_id, differentiator)
277+
response, status = BeyondApi::Request.put(@session, "/products/#{product_id}/variation-images-differentiator", differentiator: differentiator)
278+
279+
handle_response(response, status, respond_with_true: true)
280+
end
281+
255282
alias_method :create_variation, :create
256283
alias_method :find_variation, :find
257284
alias_method :update_variation, :update

lib/beyond_api/resources/products/availability.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module ProductAvailability
2222
# @return [OpenStruct]
2323
#
2424
# @example
25-
# @availability = session.products.adjust_stock_level("685f483e-cdda-40af-8091-d5bc31249409", { relativeAmount => -1 })
25+
# @availability = session.products.adjust_stock_level("685f483e-cdda-40af-8091-d5bc31249409", -1)
2626
#
2727
def adjust_stock_level(product_id, relative_amount)
2828
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/availability/adjust-available-stock", { relative_amount: relative_amount })

lib/beyond_api/resources/variations/availability.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ module VariationAvailability
1818
#
1919
# @param product_id [String] the product UUID
2020
# @param variation_id [String] the product variation UUID
21-
# @param body [Hash] the request body
21+
# @param relative_amount [Integer] the relative amount
2222
#
2323
# @return [OpenStruct]
2424
#
2525
# @example
2626
# @availability = session.variations.adjust_stock_level(product_id, variation_id, { relativeAmount => -1 })
2727
#
28-
def adjust_stock_level(product_id, variation_id, body)
29-
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variations/#{variation_id}/availability/adjust-available-stock", body)
28+
def adjust_stock_level(product_id, variation_id, relative_amount)
29+
response, status = BeyondApi::Request.post(@session, "/products/#{product_id}/variations/#{variation_id}/availability/adjust-available-stock", relative_amount: relative_amount)
3030

3131
handle_response(response, status)
3232
end

lib/beyond_api/resources/variations/images.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def images(product_id, variation_id, params = {})
139139
# "source" => "https://vimeo.com/7265982"
140140
# }
141141
#
142-
# session.variation.upload_image("4125b993-49fc-47c8-b9b3-76d8871e4e06", "d7fecf94-2e57-4122-8c94-a0acd840c111", "/home/epages/file.png", "file.png")
142+
# session.variations.upload_image("4125b993-49fc-47c8-b9b3-76d8871e4e06", "d7fecf94-2e57-4122-8c94-a0acd840c111", "/home/epages/file.png", "file.png")
143143
#
144144
def upload_image(product_id, variation_id, image_path, image_name)
145145
content_type = case File.extname(image_path)

lib/beyond_api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module BeyondApi
2-
VERSION = "0.6.0.pre".freeze
2+
VERSION = "0.7.0.pre".freeze
33
end

0 commit comments

Comments
 (0)