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.



160
161
162
# File 'lib/nexpose/silo.rb', line 160

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

Instance Attribute Details

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#line1Object

Returns the value of attribute line1.



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

def line1
  @line1
end

#line2Object

Returns the value of attribute line2.



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

def line2
  @line2
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#zipObject

Returns the value of attribute zip.



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

def zip
  @zip
end

Class Method Details

.parse(xml) ⇒ Object



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

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



175
176
177
178
179
# File 'lib/nexpose/silo.rb', line 175

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