Sha256: e03a23ee29fad0b1d430c15fb448e38bd0623e21374850151181927a483e0e5b

Contents?: true

Size: 1.26 KB

Versions: 16

Compression:

Stored size: 1.26 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/settings/exclusion_base'
require 'contrast/utils/object_share'

module Contrast
  module Agent
    module Reporting
      module Settings
        # UrlExclusions class
        class UrlExclusion < ExclusionBase
          ATTRIBUTES = BASE_ATTRIBUTES.dup << :urls
          ATTRIBUTES << :match_strategy
          ATTRIBUTES.cs__freeze
          STRATEGIES = %w[ALL ONLY].cs__freeze

          # @return urls [Array<String>]
          attr_accessor :urls

          # @return match_strategy [String] The type of the input
          def match_strategy
            @_match_strategy ||= Contrast::Utils::ObjectShare::EMPTY_STRING
          end

          # @param new_strategy [String] Set new input type.
          # @return type [String] The type of the input.
          def match_strategy= new_strategy
            @_match_strategy = new_strategy if STRATEGIES.include?(new_strategy)
          end

          def to_controlled_hash
            hash = super
            hash[:urls] = urls
            hash[:matchStrategy] = match_strategy
            hash
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
contrast-agent-6.11.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.10.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.9.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.8.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.7.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.5 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.4 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.3 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.2 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.1 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.6.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.5.1 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.5.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.4.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.3.0 lib/contrast/agent/reporting/settings/url_exclusion.rb
contrast-agent-6.2.0 lib/contrast/agent/reporting/settings/url_exclusion.rb