Class: Nexpose::DBExport
- Inherits:
-
Object
- Object
- Nexpose::DBExport
- Defined in:
- lib/nexpose/report.rb
Overview
Configuration structure for database exporting of reports.
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Credentials needed to export to the specified database.
-
#parameters ⇒ Object
Map of parameters for this DB export configuration.
-
#type ⇒ Object
The DB type to export to.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type) ⇒ DBExport
constructor
A new instance of DBExport.
- #to_xml ⇒ Object
Constructor Details
#initialize(type) ⇒ DBExport
Returns a new instance of DBExport.
538 539 540 541 |
# File 'lib/nexpose/report.rb', line 538 def initialize(type) @type = type @parameters = {} end |
Instance Attribute Details
#credentials ⇒ Object
Credentials needed to export to the specified database.
534 535 536 |
# File 'lib/nexpose/report.rb', line 534 def credentials @credentials end |
#parameters ⇒ Object
Map of parameters for this DB export configuration.
536 537 538 |
# File 'lib/nexpose/report.rb', line 536 def parameters @parameters end |
#type ⇒ Object
The DB type to export to.
532 533 534 |
# File 'lib/nexpose/report.rb', line 532 def type @type end |
Class Method Details
.parse(xml) ⇒ Object
552 553 554 555 556 557 558 559 560 561 562 |
# File 'lib/nexpose/report.rb', line 552 def self.parse(xml) xml.elements.each('//DBExport') do |dbexport| config = DBExport.new(dbexport.attributes['type']) config.credentials = ExportCredential.parse(xml) xml.elements.each('//param') do |param| config.parameters[param.attributes['name']] = param.text end return config end nil end |
Instance Method Details
#to_xml ⇒ Object
543 544 545 546 547 548 549 550 |
# File 'lib/nexpose/report.rb', line 543 def to_xml xml = %(<DBExport type='#{@type}'>) xml << @credentials.to_xml if @credentials @parameters.each_pair do |name, value| xml << %(<param name='#{name}'>#{value}</param>) end xml << '</DBExport>' end |