class XmlConv::I2::Order
Constants
- I2_DELIVERY_CODES
Attributes
addresses[R]
ade_id[RW]
agent[RW]
dates[R]
delivery_id[RW]
free_text[RW]
interface[RW]
positions[R]
sender_id[RW]
terms_cond[RW]
transport_cost[RW]
Public Class Methods
new()
click to toggle source
# File lib/xmlconv/i2/order.rb, line 22 def initialize @addresses = [] @dates = [] @positions = [] @interface = "61" end
Public Instance Methods
add_address(address)
click to toggle source
# File lib/xmlconv/i2/order.rb, line 28 def add_address(address) @addresses.push(address) end
add_date(date)
click to toggle source
# File lib/xmlconv/i2/order.rb, line 31 def add_date(date) @dates.push(date) end
add_position(position)
click to toggle source
# File lib/xmlconv/i2/order.rb, line 34 def add_position(position) @positions.push(position) end
to_s()
click to toggle source
# File lib/xmlconv/i2/order.rb, line 37 def to_s output = <<-EOS 100:#{@sender_id} 101:#{@delivery_id} EOS @addresses.each { |addr| output << addr.to_s } numerals = [ 231, 236, 237, 238, 242 ] [ @agent, @free_text, @interface, I2_DELIVERY_CODES[@terms_cond], @transport_cost, ].each_with_index { |value, idx| unless(value.nil?) output << sprintf("%s:%s\n", numerals[idx], value) end } if(@ade_id) output << sprintf("250:ADE\n251:%s\n", @ade_id) end @dates.each { |date| output << date.to_s } @positions.each { |pos| output << pos.to_s } output end