Sha256: 3d4c5291f2ebdca9c9176accdbf66dfa57700e000be8120ee28ba0e18c749ec1

Contents?: true

Size: 767 Bytes

Versions: 5

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

module Gitlab
  module Triage
    module APIQueryBuilders
      class BaseQueryParamBuilder
        attr_reader :param_name, :param_contents, :allowed_values

        def initialize(param_name, param_contents, allowed_values: nil)
          @param_name = param_name
          @param_contents = param_contents
          @allowed_values = allowed_values

          validate_allowed_values! if allowed_values
        end

        def build_param
          "&#{param_name}=#{param_content.strip}"
        end

        private

        def validate_allowed_values!
          ParamsValidator.new([{ name: param_name, type: String, values: allowed_values }], { param_name => param_contents }).validate!
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gitlab-triage-1.44.1 lib/gitlab/triage/api_query_builders/base_query_param_builder.rb
gitlab-triage-1.44.0 lib/gitlab/triage/api_query_builders/base_query_param_builder.rb
gitlab-triage-1.43.2 lib/gitlab/triage/api_query_builders/base_query_param_builder.rb
gitlab-triage-1.43.1 lib/gitlab/triage/api_query_builders/base_query_param_builder.rb
gitlab-triage-1.43.0 lib/gitlab/triage/api_query_builders/base_query_param_builder.rb