summaryrefslogtreecommitdiff
path: root/app/services/protected_branches/api_service.rb
blob: 1b13dace5f29e8a861ab5a7999110bf704e2ffbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module ProtectedBranches
  class ApiService < BaseService
    def create
      ::ProtectedBranches::CreateService.new(@project, @current_user, protected_branch_params).execute
    end

    def protected_branch_params
      {
        name: params[:name],
        push_access_levels_attributes: AccessLevelParams.new(:push, params).access_levels,
        merge_access_levels_attributes: AccessLevelParams.new(:merge, params).access_levels
      }
    end
  end
end