Class: RubyOmx::OrderInfoRequest

Inherits:
Request show all
Defined in:
lib/ruby_omx/request/order_info_request.rb

Instance Attribute Summary collapse

Attributes inherited from Request

#raw_xml

Instance Method Summary collapse

Methods inherited from Response

format, parse_xml

Methods inherited from Node

#accessors, #as_hash

Constructor Details

#initialize(attrs = {}) ⇒ OrderInfoRequest

Returns a new instance of OrderInfoRequest.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby_omx/request/order_info_request.rb', line 5

def initialize(attrs={})
  return super unless attrs.any?
  
  # Require either an order number or a store code and an order id to locate the order
  raise MissingRequestOptions if attrs[:order_number].nil? && (attrs[:store_code].nil? || attrs[:order_id].nil?)
  super
  self.version = attrs[:version] ||= '1.00'
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'OrderNumber', :value=>attrs[:order_number]}) if attrs[:order_number]
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'OrderID', :value=>attrs[:order_id]}) if attrs[:order_id]
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'StoreCode', :value=>attrs[:store_code]}) if attrs[:store_code]
  self.udi_parameters << RubyOmx::UDIParameter.new({:key=>'level', :value=>attrs[:level] ||=2 })
end

Instance Attribute Details

#order_idObject

Returns the value of attribute order_id.



18
19
20
# File 'lib/ruby_omx/request/order_info_request.rb', line 18

def order_id
  @order_id
end

#order_numberObject

Returns the value of attribute order_number.



18
19
20
# File 'lib/ruby_omx/request/order_info_request.rb', line 18

def order_number
  @order_number
end

#store_codeObject

Returns the value of attribute store_code.



18
19
20
# File 'lib/ruby_omx/request/order_info_request.rb', line 18

def store_code
  @store_code
end