API: create merge request

This commit is contained in:
Valeriy Sizov 2012-10-21 14:41:06 +03:00
parent bd049e5e7c
commit fe59547ae5

View file

@ -18,7 +18,17 @@ module Gitlab
#create merge_request #create merge_request
post ":id/merge_requests" do post ":id/merge_requests" do
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title]
project = current_user.projects.find(params[:id])
merge_request = project.merge_requests.new(attrs)
merge_request.author = current_user
if merge_request.save
merge_request.reload_code
present merge_request, with: Entities::MergeRequest
else
not_found!
end
end end
#update merge_request #update merge_request