Class: Nexpose::Organization
- Defined in:
- lib/nexpose/common.rb
Overview
Organization configuration, as used in Site and Silo.
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#name ⇒ Object
Returns the value of attribute name.
-
#primary_contact ⇒ Object
Returns the value of attribute primary_contact.
-
#state ⇒ Object
Returns the value of attribute state.
-
#telephone ⇒ Object
Returns the value of attribute telephone.
-
#url ⇒ Object
Returns the value of attribute url.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
-
.create(hash) ⇒ Object
Create organization object from hash.
- .parse(xml) ⇒ Object
Instance Method Summary collapse
- #as_xml ⇒ Object
-
#initialize(&block) ⇒ Organization
constructor
A new instance of Organization.
- #to_h ⇒ Object
Methods inherited from APIObject
Constructor Details
#initialize(&block) ⇒ Organization
Returns a new instance of Organization.
318 319 320 |
# File 'lib/nexpose/common.rb', line 318 def initialize(&block) instance_eval(&block) if block_given? end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
312 313 314 |
# File 'lib/nexpose/common.rb', line 312 def address @address end |
#city ⇒ Object
Returns the value of attribute city.
314 315 316 |
# File 'lib/nexpose/common.rb', line 314 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
316 317 318 |
# File 'lib/nexpose/common.rb', line 316 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
310 311 312 |
# File 'lib/nexpose/common.rb', line 310 def email @email end |
#job_title ⇒ Object
Returns the value of attribute job_title.
309 310 311 |
# File 'lib/nexpose/common.rb', line 309 def job_title @job_title end |
#name ⇒ Object
Returns the value of attribute name.
306 307 308 |
# File 'lib/nexpose/common.rb', line 306 def name @name end |
#primary_contact ⇒ Object
Returns the value of attribute primary_contact.
308 309 310 |
# File 'lib/nexpose/common.rb', line 308 def primary_contact @primary_contact end |
#state ⇒ Object
Returns the value of attribute state.
313 314 315 |
# File 'lib/nexpose/common.rb', line 313 def state @state end |
#telephone ⇒ Object
Returns the value of attribute telephone.
311 312 313 |
# File 'lib/nexpose/common.rb', line 311 def telephone @telephone end |
#url ⇒ Object
Returns the value of attribute url.
307 308 309 |
# File 'lib/nexpose/common.rb', line 307 def url @url end |
#zip ⇒ Object
Returns the value of attribute zip.
315 316 317 |
# File 'lib/nexpose/common.rb', line 315 def zip @zip end |
Class Method Details
.create(hash) ⇒ Object
Create organization object from hash
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/nexpose/common.rb', line 338 def self.create(hash) new do |org| org.name = hash[:name] org.url = hash[:url] org.primary_contact = hash[:primary_contact] org.job_title = hash[:job_title] org.email = hash[:email] org.telephone = hash[:telephone] org.address = hash[:address] org.state = hash[:state] org.city = hash[:city] org.zip = hash[:zip] org.country = hash[:country] end end |
.parse(xml) ⇒ Object
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
# File 'lib/nexpose/common.rb', line 354 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_xml ⇒ Object
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/nexpose/common.rb', line 370 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 |
#to_h ⇒ Object
322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/nexpose/common.rb', line 322 def to_h { name: name, url: url, primary_contact: primary_contact, job_title: job_title, email: email, telephone: telephone, address: address, state: state, city: city, zip: zip, country: country } end |