2018-07-18 12:03:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-22 12:08:47 -05:00
|
|
|
module ProtectedBranches
|
|
|
|
class ApiService < BaseService
|
|
|
|
def create
|
2019-02-06 07:41:17 -05:00
|
|
|
::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute
|
|
|
|
end
|
2017-11-22 12:08:47 -05:00
|
|
|
|
2019-02-06 07:41:17 -05:00
|
|
|
def protected_branch_params
|
|
|
|
{
|
2017-11-22 12:08:47 -05:00
|
|
|
name: params[:name],
|
2019-02-06 07:41:17 -05:00
|
|
|
push_access_levels_attributes: AccessLevelParams.new(:push, params).access_levels,
|
|
|
|
merge_access_levels_attributes: AccessLevelParams.new(:merge, params).access_levels
|
2017-11-22 12:08:47 -05:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
ProtectedBranches::ApiService.prepend_if_ee('EE::ProtectedBranches::ApiService')
|