Module: API::Helpers::VariablesHelpers

Extended by:
ActiveSupport::Concern, Grape::API::Helpers
Defined in:
lib/api/helpers/variables_helpers.rb

Instance Method Summary collapse

Instance Method Details

#filter_variable_parameters(_, params) ⇒ Object


12
13
14
# File 'lib/api/helpers/variables_helpers.rb', line 12

def filter_variable_parameters(_, params)
  params # Overridden in EE
end

#find_variable(owner, params) ⇒ Object


16
17
18
19
20
21
22
# File 'lib/api/helpers/variables_helpers.rb', line 16

def find_variable(owner, params)
  variables = ::Ci::VariablesFinder.new(owner, params).execute.to_a

  return variables.first unless variables.many? # rubocop: disable CodeReuse/ActiveRecord

  conflict!("There are multiple variables with provided parameters. Please use 'filter[environment_scope]'")
end