class Nexpose::Silo::Organization

Attributes

address[RW]
company[RW]
email[RW]
first_name[RW]
last_name[RW]
phone[RW]
title[RW]
url[RW]

Public Class Methods

new(&block) click to toggle source
# File lib/nexpose/silo.rb, line 190
def initialize(&block)
  instance_eval(&block) if block_given?
end
parse(xml) click to toggle source
# File lib/nexpose/silo.rb, line 202
def self.parse(xml)
  new do |organization|
    organization.company    = xml.attributes['company']
    organization.first_name = xml.attributes['first-name']
    organization.last_name  = xml.attributes['last-name']
    organization.phone      = xml.attributes['phone-number']
    xml.elements.each('Address') do |address|
      organization.address = Address.parse(address)
    end
    organization.email = xml.attributes['email']
    organization.title = xml.attributes['title']
    organization.url   = xml.attributes['url']
  end
end

Public Instance Methods

as_xml() click to toggle source
# File lib/nexpose/silo.rb, line 194
def as_xml
  xml = REXML::Element.new('Organization')
  xml.add_attributes({ 'company' => @company, 'email-address' => @email, 'first-name' => @first_name,
                       'last-name' => @last_name, 'phone-number' => @phone, 'title' => @title, 'url' => @url })
  xml.add(@address.as_xml)
  xml
end