From bd049e5e7c80259689eb4494a3e7eea4bd5a66b0 Mon Sep 17 00:00:00 2001 From: Valeriy Sizov Date: Sun, 21 Oct 2012 14:00:27 +0300 Subject: [PATCH] API:merge request show && list --- lib/api.rb | 1 + lib/api/entities.rb | 6 ++++++ lib/api/merge_requests.rb | 31 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 lib/api/merge_requests.rb diff --git a/lib/api.rb b/lib/api.rb index 2890a8cc..7a184544 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -18,5 +18,6 @@ module Gitlab mount Issues mount Milestones mount Session + mount MergeRequests end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ee693de6..8c405f29 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -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 diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb new file mode 100644 index 00000000..12c9647b --- /dev/null +++ b/lib/api/merge_requests.rb @@ -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