Class: Iloxx::Shipping::Address
- Inherits:
-
Object
- Object
- Iloxx::Shipping::Address
- Defined in:
- lib/iloxx_shipping/address.rb
Constant Summary collapse
- VALID_SEX =
[:NoSexCode, :Male, :Female]
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#sex ⇒ Object
Returns the value of attribute sex.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
- #append_to_xml(xml) ⇒ Object
- #company? ⇒ Boolean
-
#initialize(attributes = {}) ⇒ Address
constructor
A new instance of Address.
Constructor Details
#initialize(attributes = {}) ⇒ Address
Returns a new instance of Address.
8 9 10 11 12 13 14 15 |
# File 'lib/iloxx_shipping/address.rb', line 8 def initialize(attributes = {}) attributes.each do |key, value| setter = :"#{key.to_s}=" if self.respond_to?(setter) self.send(setter, value) end end end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def company @company end |
#country_code ⇒ Object
Returns the value of attribute country_code.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def country_code @country_code end |
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def phone @phone end |
#sex ⇒ Object
Returns the value of attribute sex.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def sex @sex end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def street @street end |
#zip ⇒ Object
Returns the value of attribute zip.
4 5 6 |
# File 'lib/iloxx_shipping/address.rb', line 4 def zip @zip end |
Instance Method Details
#append_to_xml(xml) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/iloxx_shipping/address.rb', line 31 def append_to_xml(xml) xml.tns :ShipAddress do |xml| xml.tns :Company, company if company? xml.tns :SexCode, sex || :NoSexCode xml.tns :Name, name xml.tns :Street, street xml.tns :ZipCode, zip xml.tns :City, city xml.tns :State, state || "" xml.tns :Country, country_code xml.tns :Phone, phone || "" xml.tns :Mail, email || "" end end |
#company? ⇒ Boolean
17 18 19 |
# File 'lib/iloxx_shipping/address.rb', line 17 def company? !self.company.blank? end |