Module: RubyOmx::Orders

Defined in:
lib/ruby_omx/orders.rb

Constant Summary collapse

FULFILL_STATUS =

Status mapping

{
  '0'=>'pending',
  '2'=>'clearing',
  '3'=>'backordered',
  '5'=>'on hold',
  '8'=>'held-to-complete',
  '20'=>'backordered',
  '28'=>'held-to-complete',
  '30'=>'warehouse',
  '40'=>'shipped',
  '50'=>'returned',
  '52'=>'pending returned',
  '90'=>'cancelled', 
  '95'=>'auto-cancelled',
  '96'=>'voided shipment' 
}
PENDING_STATUS =

actual status is pending an OMX data delivery

['0','2','28','30','52']
BACKORDER_STATUS =

needs fulfillment attention

[ '3', '20','5','8']
SHIPPED_STATUS =

has or will soon ship (may come back)

['40']
RETURN_STATUS =

has been returned

['50']
CANCEL_STATUS =

has been cancelled

['90','95','96']

Instance Method Summary collapse

Instance Method Details

#build_info_request(attrs = {}) ⇒ Object

Order Information



45
46
47
# File 'lib/ruby_omx/orders.rb', line 45

def build_info_request(attrs={})
   OrderInfoRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))
end

#build_udoa_request(attrs = {}) ⇒ Object

Universal Direct Order Appending (UDOA)



30
31
32
# File 'lib/ruby_omx/orders.rb', line 30

def build_udoa_request(attrs={})
  UDOARequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))
end

#send_cancellation_history_request(attrs = {}) ⇒ Object

CancellationHistoryRequest (CHR100) This request type lists all the cancellations that have occurred between two dates.



59
60
61
62
63
64
# File 'lib/ruby_omx/orders.rb', line 59

def send_cancellation_history_request(attrs={})
  request = CancellationHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))
  response = get(request.to_xml.to_s)
  return response if request.raw_xml==true || request.raw_xml==1
  CancellationHistoryResponse.format(response)
end

#send_info_request(attrs = {}) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/ruby_omx/orders.rb', line 49

def send_info_request(attrs={})
 @connection = RubyOmx::Connection.connect({ "http_biz_id" => @http_biz_id, "udi_auth_token" => @udi_auth_token, "server"=>ALT_HOST }) if attrs[:version].present? && attrs[:version]=='2.00'
request = build_info_request(attrs)
  response = post(request.to_xml.to_s)
  return response if request.raw_xml==true || request.raw_xml==1
  OrderInfoResponse.format(response)
end

#send_return_history_request(attrs = {}) ⇒ Object

ReturnHistoryRequest (RHR100) This request returns a list of all the product returns that have happened within a target date/time range, with basic information about these returns.



67
68
69
70
71
72
# File 'lib/ruby_omx/orders.rb', line 67

def send_return_history_request(attrs={})
  request = ReturnHistoryRequest.new(attrs.merge({:http_biz_id=>@http_biz_id, :udi_auth_token=>@udi_auth_token}))
  response = get(request.to_xml.to_s)
  return response if request.raw_xml==true || request.raw_xml==1
  ReturnHistoryResponse.format(response)
end

#send_udoa_request(attrs = {}) ⇒ Object Also known as: append_order



34
35
36
37
38
39
# File 'lib/ruby_omx/orders.rb', line 34

def send_udoa_request(attrs={})
  request = build_udoa_request(attrs)
    response = post(request.to_xml.to_s)
    return response if request.raw_xml==true || request.raw_xml==1
    UDOAResponse.format(response)
end