Skip to content
Snippets Groups Projects
Commit 13280d8b authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Wes Gurney
Browse files

Refactor API: project hooks

parent c00cd658
No related branches found
No related tags found
1 merge request!4954Add support to configure webhook_timeout in gitlab.yaml
This commit is part of merge request !4954. Comments created here will be created in the context of that merge request.
Loading
Loading
@@ -2,6 +2,7 @@ module API
# Projects API
class ProjectHooks < Grape::API
before { authenticate! }
before { authorize_admin_project }
 
resource :projects do
helpers do
Loading
Loading
@@ -20,7 +21,6 @@ module API
# Example Request:
# GET /projects/:id/hooks
get ":id/hooks" do
authorize! :admin_project, user_project
@hooks = paginate user_project.hooks
present @hooks, with: Entities::Hook
end
Loading
Loading
@@ -33,7 +33,6 @@ module API
# Example Request:
# GET /projects/:id/hooks/:hook_id
get ":id/hooks/:hook_id" do
authorize! :admin_project, user_project
@hook = user_project.hooks.find(params[:hook_id])
present @hook, with: Entities::Hook
end
Loading
Loading
@@ -47,7 +46,6 @@ module API
# Example Request:
# POST /projects/:id/hooks
post ":id/hooks" do
authorize! :admin_project, user_project
required_attributes! [:url]
 
@hook = user_project.hooks.new({"url" => params[:url]})
Loading
Loading
@@ -71,7 +69,6 @@ module API
# 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
required_attributes! [:url]
 
attrs = attributes_for_keys [:url]
Loading
Loading
@@ -93,7 +90,6 @@ module API
# Example Request:
# DELETE /projects/:id/hooks/:hook_id
delete ":id/hooks/:hook_id" do
authorize! :admin_project, user_project
required_attributes! [:hook_id]
 
begin
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment