Sha256: 9b484428d4a06b5d9d36a811914b192c09a26cef88aab65a9a6a5ac1d016b730

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/components/logger'
require 'contrast/utils/assess/trigger_method_utils'
require 'contrast/agent/reporting/reporting_utilities/endpoints'

module Contrast
  module Agent
    module Reporting
      # This is the new ReportingEvent class which will include all the needed and mutual information for the new
      # reporting system.
      #
      # @abstract
      # @attr_reader routes [Array]
      # @attr_reader event_method [Symbol] the HTTP method to use to send this event
      class ReportingEvent
        attr_reader :event_endpoint, :event_method

        def initialize
          @agent_session_id_value = 0 # TODO: RUBY-99999 Contrast::APP_CONTEXT.session_id once we have app start
          @event_endpoint ||= nil
          @event_method ||= :POST
        end

        # Some reports require specific additional headers to be used. To that end, we'll attach them here, letting
        # each handle their own.
        #
        # @param _request [Net::HTTPRequest]
        def attach_headers _request; end

        # Convert the instance variables on the class, and other information, into the identifiers required for
        # TeamServer to process the JSON form of this message.
        #
        # @return [Hash]
        # @raise [ArgumentError]
        def to_controlled_hash
          validate
          {}
        end

        # @raise [ArgumentError]
        def validate; end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-5.1.0 lib/contrast/agent/reporting/reporting_events/reporting_event.rb
contrast-agent-5.0.0 lib/contrast/agent/reporting/reporting_events/reporting_event.rb