class Nexpose::Organization

Organization configuration, as used in Site and Silo.

Attributes

address[RW]
city[RW]
country[RW]
email[RW]
job_title[RW]
name[RW]
primary_contact[RW]
state[RW]
telephone[RW]
url[RW]
zip[RW]

Public Class Methods

create(hash) click to toggle source

Create organization object from hash

# File lib/nexpose/common.rb, line 340
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
new(&block) click to toggle source
# File lib/nexpose/common.rb, line 321
def initialize(&block)
  instance_eval(&block) if block_given?
end
parse(xml) click to toggle source
# File lib/nexpose/common.rb, line 356
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

Public Instance Methods

as_xml() click to toggle source
# File lib/nexpose/common.rb, line 372
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() click to toggle source
# File lib/nexpose/common.rb, line 325
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