class Brightpearl::Order

Attributes

contact_id[RW]
created_by_id[RW]
created_on[RW]
customer_ref[RW]
delivery_date[RW]
department_id[RW]
external_ref[RW]
id[RW]
installed_integration_instance_id[RW]
order_payment_status_id[RW]
order_shipping_status_id[RW]
order_status_id[RW]
order_stock_status_id[RW]
order_type_id[RW]
parent_order_id[RW]
staff_owner_contact_id[RW]
tax_date[RW]
updated_on[RW]
warehouse_id[RW]

Public Class Methods

new(ara, as_response: false) click to toggle source

DSL ARA => API Record Array(from search and other endpoints)

# File lib/brightpearl/resources/order.rb, line 37
def initialize(ara, as_response: false)
  unless as_response
    @id = ara[0];
    @order_type_id = ara[1]; @contact_id = ara[2]; @order_status_id = ara[3]; @order_stock_status_id = ara[4];
    @created_on = ara[5]; @created_by_id = ara[6]; 
    @customer_ref = ara[7]; @order_payment_status_id = ara[8]; @updated_on = ara[9]; 
    @parent_order_id = ara[10]; @order_shipping_status_id = ara[11]; @external_ref = ara[12];
    @installed_integration_instance_id = ara[13]; @warehouse_id = ara[14]; @staff_owner_contact_id = ara[15]; 
    @tax_date = ara[16];
    @department_id = ara[17];
    @delivery_date = ara[18];
  else  # Order response from get_order
    @id = ara["id"]
    @order_type_id = nil 
    @contact_id = ara["parties"]["customer"]["contactId"]
    @order_status_id = ara["orderStatus"]["orderStatusId"]
    @order_stock_status_id = nil
    @created_on = ara["createdOn"]
    @created_by_id = ara["createdById"]
    @customer_ref = nil
    @order_payment_status_id = nil
    @updated_on = ara["updatedOn"]
    @parent_order_id = ara["parentOrderId"]
    @order_shipping_status_id = nil
    @external_ref = ara["reference"]
    @installed_integration_instance_id = nil
    @warehouse_id = ara["warehousrId"]
    @staff_owner_contact_id = ara["assignment"]["current"]["staffOwnerContactId"]
    @tax_date = ara["invoices"][0] && ara["invoices"][0]["taxDate"]
    @department_id = nil
    @delivery_date = nil
  end
end
resource_path() click to toggle source
# File lib/brightpearl/resources/order.rb, line 16
def resource_path
  "order-service/order"
end