Class: XmlConv::I2::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlconv/i2/address.rb

Constant Summary collapse

I2_ADDR_CODES =
{
	:buyer		=>	'BY',
	:delivery	=>	'DP',
	:employee	=>	'EP',
     :customer =>  'CU',
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAddress

Returns a new instance of Address.



16
17
18
# File 'lib/xmlconv/i2/address.rb', line 16

def initialize
	@code = :buyer
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def city
  @city
end

#codeObject

Returns the value of attribute code.



7
8
9
# File 'lib/xmlconv/i2/address.rb', line 7

def code
  @code
end

#countryObject

Returns the value of attribute country.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def country
  @country
end

#name1Object

Returns the value of attribute name1.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def name1
  @name1
end

#name2Object

Returns the value of attribute name2.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def name2
  @name2
end

#party_idObject

Returns the value of attribute party_id.



7
8
9
# File 'lib/xmlconv/i2/address.rb', line 7

def party_id
  @party_id
end

#street1Object

Returns the value of attribute street1.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def street1
  @street1
end

#street2Object

Returns the value of attribute street2.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def street2
  @street2
end

#zip_codeObject

Returns the value of attribute zip_code.



8
9
10
# File 'lib/xmlconv/i2/address.rb', line 8

def zip_code
  @zip_code
end

Instance Method Details

#to_sObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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