Class: DPD::Shipment
Overview
Shipments endpoint resource
Class Method Summary collapse
-
.find(id) ⇒ DPD::Response
Handles the shipment fetching request.
Instance Method Summary collapse
-
#cancel(comment) ⇒ DPD::Response
Handles the shipment cancellation request.
Methods inherited from Resource
credentials, error_response?, extract_error, parse_response, request
Class Method Details
.find(id) ⇒ DPD::Response
Handles the shipment fetching request
86 87 88 89 90 |
# File 'lib/dpd.rb', line 86 def self.find(id) params = { shipmentIds: [id] } params.merge!(credentials) new(request(:post, uri('info'), json: params).values.flatten.first) end |
Instance Method Details
#cancel(comment) ⇒ DPD::Response
Handles the shipment cancellation request
95 96 97 98 99 100 101 102 |
# File 'lib/dpd.rb', line 95 def cancel(comment) params = { shipmentId: id, comment: comment } self.class.request( :post, self.class.uri('cancel'), json: params.merge(self.class.credentials) ) end |