gitlab-org--gitlab-foss/lib/api/v3/system_hooks.rb

33 lines
766 B
Ruby
Raw Normal View History

2017-02-06 13:38:17 -05:00
module API
module V3
class SystemHooks < Grape::API
before do
authenticate!
authenticated_as_admin!
end
resource :hooks do
desc 'Get the list of system hooks' do
success ::API::Entities::Hook
end
get do
present SystemHook.all, with: ::API::Entities::Hook
end
2017-02-20 14:32:44 -05:00
desc 'Delete a hook' do
success ::API::Entities::Hook
end
params do
requires :id, type: Integer, desc: 'The ID of the system hook'
end
delete ":id" do
hook = SystemHook.find_by(id: params[:id])
not_found!('System hook') unless hook
present hook.destroy, with: ::API::Entities::Hook
end
2017-02-06 13:38:17 -05:00
end
end
end
end