summaryrefslogtreecommitdiff
path: root/lib/api/branches.rb
diff options
context:
space:
mode:
authorCiro Santilli <ciro.santilli@gmail.com>2014-09-21 10:29:52 +0200
committerCiro Santilli <ciro.santilli@gmail.com>2014-09-21 11:43:05 +0200
commitad47993ac46cef672600f2384ee5fa2e661ec8be (patch)
tree07769b4efeb4c18762b3ed0e705179a5423926c1 /lib/api/branches.rb
parentfda61a047ffb9b04bc4dd38e897088fde17fb3c1 (diff)
downloadgitlab-ce-ad47993ac46cef672600f2384ee5fa2e661ec8be.tar.gz
Factor error and success methods from services.
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r--lib/api/branches.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb
index 4db5f61dd28..75783628e3d 100644
--- a/lib/api/branches.rb
+++ b/lib/api/branches.rb
@@ -80,10 +80,8 @@ module API
# POST /projects/:id/repository/branches
post ":id/repository/branches" do
authorize_push_project
- result = CreateBranchService.new.execute(user_project,
- params[:branch_name],
- params[:ref],
- current_user)
+ result = CreateBranchService.new(user_project, current_user).
+ execute(params[:branch_name], params[:ref])
if result[:status] == :success
present result[:branch],
with: Entities::RepoObject,
@@ -102,9 +100,10 @@ module API
# DELETE /projects/:id/repository/branches/:branch
delete ":id/repository/branches/:branch" do
authorize_push_project
- result = DeleteBranchService.new.execute(user_project, params[:branch], current_user)
+ result = DeleteBranchService.new(user_project, current_user).
+ execute(params[:branch])
- if result[:state] == :success
+ if result[:status] == :success
true
else
render_api_error!(result[:message], result[:return_code])