Class: Cargowise::ShipmentsClient

Inherits:
AbstractClient show all
Defined in:
lib/cargowise/shipments_client.rb

Overview

SOAP client for retreiving shipment data. Not much to see here, used by the Shipment resource class.

Instance Method Summary collapse

Methods inherited from AbstractClient

#hello, #on_create_document, #on_response_document

Instance Method Details

#get_shipments_list(company_code, username, pass, filter_hash) ⇒ Object

return an array of shipments. Each shipment should correspond to a consolidated shipment from the freight company.

filter_hash should be a hash that will be serialised into an XML fragment specifying the search criteria. See the WSDL documentation for samples



17
18
19
20
21
22
23
24
# File 'lib/cargowise/shipments_client.rb', line 17

def get_shipments_list(company_code, username, pass, filter_hash)
  soap_action  = 'http://www.edi.com.au/EnterpriseService/GetShipmentsList'
  soap_headers = headers(company_code, username, pass)
  response     = invoke('tns:GetShipmentsList', :soap_action => soap_action, :soap_header => soap_headers, :soap_body => filter_hash, :http_options => cw_http_options)
  response.document.xpath("//tns:GetShipmentsListResult/tns:WebShipment", {"tns" => Cargowise::DEFAULT_NS}).map do |node|
    Cargowise::Shipment.new(node)
  end
end