Class: Cargowise::OrdersClient

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

Overview

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

Instance Method Summary collapse

Instance Method Details

#get_order_list(endpoint_uri, company_code, username, pass, filter_hash) ⇒ Object

return an array of orders. Each order should correspond to a buyer PO.

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



16
17
18
19
20
21
22
# File 'lib/cargowise/orders_client.rb', line 16

def get_order_list(endpoint_uri, company_code, username, pass, filter_hash)
  client = build_client(order_wsdl_path, endpoint_uri, company_code, username, pass)
  response = client.call(:get_order_list, message: filter_hash)
  response.xpath("//tns:GetOrderListResult/tns:WebOrder", {"tns" => Cargowise::DEFAULT_NS}).map do |node|
    Cargowise::Order.new(node)
  end
end

#hello(endpoint_uri, company_code, username, pass) ⇒ Object

test authentication, returns a string with your company name if successful



27
28
29
30
31
# File 'lib/cargowise/orders_client.rb', line 27

def hello(endpoint_uri, company_code, username, pass)
  client = build_client(order_wsdl_path, endpoint_uri, company_code, username, pass)
  response = client.call(:hello)
  response.xpath("//tns:HelloResponse/tns:HelloResult/text()", {"tns" => Cargowise::DEFAULT_NS}).to_s
end