Class: Nexpose::Delivery
- Inherits:
-
Object
- Object
- Nexpose::Delivery
- Defined in:
- lib/nexpose/report.rb
Overview
Data object for configuration of where a report is stored or delivered.
Instance Attribute Summary collapse
-
#email ⇒ Object
E-mail configuration.
-
#location ⇒ Object
Directory location to store report in (for non-default storage).
-
#store_on_server ⇒ Object
Whether to store report on server.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(store_on_server, location = nil, email = nil) ⇒ Delivery
constructor
A new instance of Delivery.
- #to_xml ⇒ Object
Constructor Details
#initialize(store_on_server, location = nil, email = nil) ⇒ Delivery
Returns a new instance of Delivery.
484 485 486 487 488 |
# File 'lib/nexpose/report.rb', line 484 def initialize(store_on_server, location = nil, email = nil) @store_on_server = store_on_server @location = location @email = email end |
Instance Attribute Details
#email ⇒ Object
E-mail configuration.
482 483 484 |
# File 'lib/nexpose/report.rb', line 482 def email @email end |
#location ⇒ Object
Directory location to store report in (for non-default storage).
480 481 482 |
# File 'lib/nexpose/report.rb', line 480 def location @location end |
#store_on_server ⇒ Object
Whether to store report on server.
478 479 480 |
# File 'lib/nexpose/report.rb', line 478 def store_on_server @store_on_server end |
Class Method Details
.parse(xml) ⇒ Object
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/nexpose/report.rb', line 499 def self.parse(xml) xml.elements.each('//Delivery') do on_server = false location = nil xml.elements.each('//Storage') do |storage| on_server = true if storage.attributes['storeOnServer'] == '1' xml.elements.each('//location') do |loc| location = loc.text end end email = Email.parse(xml) return Delivery.new(on_server, location, email) end nil end |
Instance Method Details
#to_xml ⇒ Object
490 491 492 493 494 495 496 497 |
# File 'lib/nexpose/report.rb', line 490 def to_xml xml = '<Delivery>' xml << %Q{<Storage storeOnServer='#{@store_on_server ? 1 : 0}'>} xml << %Q{<location>#{@location}</location>} if @location xml << '</Storage>' xml << @email.to_xml if @email xml << '</Delivery>' end |