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.
471 472 473 474 475 |
# File 'lib/nexpose/report.rb', line 471 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.
469 470 471 |
# File 'lib/nexpose/report.rb', line 469 def email @email end |
#location ⇒ Object
Directory location to store report in (for non-default storage).
467 468 469 |
# File 'lib/nexpose/report.rb', line 467 def location @location end |
#store_on_server ⇒ Object
Whether to store report on server.
465 466 467 |
# File 'lib/nexpose/report.rb', line 465 def store_on_server @store_on_server end |
Class Method Details
.parse(xml) ⇒ Object
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/nexpose/report.rb', line 486 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
477 478 479 480 481 482 483 484 |
# File 'lib/nexpose/report.rb', line 477 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 |