lib/gitlab/client/branches.rb in gitlab-4.2.0 vs lib/gitlab/client/branches.rb in gitlab-4.3.0

- old
+ new

@@ -25,11 +25,11 @@ # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch. # @return [Gitlab::ObjectifiedHash] def branch(project, branch) - get("/projects/#{url_encode project}/repository/branches/#{branch}") + get("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias_method :repo_branch, :branch # Protects a repository branch. # @@ -45,11 +45,11 @@ # @param [Hash] options A customizable set of options. # @option options [Boolean] :developers_can_push True to allow developers to push to the branch (default = false) # @option options [Boolean] :developers_can_merge True to allow developers to merge into the branch (default = false) # @return [Gitlab::ObjectifiedHash] Details about the branch def protect_branch(project, branch, options = {}) - put("/projects/#{url_encode project}/repository/branches/#{branch}/protect", body: options) + post("/projects/#{url_encode project}/protected_branches", body: {name: branch}.merge(options)) end alias_method :repo_protect_branch, :protect_branch # Unprotects a repository branch. # @@ -59,11 +59,11 @@ # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch. # @return [Gitlab::ObjectifiedHash] Details about the branch def unprotect_branch(project, branch) - put("/projects/#{url_encode project}/repository/branches/#{branch}/unprotect") + delete("/projects/#{url_encode project}/protected_branches/#{url_encode branch}") end alias_method :repo_unprotect_branch, :unprotect_branch # Creates a repository branch. Requires Gitlab >= 6.8.x # @@ -87,10 +87,10 @@ # Gitlab.repo_delete_branch(5, 'master') # # @param [Integer, String] project The ID or name of a project. # @param [String] branch The name of the branch to delete def delete_branch(project, branch) - delete("/projects/#{url_encode project}/repository/branches/#{branch}") + delete("/projects/#{url_encode project}/repository/branches/#{url_encode branch}") end alias_method :repo_delete_branch, :delete_branch end end