class XmlConv::I2::Address

Constants

I2_ADDR_CODES

Attributes

city[RW]
code[RW]
country[RW]
name1[RW]
name2[RW]
party_id[RW]
street1[RW]
street2[RW]
zip_code[RW]

Public Class Methods

new() click to toggle source
# File lib/xmlconv/i2/address.rb, line 16
def initialize
        @code = :buyer
end

Public Instance Methods

to_s() click to toggle source
# File lib/xmlconv/i2/address.rb, line 19
def to_s
        output = []
        numerals = [ 201, 202, 220, 221, 222, 223, 224, 225, 226 ]
        [
                I2_ADDR_CODES[@code],
                @party_id, @name1, @name2, @street1,
                @city, @country, @zip_code, @street2,
        ].each_with_index { |value, idx|
                unless(value.nil?)
                        output << "#{numerals[idx]}:#{value}"
                end
        }
        output.join("\n") << "\n"
end