class TNT::Shipment

Shipments endpoint resource

Public Class Methods

create(payload) click to toggle source

Handles the shipment label creation

@return [TNT::Shipment]

# File lib/tnt.rb, line 86
def self.create(payload)
  opts = { form: { xml_in: to_xml(payload) } }
  pre_response = request(:post, uri, opts)

  # Use the token and get the real response...
  opts = { form: { xml_in: 'GET_RESULT:' + pre_response['complete'] } }
  response = request(:post, uri, opts)

  new((response['document'] || response).merge(pre_response))
end