Class: Nexpose::ReportSummary

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

Overview

Summary of a single report.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, config_id, status, generated_on, uri) ⇒ ReportSummary

Returns a new instance of ReportSummary.



140
141
142
143
144
145
146
# File 'lib/nexpose/report.rb', line 140

def initialize(id, config_id, status, generated_on, uri)
  @id = id
  @config_id = config_id.to_i
  @status = status
  @generated_on = generated_on
  @uri = uri
end

Instance Attribute Details

#config_idObject (readonly)

The report definition (configuration) ID.



131
132
133
# File 'lib/nexpose/report.rb', line 131

def config_id
  @config_id
end

#generated_onObject (readonly)

The date and time the report was generated, in ISO 8601 format.



136
137
138
# File 'lib/nexpose/report.rb', line 136

def generated_on
  @generated_on
end

#idObject (readonly)

The ID of the generated report.



129
130
131
# File 'lib/nexpose/report.rb', line 129

def id
  @id
end

#statusObject (readonly)

The current status of the report. One of: Started|Generated|Failed|Aborted|Unknown



134
135
136
# File 'lib/nexpose/report.rb', line 134

def status
  @status
end

#uriObject (readonly)

The relative URI to use to access the report.



138
139
140
# File 'lib/nexpose/report.rb', line 138

def uri
  @uri
end

Class Method Details

.parse(xml) ⇒ Object



153
154
155
156
157
158
159
# File 'lib/nexpose/report.rb', line 153

def self.parse(xml)
  ReportSummary.new(xml.attributes['id'],
                    xml.attributes['cfg-id'],
                    xml.attributes['status'],
                    xml.attributes['generated-on'],
                    xml.attributes['report-URI'])
end

.parse_all(response) ⇒ Object



161
162
163
164
165
166
167
168
169
# File 'lib/nexpose/report.rb', line 161

def self.parse_all(response)
  summaries = []
  if response.success
    response.res.elements.each('//ReportSummary') do |summary|
      summaries << ReportSummary.parse(summary)
    end
  end
  summaries
end

Instance Method Details

#delete(connection) ⇒ Object

Delete this report.



149
150
151
# File 'lib/nexpose/report.rb', line 149

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