Class: DhlFreightApi::Resources::ShipmentBooking
- Inherits:
-
Object
- Object
- DhlFreightApi::Resources::ShipmentBooking
- Defined in:
- lib/dhl_freight_api/resources/shipment_booking.rb
Instance Method Summary collapse
- #base_url ⇒ Object
- #create(payload) ⇒ Object
-
#initialize(client) ⇒ ShipmentBooking
constructor
A new instance of ShipmentBooking.
Constructor Details
#initialize(client) ⇒ ShipmentBooking
Returns a new instance of ShipmentBooking.
6 7 8 |
# File 'lib/dhl_freight_api/resources/shipment_booking.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#base_url ⇒ Object
10 11 12 |
# File 'lib/dhl_freight_api/resources/shipment_booking.rb', line 10 def base_url "#{@client.base_url}/transportinstructionapi/v1/transportinstruction/sendtransportinstruction" end |
#create(payload) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/dhl_freight_api/resources/shipment_booking.rb', line 14 def create(payload) response = @client.connection.post(base_url, payload) if response.success? handle_business_response(response) else raise_error("Failed to create shipment booking", response) end end |