Class: Nexpose::ReportTemplateSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/report_template.rb

Overview

Data object for report template summary information. Not meant for use in creating new templates.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, type, scope, built_in, description) ⇒ ReportTemplateSummary

Returns a new instance of ReportTemplateSummary.



58
59
60
61
62
63
64
65
# File 'lib/nexpose/report_template.rb', line 58

def initialize(id, name, type, scope, built_in, description)
  @id = id
  @name = name
  @type = type
  @scope = scope
  @built_in = built_in
  @description = description
end

Instance Attribute Details

#built_inObject (readonly)

Whether the report template is built-in, and therefore cannot be modified.



54
55
56
# File 'lib/nexpose/report_template.rb', line 54

def built_in
  @built_in
end

#descriptionObject (readonly)

Description of the report template.



56
57
58
# File 'lib/nexpose/report_template.rb', line 56

def description
  @description
end

#idObject (readonly)

The ID of the report template.



43
44
45
# File 'lib/nexpose/report_template.rb', line 43

def id
  @id
end

#nameObject (readonly)

The name of the report template.



45
46
47
# File 'lib/nexpose/report_template.rb', line 45

def name
  @name
end

#scopeObject (readonly)

The visibility (scope) of the report template. One of: global|silo



52
53
54
# File 'lib/nexpose/report_template.rb', line 52

def scope
  @scope
end

#typeObject (readonly)

One of: data|document. With a data template, you can export comma-separated value (CSV) files with vulnerability-based data. With a document template, you can create PDF, RTF, HTML, or XML reports with asset-based information.



50
51
52
# File 'lib/nexpose/report_template.rb', line 50

def type
  @type
end

Class Method Details

.parse(xml) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'lib/nexpose/report_template.rb', line 71

def self.parse(xml)
  description = nil
  xml.elements.each('description') { |desc| description = desc.text }
  ReportTemplateSummary.new(xml.attributes['id'],
                            xml.attributes['name'],
                            xml.attributes['type'],
                            xml.attributes['scope'],
                            xml.attributes['builtin'] == '1',
                            description)
end

Instance Method Details

#delete(connection) ⇒ Object



67
68
69
# File 'lib/nexpose/report_template.rb', line 67

def delete(connection)
  connection.delete_report_template(@id)
end