Class: Ci::ChangeVariableService

Inherits:
BaseContainerService show all
Defined in:
app/services/ci/change_variable_service.rb

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #initialize, #namespace_container?, #project_container?, #project_group

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from BaseContainerService

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/ci/change_variable_service.rb', line 5

def execute
  case params[:action]
  when :create
    container.variables.create(params[:variable_params])
  when :update
    variable.tap do |target_variable|
      target_variable.update(params[:variable_params].except(:key))
    end
  when :destroy
    variable.tap do |target_variable|
      target_variable.destroy
    end
  end
end