Class: Nexpose::Organization

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Organization

Returns a new instance of Organization.



180
181
182
# File 'lib/nexpose/common.rb', line 180

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

Instance Attribute Details

#addressObject

Returns the value of attribute address.



174
175
176
# File 'lib/nexpose/common.rb', line 174

def address
  @address
end

#cityObject

Returns the value of attribute city.



176
177
178
# File 'lib/nexpose/common.rb', line 176

def city
  @city
end

#countryObject

Returns the value of attribute country.



178
179
180
# File 'lib/nexpose/common.rb', line 178

def country
  @country
end

#emailObject

Returns the value of attribute email.



172
173
174
# File 'lib/nexpose/common.rb', line 172

def email
  @email
end

#job_titleObject

Returns the value of attribute job_title.



171
172
173
# File 'lib/nexpose/common.rb', line 171

def job_title
  @job_title
end

#nameObject

Returns the value of attribute name.



168
169
170
# File 'lib/nexpose/common.rb', line 168

def name
  @name
end

#primary_contactObject

Returns the value of attribute primary_contact.



170
171
172
# File 'lib/nexpose/common.rb', line 170

def primary_contact
  @primary_contact
end

#stateObject

Returns the value of attribute state.



175
176
177
# File 'lib/nexpose/common.rb', line 175

def state
  @state
end

#telephoneObject

Returns the value of attribute telephone.



173
174
175
# File 'lib/nexpose/common.rb', line 173

def telephone
  @telephone
end

#urlObject

Returns the value of attribute url.



169
170
171
# File 'lib/nexpose/common.rb', line 169

def url
  @url
end

#zipObject

Returns the value of attribute zip.



177
178
179
# File 'lib/nexpose/common.rb', line 177

def zip
  @zip
end

Class Method Details

.parse(xml) ⇒ Object



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/nexpose/common.rb', line 184

def self.parse(xml)
  new do |org|
    org.name = xml.attributes['name']
    org.url = xml.attributes['url']
    org.primary_contact = xml.attributes['primaryContact']
    org.job_title = xml.attributes['jobTitle']
    org.email = xml.attributes['email']
    org.telephone = xml.attributes['telephone']
    org.address = xml.attributes['businessAddress']
    org.state = xml.attributes['state']
    org.city = xml.attributes['city']
    org.zip = xml.attributes['zip']
    org.country = xml.attributes['country']
  end
end

Instance Method Details

#as_xmlObject



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/nexpose/common.rb', line 200

def as_xml
  xml = REXML::Element.new('Organization')
  xml.add_attribute('name', @name)
  xml.add_attribute('url', @url)
  xml.add_attribute('primaryContact', @primary_contact)
  xml.add_attribute('jobTitle', @job_title)
  xml.add_attribute('email', @email)
  xml.add_attribute('telephone', @telephone)
  xml.add_attribute('businessAddress', @address)
  xml.add_attribute('state', @state)
  xml.add_attribute('city', @city)
  xml.add_attribute('zip', @zip)
  xml.add_attribute('country', @country)
  xml
end