@@ -43,8 +43,8 @@ def add_line_item(cart_id, body)
4343 # @example
4444 # @cart = session.carts.create
4545 #
46- def create ( body )
47- response , status = BeyondApi ::Request . post ( @session , "/carts" , body )
46+ def create
47+ response , status = BeyondApi ::Request . post ( @session , "/carts" )
4848
4949 handle_response ( response , status )
5050 end
@@ -202,7 +202,7 @@ def delete_line_item(cart_id, line_item_id)
202202 # @return true
203203 #
204204 # @example
205- # session.carts.delete_line_item ("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
205+ # session.carts.delete_shipping_address ("2fa7dc36-8305-4628-b961-f2c3f7dda47d")
206206 #
207207 def delete_shipping_address ( cart_id )
208208 response , status = BeyondApi ::Request . delete ( @session , "/carts/#{ cart_id } /shipping-address" )
@@ -290,6 +290,7 @@ def payment_methods(cart_id)
290290 # "_ref" => "f084553c-ea77-4745-b1bd-71c64c8419fd",
291291 # "quantity" => 2
292292 # }
293+ #
293294 # @cart = session.carts.replace_line_item("f73629e5-fecf-4474-9b04-6b2fcd4663c4", "2c9c0f38-0b9e-4fa7-bcbe-960098ff63aa", body)
294295 #
295296 def replace_line_item ( cart_id , line_item_id , body )
@@ -311,8 +312,13 @@ def replace_line_item(cart_id, line_item_id, body)
311312 # @return [OpenStruct]
312313 #
313314 # @example
314- # body = [{"_type":"PRODUCT","_ref":"0612362d-9856-4b40-94c6-a36abec0cf8c","quantity":1}]
315- # @cart = session.carts.replace_line_item("c1436110-e283-49b3-a748-0321efec6d35", body)
315+ # body = [ {
316+ # "_type" => "PRODUCT",
317+ # "_ref" => "0612362d-9856-4b40-94c6-a36abec0cf8c",
318+ # "quantity" => 1
319+ # } ]
320+ #
321+ # @cart = session.carts.replace_line_items("c1436110-e283-49b3-a748-0321efec6d35", body)
316322 #
317323 def replace_line_items ( cart_id , body )
318324 response , status = BeyondApi ::Request . put ( @session , "/carts/#{ cart_id } /line-items" , body )
@@ -361,6 +367,7 @@ def replace_line_items(cart_id, body)
361367 # "taxNumber" => "123-34-6789",
362368 # "birthDate" => "1985-03-20"
363369 # }
370+ #
364371 # @cart = session.carts.set_billing_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
365372 #
366373 def set_billing_address ( cart_id , body )
@@ -453,6 +460,7 @@ def set_payment_method_to_default(cart_id)
453460 # "taxNumber" => "123-34-6789",
454461 # "birthDate" => "1985-03-20"
455462 # }
463+ #
456464 # @cart = session.carts.set_shipping_address("01da6aa7-8aa2-4383-a496-6611a14afbc9", body)
457465 #
458466 def set_shipping_address ( cart_id , body )
@@ -489,7 +497,7 @@ def set_shipping_method(cart_id, shipping_zone_id, shipping_method_id)
489497 # A +PUT+ request is used to set the shipping method to the current default shipping method.
490498 # The default shipping method is the one with the highest priority of the applicable shipping methods.
491499 #
492- # $ curl 'https://api-shop.beyondshop.cloud/api/carts/64efe22b-2699-4032-a2c9-c94a2e4fa425 /shipping-methods/default' -i -X PUT \
500+ # $ curl 'https://api-shop.beyondshop.cloud/api/carts/c31c5d06-4460-4f89-9e09-47f9956dea98 /shipping-methods/default' -i -X PUT \
493501 # -H 'Content-Type: application/json' \
494502 # -H 'Accept: application/json'
495503 #
@@ -498,11 +506,10 @@ def set_shipping_method(cart_id, shipping_zone_id, shipping_method_id)
498506 # @return [OpenStruct]
499507 #
500508 # @example
501- # @cart = session.carts.set_shipping_method_to_default("a4e7922a-f895-4a7d-8cb1-6ecf74d7ceba ")
509+ # @cart = session.carts.set_shipping_method_to_default("c31c5d06-4460-4f89-9e09-47f9956dea98 ")
502510 #
503511 def set_shipping_method_to_default ( cart_id )
504- response , status = BeyondApi ::Request . put ( @session , "/carts/#{ cart_id } /shipping-methods/current" ,
505- "#{ session . api_url } /shipping-zones/#{ shipping_zone_id } /shipping-methods/#{ shipping_method_id } " )
512+ response , status = BeyondApi ::Request . put ( @session , "/carts/#{ cart_id } /shipping-methods/default" )
506513
507514 handle_response ( response , status )
508515 end
@@ -523,6 +530,7 @@ def set_shipping_method_to_default(cart_id)
523530 #
524531 def shipping_method ( cart_id )
525532 response , status = BeyondApi ::Request . get ( @session , "/carts/#{ cart_id } " )
533+
526534 handle_response ( response , status )
527535 end
528536
@@ -541,6 +549,7 @@ def shipping_method(cart_id)
541549 #
542550 def shipping_methods ( cart_id )
543551 response , status = BeyondApi ::Request . get ( @session , "/carts/#{ cart_id } " )
552+
544553 handle_response ( response , status )
545554 end
546555 end
0 commit comments