Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
715eaed6
Commit
715eaed6
authored
Sep 30, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor API: project hooks
parent
73f780d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
lib/api/project_hooks.rb
lib/api/project_hooks.rb
+1
-5
No files found.
lib/api/project_hooks.rb
View file @
715eaed6
...
@@ -2,6 +2,7 @@ module API
...
@@ -2,6 +2,7 @@ module API
# Projects API
# Projects API
class
ProjectHooks
<
Grape
::
API
class
ProjectHooks
<
Grape
::
API
before
{
authenticate!
}
before
{
authenticate!
}
before
{
authorize_admin_project
}
resource
:projects
do
resource
:projects
do
helpers
do
helpers
do
...
@@ -20,7 +21,6 @@ module API
...
@@ -20,7 +21,6 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/hooks
# GET /projects/:id/hooks
get
":id/hooks"
do
get
":id/hooks"
do
authorize!
:admin_project
,
user_project
@hooks
=
paginate
user_project
.
hooks
@hooks
=
paginate
user_project
.
hooks
present
@hooks
,
with:
Entities
::
Hook
present
@hooks
,
with:
Entities
::
Hook
end
end
...
@@ -33,7 +33,6 @@ module API
...
@@ -33,7 +33,6 @@ module API
# Example Request:
# Example Request:
# GET /projects/:id/hooks/:hook_id
# GET /projects/:id/hooks/:hook_id
get
":id/hooks/:hook_id"
do
get
":id/hooks/:hook_id"
do
authorize!
:admin_project
,
user_project
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
present
@hook
,
with:
Entities
::
Hook
present
@hook
,
with:
Entities
::
Hook
end
end
...
@@ -47,7 +46,6 @@ module API
...
@@ -47,7 +46,6 @@ module API
# Example Request:
# Example Request:
# POST /projects/:id/hooks
# POST /projects/:id/hooks
post
":id/hooks"
do
post
":id/hooks"
do
authorize!
:admin_project
,
user_project
required_attributes!
[
:url
]
required_attributes!
[
:url
]
@hook
=
user_project
.
hooks
.
new
({
"url"
=>
params
[
:url
]})
@hook
=
user_project
.
hooks
.
new
({
"url"
=>
params
[
:url
]})
...
@@ -71,7 +69,6 @@ module API
...
@@ -71,7 +69,6 @@ module API
# PUT /projects/:id/hooks/:hook_id
# PUT /projects/:id/hooks/:hook_id
put
":id/hooks/:hook_id"
do
put
":id/hooks/:hook_id"
do
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
@hook
=
user_project
.
hooks
.
find
(
params
[
:hook_id
])
authorize!
:admin_project
,
user_project
required_attributes!
[
:url
]
required_attributes!
[
:url
]
attrs
=
attributes_for_keys
[
:url
]
attrs
=
attributes_for_keys
[
:url
]
...
@@ -93,7 +90,6 @@ module API
...
@@ -93,7 +90,6 @@ module API
# Example Request:
# Example Request:
# DELETE /projects/:id/hooks/:hook_id
# DELETE /projects/:id/hooks/:hook_id
delete
":id/hooks/:hook_id"
do
delete
":id/hooks/:hook_id"
do
authorize!
:admin_project
,
user_project
required_attributes!
[
:hook_id
]
required_attributes!
[
:hook_id
]
begin
begin
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment