Class: Gitlab::Triage::LimiterValidator

Inherits:
ParamsValidator show all
Defined in:
lib/gitlab/triage/validators/limiter_validator.rb

Constant Summary

Constants inherited from ParamsValidator

ParamsValidator::InvalidParameter

Instance Method Summary collapse

Methods inherited from ParamsValidator

#initialize, #validate!, #validate_parameter_content, #validate_parameter_types

Constructor Details

This class inherits a constructor from Gitlab::Triage::ParamsValidator

Instance Method Details

#params_limiter_namesObject (private)



8
9
10
11
12
# File 'lib/gitlab/triage/validators/limiter_validator.rb', line 8

def params_limiter_names
  @parameter_definitions.map do |param|
    param[:name]
  end
end

#validate_required_parameters(value) ⇒ Object (private)

Raises:

  • (ArgumentError)


14
15
16
17
18
# File 'lib/gitlab/triage/validators/limiter_validator.rb', line 14

def validate_required_parameters(value)
  return if value.keys.one? { |key| params_limiter_names.include?(key.to_sym) }

  raise ArgumentError, "For the limits field, please specify one of: `#{params_limiter_names.join('`, `')}`"
end