Class: ExportoAPI::ReturnShipmentResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/exporto_api/resources/return_shipment_resource.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from ExportoAPI::Resource

Instance Method Details

#create(shipment_id:, foreign_inbound_tracking_id:, order_id: nil, customer_facing_id: nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/exporto_api/resources/return_shipment_resource.rb', line 5

def create(
  shipment_id:,
  foreign_inbound_tracking_id:,
  order_id: nil,
  customer_facing_id: nil
)
  body = {
    "orderId" => order_id,
    "customerFacingId" => customer_facing_id,
    "shipmentId" => shipment_id,
    "foreignInboundTrackingId" => foreign_inbound_tracking_id
  }.compact

  post_request("order/return-shipment", body: body)

  # Exporto returns no response body for a successful return-shipment registration.
  Objects::ReturnShipmentResponse.new(success: true)
end