Class: Nexpose::ReportHistory

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

Overview

Description

Object that represents the schedule on which to automatically generate new reports.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, config_id) ⇒ ReportHistory

Returns a new instance of ReportHistory.



2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
# File 'lib/nexpose.rb', line 2254

def initialize(connection, config_id)

	@error = false
	@connection = connection
	@config_id = config_id
	@report_summaries = []

	reportHistory_request = APIRequest.new('<ReportHistoryRequest session-id="' + "#{connection.session_id}" + '" reportcfg-id="' + "#{@config_id}" + '"/>',@connection.geturl())
	reportHistory_request.execute()
	@response_xml = reportHistory_request.response_xml
	@request_xml = reportHistory_request.request_xml

end

Instance Attribute Details

#config_idObject (readonly)

The report definition (report config) ID Report definition ID



2249
2250
2251
# File 'lib/nexpose.rb', line 2249

def config_id
  @config_id
end

#connectionObject (readonly)

The NSC Connection associated with this object



2246
2247
2248
# File 'lib/nexpose.rb', line 2246

def connection
  @connection
end

#errorObject (readonly)

true if an error condition exists; false otherwise



2238
2239
2240
# File 'lib/nexpose.rb', line 2238

def error
  @error
end

#error_msgObject (readonly)

Error message string



2240
2241
2242
# File 'lib/nexpose.rb', line 2240

def error_msg
  @error_msg
end

#report_summariesObject (readonly)

Array (ReportSummary*)



2251
2252
2253
# File 'lib/nexpose.rb', line 2251

def report_summaries
  @report_summaries
end

#request_xmlObject (readonly)

The last XML request sent by this object



2242
2243
2244
# File 'lib/nexpose.rb', line 2242

def request_xml
  @request_xml
end

#response_xmlObject (readonly)

The last XML response received by this object



2244
2245
2246
# File 'lib/nexpose.rb', line 2244

def response_xml
  @response_xml
end

Instance Method Details

#xml_parse(response) ⇒ Object



2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
# File 'lib/nexpose.rb', line 2268

def xml_parse(response)
	response = REXML::Document.new(response.to_s)
	status =  response.root.attributes['success']
	if (status == '1')
		response.elements.each('ReportHistoryResponse/ReportSummary') do |r|
			@report_summaries.push(ReportSummary.new(r.attributes["id"], r.attributes["cfg-id"], r.attributes["status"], r.attributes["generated-on"],r.attributes['report-uri']))
		end
	else
		@error = true
		@error_msg = 'Error ReportHistoryReponse'
	end
end