summaryrefslogtreecommitdiff
path: root/lib/api/branches.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-07-19 13:30:23 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2016-07-19 13:41:32 +0200
commit3413f6fa50ec4275fac99b59d3fa44608141149c (patch)
tree221bf6a36f64d564a942f96ad7f4d0c68ea358c1 /lib/api/branches.rb
parent1cd573ee7f03bcb356478aab5900fae4618b53ec (diff)
downloadgitlab-ce-3413f6fa50ec4275fac99b59d3fa44608141149c.tar.gz
Simplify entities for branches and tags APIapi-cleanup-entities
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r--lib/api/branches.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 35efe4f2e4a..66b853eb342 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -15,7 +15,8 @@ module API
# GET /projects/:id/repository/branches
get ":id/repository/branches" do
branches = user_project.repository.branches.sort_by(&:name)
- present branches, with: Entities::RepoObject, project: user_project
+
+ present branches, with: Entities::RepoBranch, project: user_project
end
# Get a single branch
@@ -28,7 +29,8 @@ module API
get ':id/repository/branches/:branch', requirements: { branch: /.+/ } do
@branch = user_project.repository.branches.find { |item| item.name == params[:branch] }
not_found!("Branch") unless @branch
- present @branch, with: Entities::RepoObject, project: user_project
+
+ present @branch, with: Entities::RepoBranch, project: user_project
end
# Protect a single branch
@@ -60,7 +62,7 @@ module API
developers_can_merge: developers_can_merge || false)
end
- present @branch, with: Entities::RepoObject, project: user_project
+ present @branch, with: Entities::RepoBranch, project: user_project
end
# Unprotect a single branch
@@ -79,7 +81,7 @@ module API
protected_branch = user_project.protected_branches.find_by(name: @branch.name)
protected_branch.destroy if protected_branch
- present @branch, with: Entities::RepoObject, project: user_project
+ present @branch, with: Entities::RepoBranch, project: user_project
end
# Create branch
@@ -97,7 +99,7 @@ module API
if result[:status] == :success
present result[:branch],
- with: Entities::RepoObject,
+ with: Entities::RepoBranch,
project: user_project
else
render_api_error!(result[:message], 400)