<commit_before>module Nexpose
	module NexposeAPI
		include XMLUtils

		#
		#
		#
		def report_generate(param)
			r = execute(make_xml('ReportGenerateRequest', {'report-id' => param}))
			r.success
		end

		#
		#
		#
		def report_last(param)
			r = execute(make_xml('ReportHistoryRequest', {'reportcfg-id' => param}))
			res = nil
			if (r.success)
				stk = []
				r.res.elements.each("//ReportSummary") do |rep|
					stk << [rep.attributes['id'].to_i, rep.attributes['report-URI']]
				end
				if (stk.length > 0)
					stk.sort! { |a, b| b[0] <=> a[0] }
					res = stk[0][1]
				end
			end
			res
		end

		#
		#
		#
		def report_history(param)
			execute(make_xml('ReportHistoryRequest', {'reportcfg-id' => param}))
		end

		#
		#
		#
		def report_config_delete(param)
			r = execute(make_xml('ReportDeleteRequest', {'reportcfg-id' => param}))
			r.success
		end

		#
		#
		#
		def report_delete(param)
			r = execute(make_xml('ReportDeleteRequest', {'report-id' => param}))
			r.success
		end

		#
		#
		#
		def report_template_listing
			r = execute(make_xml('ReportTemplateListingRequest', {}))

			if (r.success)
				res = []
				r.res.elements.each("//ReportTemplateSummary") do |template|
					desc = ''
					template.elements.each("//description") do |ent|
						desc = ent.text
					end

					res << {
						:template_id => template.attributes['id'].to_s,
						:name => template.attributes['name'].to_s,
						:description => desc.to_s
					}
				end
				res
			else
				false
			end
		end
	end

	# === Description
	# Object that represents the summary of a Report Configuration.
	#
	class ReportConfigSummary
		# The Report Configuration ID
		attr_reader :id
		# A unique name for the Report
		attr_reader :name
		# The report format
		attr_reader :format
		# The date of the last report generation
		attr_reader :last_generated_on
		# Relative URI of the last generated report
		attr_reader :last_generated_uri

		# Constructor
		# ReportConfigSummary(id, name, format, last_generated_on, last_generated_uri)
		def initialize(id, name, format, last_generated_on, last_generated_uri)

			@id = id
			@name = name
			@format = format
			@last_generated_on = last_generated_on
			@last_generated_uri = last_generated_uri

		end
	end

	# === Description
	# Object that represents the schedule on which to automatically generate new reports.
	class ReportHistory

		# true if an error condition exists; false otherwise
		attr_reader :error
		# Error message string
		attr_reader :error_msg
		# The last XML request sent by this object
		attr_reader :request_xml
		# The last XML response received by this object
		attr_reader :response_xml
		# The NSC Connection associated with this object
		attr_reader :connection
		# The report definition (report config) ID
		# Report definition ID
		attr_reader :config_id
		# Array (ReportSummary*)
		attr_reader :report_summaries


		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.get)
			reportHistory_request.execute()
			@response_xml = reportHistory_request.response_xml
			@request_xml = reportHistory_request.request_xml

		end<commit_msg>changed to right accessor - woops<commit_after>module Nexpose
	module NexposeAPI
		include XMLUtils

		#
		#
		#
		def report_generate(param)
			r = execute(make_xml('ReportGenerateRequest', {'report-id' => param}))
			r.success
		end

		#
		#
		#
		def report_last(param)
			r = execute(make_xml('ReportHistoryRequest', {'reportcfg-id' => param}))
			res = nil
			if (r.success)
				stk = []
				r.res.elements.each("//ReportSummary") do |rep|
					stk << [rep.attributes['id'].to_i, rep.attributes['report-URI']]
				end
				if (stk.length > 0)
					stk.sort! { |a, b| b[0] <=> a[0] }
					res = stk[0][1]
				end
			end
			res
		end

		#
		#
		#
		def report_history(param)
			execute(make_xml('ReportHistoryRequest', {'reportcfg-id' => param}))
		end

		#
		#
		#
		def report_config_delete(param)
			r = execute(make_xml('ReportDeleteRequest', {'reportcfg-id' => param}))
			r.success
		end

		#
		#
		#
		def report_delete(param)
			r = execute(make_xml('ReportDeleteRequest', {'report-id' => param}))
			r.success
		end

		#
		#
		#
		def report_template_listing
			r = execute(make_xml('ReportTemplateListingRequest', {}))

			if (r.success)
				res = []
				r.res.elements.each("//ReportTemplateSummary") do |template|
					desc = ''
					template.elements.each("//description") do |ent|
						desc = ent.text
					end

					res << {
						:template_id => template.attributes['id'].to_s,
						:name => template.attributes['name'].to_s,
						:description => desc.to_s
					}
				end
				res
			else
				false
			end
		end
	end

	# === Description
	# Object that represents the summary of a Report Configuration.
	#
	class ReportConfigSummary
		# The Report Configuration ID
		attr_reader :id
		# A unique name for the Report
		attr_reader :name
		# The report format
		attr_reader :format
		# The date of the last report generation
		attr_reader :last_generated_on
		# Relative URI of the last generated report
		attr_reader :last_generated_uri

		# Constructor
		# ReportConfigSummary(id, name, format, last_generated_on, last_generated_uri)
		def initialize(id, name, format, last_generated_on, last_generated_uri)

			@id = id
			@name = name
			@format = format
			@last_generated_on = last_generated_on
			@last_generated_uri = last_generated_uri

		end
	end

	# === Description
	# Object that represents the schedule on which to automatically generate new reports.
	class ReportHistory

		# true if an error condition exists; false otherwise
		attr_reader :error
		# Error message string
		attr_reader :error_msg
		# The last XML request sent by this object
		attr_reader :request_xml
		# The last XML response received by this object
		attr_reader :response_xml
		# The NSC Connection associated with this object
		attr_reader :connection
		# The report definition (report config) ID
		# Report definition ID
		attr_reader :config_id
		# Array (ReportSummary*)
		attr_reader :report_summaries


		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.url)
			reportHistory_request.execute()
			@response_xml = reportHistory_request.response_xml
			@request_xml = reportHistory_request.request_xml

		end
{'fraction_non_alphanumeric': 0.10901249256395003, 'fraction_numerical': 0.00148720999405116, 'mean_word_length': 3.46843853820598, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 24}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4187952', 'n_tokens_mistral': 2584, 'n_tokens_neox': 2129, 'n_words': 541}