lib/gitlab/client/branches.rb in gitlab-4.7.0 vs lib/gitlab/client/branches.rb in gitlab-4.8.0

- old
+ new

@@ -92,7 +92,44 @@ # @param [String] branch The name of the branch to delete def delete_branch(project, branch) delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias repo_delete_branch delete_branch + + # Delete all branches that are merged into the project default branch. Protected branches will not be deleted as part of this operation. + # + # @example + # Gitlab.delete_merged_branches(3) + # + # @param [Integer, String] project The ID or name of a project. + # @return [nil] This API call returns an empty response body. + def delete_merged_branches(project) + delete("/projects/#{url_encode project}/repository/merged_branches") + end + alias repo_delete_merged_branches delete_merged_branches + + # Gets a list of protected branches from a project. + # + # @example + # Gitlab.protected_branches(42) + # + # @param [Integer, String] project The ID or name of a project. + # @return [Array<Gitlab::ObjectifiedHash>] + def protected_branches(project) + get("/projects/#{url_encode project}/protected_branches") + end + alias repo_protected_branches protected_branches + + # Gets a single protected branch or wildcard protected branch + # + # @example + # Gitlab.protected_branch(3, 'api') + # + # @param [Integer, String] project The ID or name of a project. + # @param [String] name The name of the branch or wildcard + # @return [Gitlab::ObjectifiedHash] + def protected_branch(project, branch) + get("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") + end + alias repo_protected_branch protected_branch end end