Sha256: a56f7feb4f56613b9bf73aabf6c21215712f5d51f8dd93c459fde1912ccfb818

Contents?: true

Size: 1.99 KB

Versions: 9

Compression:

Stored size: 1.99 KB

Contents

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

module Contrast
  module Agent
    module Reporting
      # This class will hold the mode state in which the reporter will send
      # event ot TS.
      class ResponseHandlerMode
        # Reader for the running mode type.
        #
        # @return [Symbol] Reporter's client and Response Handler are running
        # and responses are being processed.
        attr_reader :running
        # Reader for the disabled mode type.
        #
        # @return [Symbol] Reporter's client and Response Handler are disabled
        # due to received Error. The Reporting is disabled for this application.
        attr_reader :disabled
        # Reader for the resending/retry mode type.
        #
        # @return [Symbol] Reporter's client and Response Handler are suspended
        # for a TS received amount of time and will try to resend the previous
        # request after that.
        attr_reader :resending
        # Reader for all supported modes.
        #
        # @return [Array<Symbol>] Reporter's client and Response Handler all
        # available modes of operation.
        attr_reader :modes

        def initialize
          @running = :running
          @disabled = :disabled
          @resending = :resending
          @modes = [@running, @disabled, @resending].cs__freeze
        end

        # Current mode.
        #
        # @return [Symbol] Reporter's client and Response Handler
        # current mode of operation.
        def status
          @_status ||= running
        end

        # Set current mode.
        #
        # @return [Symbol] Reporter's client and Response Handler
        # current mode of operation.
        def status= mode
          @_status = mode if mode.cs__is_a?(Symbol) && modes.include?(mode)
        end

        # Reset mode
        #
        def reset_mode
          @_status = running
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
contrast-agent-7.1.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-7.0.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.15.3 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.15.2 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.15.1 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.15.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.14.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.13.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb
contrast-agent-6.12.0 lib/contrast/agent/reporting/reporting_utilities/response_handler_mode.rb