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.



2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
# File 'lib/nexpose.rb', line 2032

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



2027
2028
2029
# File 'lib/nexpose.rb', line 2027

def config_id
  @config_id
end

#connectionObject (readonly)

The NSC Connection associated with this object



2024
2025
2026
# File 'lib/nexpose.rb', line 2024

def connection
  @connection
end

#errorObject (readonly)

true if an error condition exists; false otherwise



2016
2017
2018
# File 'lib/nexpose.rb', line 2016

def error
  @error
end

#error_msgObject (readonly)

Error message string



2018
2019
2020
# File 'lib/nexpose.rb', line 2018

def error_msg
  @error_msg
end

#report_summariesObject (readonly)

Array (ReportSummary*)



2029
2030
2031
# File 'lib/nexpose.rb', line 2029

def report_summaries
  @report_summaries
end

#request_xmlObject (readonly)

The last XML request sent by this object



2020
2021
2022
# File 'lib/nexpose.rb', line 2020

def request_xml
  @request_xml
end

#response_xmlObject (readonly)

The last XML response received by this object



2022
2023
2024
# File 'lib/nexpose.rb', line 2022

def response_xml
  @response_xml
end

Instance Method Details

#xml_parse(response) ⇒ Object



2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
# File 'lib/nexpose.rb', line 2046

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