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.



1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
# File 'lib/nexpose.rb', line 1906

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



1901
1902
1903
# File 'lib/nexpose.rb', line 1901

def config_id
  @config_id
end

#connectionObject (readonly)

The NSC Connection associated with this object



1898
1899
1900
# File 'lib/nexpose.rb', line 1898

def connection
  @connection
end

#errorObject (readonly)

true if an error condition exists; false otherwise



1890
1891
1892
# File 'lib/nexpose.rb', line 1890

def error
  @error
end

#error_msgObject (readonly)

Error message string



1892
1893
1894
# File 'lib/nexpose.rb', line 1892

def error_msg
  @error_msg
end

#report_summariesObject (readonly)

Array (ReportSummary*)



1903
1904
1905
# File 'lib/nexpose.rb', line 1903

def report_summaries
  @report_summaries
end

#request_xmlObject (readonly)

The last XML request sent by this object



1894
1895
1896
# File 'lib/nexpose.rb', line 1894

def request_xml
  @request_xml
end

#response_xmlObject (readonly)

The last XML response received by this object



1896
1897
1898
# File 'lib/nexpose.rb', line 1896

def response_xml
  @response_xml
end

Instance Method Details

#xml_parse(response) ⇒ Object



1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
# File 'lib/nexpose.rb', line 1920

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