Class: Nexpose::Silo::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/silo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Address

Returns a new instance of Address.



158
159
160
# File 'lib/nexpose/silo.rb', line 158

def initialize(&block)
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



153
154
155
# File 'lib/nexpose/silo.rb', line 153

def city
  @city
end

#countryObject

Returns the value of attribute country.



156
157
158
# File 'lib/nexpose/silo.rb', line 156

def country
  @country
end

#line1Object

Returns the value of attribute line1.



151
152
153
# File 'lib/nexpose/silo.rb', line 151

def line1
  @line1
end

#line2Object

Returns the value of attribute line2.



152
153
154
# File 'lib/nexpose/silo.rb', line 152

def line2
  @line2
end

#stateObject

Returns the value of attribute state.



154
155
156
# File 'lib/nexpose/silo.rb', line 154

def state
  @state
end

#zipObject

Returns the value of attribute zip.



155
156
157
# File 'lib/nexpose/silo.rb', line 155

def zip
  @zip
end

Class Method Details

.parse(xml) ⇒ Object



162
163
164
165
166
167
168
169
170
171
# File 'lib/nexpose/silo.rb', line 162

def self.parse(xml)
  new do |address|
    address.line1   = xml.attributes['line1']
    address.line2   = xml.attributes['line2']
    address.city    = xml.attributes['city']
    address.state   = xml.attributes['state']
    address.zip     = xml.attributes['zip']
    address.country = xml.attributes['country']
  end
end

Instance Method Details

#as_xmlObject



173
174
175
176
177
# File 'lib/nexpose/silo.rb', line 173

def as_xml
  xml = REXML::Element.new('Address')
  xml.add_attributes({ 'city' => @city, 'country' => @country, 'line1' => @line1, 'line2' => @line2, 'state' => @state, 'zip' => @zip })
  xml
end