summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjozefvaclavik <jozef.vaclavik@bro-coders.com>2012-10-12 10:30:09 +0300
committerjozefvaclavik <jozef.vaclavik@bro-coders.com>2012-10-12 10:30:09 +0300
commitd1a18d038d12198c433a8d90a14ca6365ece33b4 (patch)
tree2fff48bcaad59508657a29d9b530e0a20bc8c949 /lib
parentbaf94bd732e0e5802a888d95d943c948b7a9e65b (diff)
downloadgitlab-ce-d1a18d038d12198c433a8d90a14ca6365ece33b4.tar.gz
Update lib/api/projects.rb
Added methods for listing one project hook and editing hooks. GET /project/:id/hooks/:hook_id PUT /project/:id/hooks/:hook_id
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 0f013883c81..8f094e0c723 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -147,6 +147,19 @@ module Gitlab
@hooks = paginate user_project.hooks
present @hooks, with: Entities::Hook
end
+
+ # Get a project hook
+ #
+ # Parameters:
+ # id (required) - The ID or code name of a project
+ # hook_id (required) - The ID of a project hook
+ # Example Request:
+ # GET /projects/:id/hooks/:hook_id
+ get ":id/hooks/:hook_id" do
+ @hook = user_project.hooks.find(params[:hook_id])
+ present @hook, with: Entities::Hook
+ end
+
# Add hook to project
#
@@ -164,6 +177,27 @@ module Gitlab
error!({'message' => '404 Not found'}, 404)
end
end
+
+ # Update an existing project hook
+ #
+ # Parameters:
+ # id (required) - The ID or code name of a project
+ # hook_id (required) - The ID of a project hook
+ # url (required) - The hook URL
+ # Example Request:
+ # PUT /projects/:id/hooks/:hook_id
+ put ":id/hooks/:hook_id" do
+ @hook = user_project.hooks.find(params[:hook_id])
+ authorize! :admin_project, user_project
+
+ attrs = attributes_for_keys [:url]
+
+ if @hook.update_attributes attrs
+ present @hook, with: Entities::Hook
+ else
+ not_found!
+ end
+ end
# Delete project hook
#