Skip to content

Commit 92569d3

Browse files
authored
Release v0.24.2.pre (#59)
* Update shipping methods * Minor fix
1 parent 427d98f commit 92569d3

File tree

4 files changed

+64
-3
lines changed

4 files changed

+64
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
### v0.24.2.pre
2+
3+
* features
4+
* Add `ShippingZones#update_shipping_method`
5+
16
### v0.24.1.pre
27

38
* 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.24.1.pre)
4+
beyond_api (0.24.2.pre)
55
faraday (~> 1.9.0)
66

77
GEM

lib/beyond_api/resources/shipping_zones.rb

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def create(body)
108108
# "amount" => "19.99"
109109
# }
110110
# }
111-
# @shipping_zone = session.shipping_zones.create_shipping_method("905e981c-1489-45af-9138-0a7dc1f0b085", body)
111+
# @shipping_method = session.shipping_zones.create_shipping_method("905e981c-1489-45af-9138-0a7dc1f0b085", body)
112112
#
113113
def create_shipping_method(shipping_zone_id, body)
114114
path = "/shipping-zones/#{shipping_zone_id}/shipping-methods"
@@ -360,5 +360,61 @@ def update(shipping_zone_id, body)
360360

361361
handle_response(response, status)
362362
end
363+
364+
#
365+
# A +PUT+ request is used to update a shipping method in a shipping zone.
366+
#
367+
# $ curl 'https://api-shop.beyondshop.cloud/api/shipping-zones/c4137d8b-3dd1-4b73-91f0-32f1433c8195/shipping-methods/25df7018-a7a2-4903-85fa-6a3a73ae40b2' -i -X PUT \
368+
# -H 'Content-Type: application/json' \
369+
# -H 'Authorization: Bearer <Access token>' \
370+
# -d '{
371+
# "name" : "Express",
372+
# "description" : "Shipping overnight. Delivery on the next day.",
373+
# "taxClass" : "REGULAR",
374+
# "freeShippingValue" : {
375+
# "currency" : "EUR",
376+
# "amount" : 200
377+
# },
378+
# "fixedPrice" : {
379+
# "taxModel" : "GROSS",
380+
# "currency" : "EUR",
381+
# "amount" : 25
382+
# }
383+
# }'
384+
#
385+
# @beyond_api.scopes +shpz:u+
386+
#
387+
# @param shipping_zone_id [String] the shipping zone UUID
388+
# @param shipping_method_id [String] the shipping method UUID
389+
# @param body [String] the request body
390+
#
391+
# @return [OpenStruct]
392+
#
393+
# @example
394+
# body = {
395+
# "name" : "Express",
396+
# "description" : "Shipping overnight. Delivery on the next day.",
397+
# "taxClass" : "REGULAR",
398+
# "freeShippingValue" : {
399+
# "currency" : "EUR",
400+
# "amount" : 200
401+
# },
402+
# "fixedPrice" : {
403+
# "taxModel" : "GROSS",
404+
# "currency" : "EUR",
405+
# "amount" : 25
406+
# }
407+
# }
408+
# @shipping_method = session.shipping_zones.update_shipping_method("c4137d8b-3dd1-4b73-91f0-32f1433c8195", "25df7018-a7a2-4903-85fa-6a3a73ae40b2", body)
409+
#
410+
def update_shipping_method(shipping_zone_id, shipping_method_id, body)
411+
path = "/shipping-zones/#{shipping_zone_id}/shipping-methods/#{shipping_method_id}"
412+
413+
response, status = BeyondApi::Request.put(@session,
414+
path,
415+
body)
416+
417+
handle_response(response, status)
418+
end
363419
end
364420
end

lib/beyond_api/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module BeyondApi
4-
VERSION = "0.24.1.pre"
4+
VERSION = "0.24.2.pre"
55
end

0 commit comments

Comments
 (0)