summaryrefslogtreecommitdiff
path: root/app/services/protected_branches/api_service.rb
blob: 4b40200644b32ac65c9c6bfb48319c347223ed33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module ProtectedBranches
  class ApiService < BaseService
    def create
      @push_params = AccessLevelParams.new(:push, params)
      @merge_params = AccessLevelParams.new(:merge, params)

      verify_params!

      protected_branch_params = {
        name: params[:name],
        push_access_levels_attributes: @push_params.access_levels,
        merge_access_levels_attributes: @merge_params.access_levels
      }

      ::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute
    end

    private

    def verify_params!
      # EE-only
    end
  end
end