Sha256: 0650ce5a4a35585e56f625236f8db55460710f708a8a5f02a099a0afcddd7dbd

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

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

module Contrast
  module Api
    module Decorators
      # Used to decorate the {Contrast::Api::Dtm::RaspRuleSample} protobuf
      # model.
      module RaspRuleSample
        def self.included klass
          klass.extend(ClassMethods)
        end

        # Used to add class methods to RaspRuleSample
        module ClassMethods
          def build context, ia_result
            sample = new
            sample.timestamp_ms = context.timer.start_ms
            sample.user_input = Contrast::Api::Dtm::UserInput.build_from_ia_result(ia_result)
            sample.user_input.document_type = Contrast::Utils::StringUtils.force_utf8(context.request.document_type)
            sample
          end
        end
      end
    end
  end
end

Contrast::Api::Dtm::RaspRuleSample.include(Contrast::Api::Decorators::RaspRuleSample)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
contrast-agent-5.1.0 lib/contrast/api/decorators/rasp_rule_sample.rb
contrast-agent-5.0.0 lib/contrast/api/decorators/rasp_rule_sample.rb