Class: DHLEcommerceAPI::ShipmentDelete
- Defined in:
- lib/dhl_ecommerce_api/resources/shipment_delete.rb
Class Method Summary collapse
- .delete_shipment_request(shipment_id) ⇒ Object
-
.destroy(shipment_id) ⇒ Object
Destroy a single shipment.
Methods inherited from Base
#account_ids, #attributes_with_account_ids, #custom_key_format, #handle_errors
Class Method Details
.delete_shipment_request(shipment_id) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dhl_ecommerce_api/resources/shipment_delete.rb', line 16 def self.delete_shipment_request(shipment_id) { "deleteShipmentReq": { "hdr": { "messageType": "DELETESHIPMENT", "messageDateTime": DateTime.now.to_s, "accessToken": DHLEcommerceAPI::Authentication.get_token, "messageVersion": "1.0" }, "bd": { "pickupAccountId": DHLEcommerceAPI.config.pickup_account_id, "soldToAccountId": DHLEcommerceAPI.config.sold_to_account_id, "shipmentItems": [ { "shipmentID": shipment_id } ] } } } end |
.destroy(shipment_id) ⇒ Object
Destroy a single shipment
7 8 9 10 11 12 13 14 |
# File 'lib/dhl_ecommerce_api/resources/shipment_delete.rb', line 7 def self.destroy(shipment_id) request_params = delete_shipment_request(shipment_id) response = connection.post(collection_path, request_params.to_json, headers) data = JSON.parse(response.body) data.dig("deleteShipmentResp", "bd", "shipmentItems")&.first end |