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.
190 191 192 |
# File 'lib/nexpose/silo.rb', line 190 def initialize(&block) instance_eval(&block) if block_given? end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
185 186 187 |
# File 'lib/nexpose/silo.rb', line 185 def address @address end |
#company ⇒ Object
Returns the value of attribute company.
181 182 183 |
# File 'lib/nexpose/silo.rb', line 181 def company @company end |
#email ⇒ Object
Returns the value of attribute email.
186 187 188 |
# File 'lib/nexpose/silo.rb', line 186 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
182 183 184 |
# File 'lib/nexpose/silo.rb', line 182 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
183 184 185 |
# File 'lib/nexpose/silo.rb', line 183 def last_name @last_name end |
#phone ⇒ Object
Returns the value of attribute phone.
184 185 186 |
# File 'lib/nexpose/silo.rb', line 184 def phone @phone end |
#title ⇒ Object
Returns the value of attribute title.
187 188 189 |
# File 'lib/nexpose/silo.rb', line 187 def title @title end |
#url ⇒ Object
Returns the value of attribute url.
188 189 190 |
# File 'lib/nexpose/silo.rb', line 188 def url @url end |
Class Method Details
.parse(xml) ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# 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 |
Instance Method Details
#as_xml ⇒ Object
194 195 196 197 198 199 200 |
# 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 |