API:merge request show && list

This commit is contained in:
Valeriy Sizov 2012-10-21 14:00:27 +03:00
parent 42abdf69d5
commit bd049e5e7c
3 changed files with 38 additions and 0 deletions

View file

@ -18,5 +18,6 @@ module Gitlab
mount Issues
mount Milestones
mount Session
mount MergeRequests
end
end

View file

@ -63,5 +63,11 @@ module Gitlab
class SSHKey < Grape::Entity
expose :id, :title, :key
end
class MergeRequest < Grape::Entity
expose :id, :target_branch, :source_branch, :project_id,
:title, :closed, :merged
expose :author, :assignee, using: Entities::UserBasic
end
end
end

31
lib/api/merge_requests.rb Normal file
View file

@ -0,0 +1,31 @@
module Gitlab
# Issues API
class MergeRequests < Grape::API
before { authenticate! }
resource :projects do
#list
get ":id/merge_requests" do
project = current_user.projects.find(params[:id])
present project.merge_requests, with: Entities::MergeRequest
end
#show
get ":id/merge_request/:merge_request_id" do
project = current_user.projects.find(params[:id])
present project.merge_requests.find(params[:merge_request_id]), with: Entities::MergeRequest
end
#create merge_request
post ":id/merge_requests" do
end
#update merge_request
put ":id/merge_request/:merge_request_id" do
end
end
end
end