lib/contrast/agent/reporting/reporting_events/architecture_component.rb in contrast-agent-6.11.0 vs lib/contrast/agent/reporting/reporting_events/architecture_component.rb in contrast-agent-6.12.0

- old
+ new

@@ -1,9 +1,9 @@ -# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. +# Copyright (c) 2023 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details. # frozen_string_literal: true -require 'contrast/components/logger' +require 'contrast/agent/reporting/reporting_events/reportable_hash' module Contrast module Agent module Reporting # This is the new Architecture Component class which will include all the needed information for the new @@ -14,12 +14,11 @@ # @attr_reader remote_host [String] the host section of the connection to the component. # @attr_reader remote_port [Integer] the port section of the connection to the component. # @attr_reader type [String] the type of the component. Only ::VALID_TYPES can be used. Required for reporting. # @attr_reader url [String] the url used to connect to the component. Required for reporting. # @attr_reader vendor [String] the publisher of the component, like MySQL. - class ArchitectureComponent - include Contrast::Components::Logger::InstanceMethods + class ArchitectureComponent < Contrast::Agent::Reporting::ReportableHash # required attributes attr_accessor :type, :url # optional attributes attr_accessor :remote_host, :remote_port, :vendor @@ -40,15 +39,10 @@ # TeamServer to process the JSON form of this message. # # @return [Hash] # @raise [ArgumentError] def to_controlled_hash - begin - validate - rescue ArgumentError => e - logger.error('ArchitectureComponent validation failed with: ', e) - return - end + validate { remoteHost: remote_host, remotePort: remote_port, type: type, url: url,