Class: CargowiseTS::Order

Inherits:
AbstractResult show all
Defined in:
lib/cargowise-ts/order.rb

Overview

A purchase order that is being shipped to from a supplier to you via a logistics company.

Typcially you will setup an arrangement with your account manager where they are sent copies of POs so they can be entered into the database and tracked.

All order objects are read-only, see the object attributes to see what information is available.

Use class find methods to retrieve order info from your logistics company.

Order.find_by_order_number(...)
Order.find_incomplete(...)
etc

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractResult

#inspect

Constructor Details

#initialize(node) ⇒ Order

Returns a new instance of Order.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/cargowise-ts/order.rb', line 37

def initialize(node)
  @node = node

  @order_number = text_value("./OrderIdentifier/OrderNumber")
  @invoice_number = text_value("./OrderDetail/InvoiceNumber")
  @order_status = text_value("./OrderDetail/OrderStatus")
  @description  = text_value("./OrderDetail/Description")
  @datetime     = time_value("./OrderDetail/OrderDateTime")
  @order_total  = decimal_value("./OrderDetail/OrderTotal")
  @transport_mode = text_value("./OrderDetail/TransportMode")
  @container_mode = text_value("./OrderDetail/ContainerMode")

  @buyer_name   = text_value("./OrderDetail/Buyer/OrganisationDetails/Name")

  @supplier_name = text_value("./OrderDetail/Supplier/OrganisationDetails/Name")

  @shipments = node_array("./Shipment").map { |node|
    Shipment.new(node)
  }
end

Instance Attribute Details

#buyer_nameObject (readonly)

Returns the value of attribute buyer_name.



31
32
33
# File 'lib/cargowise-ts/order.rb', line 31

def buyer_name
  @buyer_name
end

#container_modeObject (readonly)

Returns the value of attribute container_mode.



28
29
30
# File 'lib/cargowise-ts/order.rb', line 28

def container_mode
  @container_mode
end

#datetimeObject (readonly)

Returns the value of attribute datetime.



27
28
29
# File 'lib/cargowise-ts/order.rb', line 27

def datetime
  @datetime
end

#descriptionObject (readonly)

Returns the value of attribute description.



27
28
29
# File 'lib/cargowise-ts/order.rb', line 27

def description
  @description
end

#invoice_numberObject (readonly)

Returns the value of attribute invoice_number.



29
30
31
# File 'lib/cargowise-ts/order.rb', line 29

def invoice_number
  @invoice_number
end

#order_numberObject (readonly)

Returns the value of attribute order_number.



27
28
29
# File 'lib/cargowise-ts/order.rb', line 27

def order_number
  @order_number
end

#order_statusObject (readonly)

Returns the value of attribute order_status.



27
28
29
# File 'lib/cargowise-ts/order.rb', line 27

def order_status
  @order_status
end

#order_totalObject (readonly)

Returns the value of attribute order_total.



28
29
30
# File 'lib/cargowise-ts/order.rb', line 28

def order_total
  @order_total
end

#shipmentsObject (readonly)

Returns the value of attribute shipments.



35
36
37
# File 'lib/cargowise-ts/order.rb', line 35

def shipments
  @shipments
end

#supplier_nameObject (readonly)

Returns the value of attribute supplier_name.



33
34
35
# File 'lib/cargowise-ts/order.rb', line 33

def supplier_name
  @supplier_name
end

#transport_modeObject (readonly)

Returns the value of attribute transport_mode.



28
29
30
# File 'lib/cargowise-ts/order.rb', line 28

def transport_mode
  @transport_mode
end

Instance Method Details

#to_xmlObject



58
59
60
# File 'lib/cargowise-ts/order.rb', line 58

def to_xml
  @node.to_xml
end