Class: Nexpose::Silo::Organization
- Inherits:
-
Object
- Object
- Nexpose::Silo::Organization
- Defined in:
- lib/nexpose/silo.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#company ⇒ Object
Returns the value of attribute company.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #as_xml ⇒ Object
-
#initialize(&block) ⇒ Organization
constructor
A new instance of Organization.
Constructor Details
#initialize(&block) ⇒ Organization
Returns a new instance of Organization.
192 193 194 |
# File 'lib/nexpose/silo.rb', line 192 def initialize(&block) instance_eval &block if block_given? end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
187 188 189 |
# File 'lib/nexpose/silo.rb', line 187 def address @address end |
#company ⇒ Object
Returns the value of attribute company.
183 184 185 |
# File 'lib/nexpose/silo.rb', line 183 def company @company end |
#email ⇒ Object
Returns the value of attribute email.
188 189 190 |
# File 'lib/nexpose/silo.rb', line 188 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
184 185 186 |
# File 'lib/nexpose/silo.rb', line 184 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
185 186 187 |
# File 'lib/nexpose/silo.rb', line 185 def last_name @last_name end |
#phone ⇒ Object
Returns the value of attribute phone.
186 187 188 |
# File 'lib/nexpose/silo.rb', line 186 def phone @phone end |
#title ⇒ Object
Returns the value of attribute title.
189 190 191 |
# File 'lib/nexpose/silo.rb', line 189 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
190 191 192 |
# File 'lib/nexpose/silo.rb', line 190 def url @url end |
Class Method Details
.parse(xml) ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/nexpose/silo.rb', line 203 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 |
Instance Method Details
#as_xml ⇒ Object
196 197 198 199 200 201 |
# File 'lib/nexpose/silo.rb', line 196 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 |