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.



2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
# File 'lib/nexpose.rb', line 2383

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)

Report definition ID



2378
2379
2380
# File 'lib/nexpose.rb', line 2378

def config_id
  @config_id
end

#connectionObject (readonly)

The NSC Connection associated with this object



2375
2376
2377
# File 'lib/nexpose.rb', line 2375

def connection
  @connection
end

#errorObject (readonly)

true if an error condition exists; false otherwise



2367
2368
2369
# File 'lib/nexpose.rb', line 2367

def error
  @error
end

#error_msgObject (readonly)

Error message string



2369
2370
2371
# File 'lib/nexpose.rb', line 2369

def error_msg
  @error_msg
end

#report_summariesObject (readonly)

Array (ReportSummary*)



2380
2381
2382
# File 'lib/nexpose.rb', line 2380

def report_summaries
  @report_summaries
end

#request_xmlObject (readonly)

The last XML request sent by this object



2371
2372
2373
# File 'lib/nexpose.rb', line 2371

def request_xml
  @request_xml
end

#response_xmlObject (readonly)

The last XML response received by this object



2373
2374
2375
# File 'lib/nexpose.rb', line 2373

def response_xml
  @response_xml
end

Instance Method Details

#xml_parse(response) ⇒ Object



2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
# File 'lib/nexpose.rb', line 2397

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