Sha256: c688b6a204a88d0a44d033c6eb2aa3cf6f2b663e3ccdf7eee30417f96f200d91

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 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/agent/reporting/reporting_events/reporting_event'

module Contrast
  module Agent
    module Reporting
      # This is the new Preflight class which will include all the needed information for the new reporting system
      # to report a Preflight message to TeamServer. This message represents the identifying information of a
      # collection of Findings/Traces, which TeamServer will use to determine if it requires the full information of
      # any of the Findings/Traces to be reported.
      #
      # For our purposes, we'll only ever send one message per request; however, we must use an array to conform to the
      # specification.
      #
      # @attr_reader messages [Array<Contrast::Agent::Reporting::PreflightMessage>]
      class Preflight < Contrast::Agent::Reporting::ReportingEvent
        attr_reader :messages

        def initialize
          @event_method = :PUT
          @event_endpoint = "#{ Contrast::API.api_url }/api/ng/preflight/"
          @messages = []
          super
        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
          { messages: @messages }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contrast-agent-6.0.0 lib/contrast/agent/reporting/reporting_events/preflight.rb
contrast-agent-5.3.0 lib/contrast/agent/reporting/reporting_events/preflight.rb
contrast-agent-5.2.0 lib/contrast/agent/reporting/reporting_events/preflight.rb
contrast-agent-5.1.0 lib/contrast/agent/reporting/reporting_events/preflight.rb
contrast-agent-5.0.0 lib/contrast/agent/reporting/reporting_events/preflight.rb