Commit d1a18d03 authored by jozefvaclavik's avatar jozefvaclavik

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
parent baf94bd7
......@@ -148,6 +148,19 @@ module Gitlab
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
#
# Parameters:
......@@ -165,6 +178,27 @@ module Gitlab
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
#
# Parameters:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment