Class: MML::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/mml/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Address

Returns a new instance of Address.



123
124
125
126
127
# File 'lib/mml/common.rb', line 123

def initialize(args = {})
  %W(repCode addressClass tableId full homeNumber town city prefecture zip countryCode).each do |item|
    self.send("#{item}=", args[item.to_sym])
  end
end

Instance Attribute Details

#addressClassObject

Returns the value of attribute addressClass.



121
122
123
# File 'lib/mml/common.rb', line 121

def addressClass
  @addressClass
end

#cityObject

Returns the value of attribute city.



121
122
123
# File 'lib/mml/common.rb', line 121

def city
  @city
end

#countryCodeObject

Returns the value of attribute countryCode.



121
122
123
# File 'lib/mml/common.rb', line 121

def countryCode
  @countryCode
end

#fullObject

Returns the value of attribute full.



121
122
123
# File 'lib/mml/common.rb', line 121

def full
  @full
end

#homeNumberObject

Returns the value of attribute homeNumber.



121
122
123
# File 'lib/mml/common.rb', line 121

def homeNumber
  @homeNumber
end

#prefectureObject

Returns the value of attribute prefecture.



121
122
123
# File 'lib/mml/common.rb', line 121

def prefecture
  @prefecture
end

#repCodeObject

Returns the value of attribute repCode.



120
121
122
# File 'lib/mml/common.rb', line 120

def repCode
  @repCode
end

#tableIdObject

Returns the value of attribute tableId.



121
122
123
# File 'lib/mml/common.rb', line 121

def tableId
  @tableId
end

#townObject

Returns the value of attribute town.



121
122
123
# File 'lib/mml/common.rb', line 121

def town
  @town
end

#zipObject

Returns the value of attribute zip.



121
122
123
# File 'lib/mml/common.rb', line 121

def zip
  @zip
end

Instance Method Details

#to_xmlObject



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/mml/common.rb', line 134

def to_xml
  xb = Builder::XmlMarkup.new
  attributes = { 'mmlAd:repCode' => repCode }
  attributes['mmlAd:addressClass'] = addressClass
  attributes['mmlAd:tableId'] = tableId
  xb.mmlAd :Address, attributes do
    xb.mmlAd :homeNumber, homeNumber if homeNumber
    xb.mmlAd :town, town if town
    xb.mmlAd :city, city if city
    xb.mmlAd :prefecture, prefecture if prefecture
    xb.mmlAd :full, full if full
    xb.mmlAd :zip, zip if zip
    xb.mmlAd :countryCode, countryCode if countryCode
  end
end