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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
882029d9
Commit
882029d9
authored
Dec 04, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose ProjectHook attributes via API
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
fff69bdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
lib/api/entities.rb
lib/api/entities.rb
+4
-0
lib/api/project_hooks.rb
lib/api/project_hooks.rb
+4
-4
No files found.
lib/api/entities.rb
View file @
882029d9
...
...
@@ -24,6 +24,10 @@ module API
expose
:id
,
:url
,
:created_at
end
class
ProjectHook
<
Hook
expose
:project_id
,
:push_events
,
:issues_events
,
:merge_requests_events
end
class
ForkedFromProject
<
Grape
::
Entity
expose
:id
expose
:name
,
:name_with_namespace
...
...
lib/api/project_hooks.rb
View file @
882029d9
...
...
@@ -22,7 +22,7 @@ module API
# GET /projects/:id/hooks
get
":id/hooks"
do
@hooks
=
paginate
user_project
.
hooks
present
@hooks
,
with:
Entities
::
Hook
present
@hooks
,
with:
Entities
::
Project
Hook
end
# Get a project hook
...
...
@@ -34,7 +34,7 @@ module API
# 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
present
@hook
,
with:
Entities
::
Project
Hook
end
...
...
@@ -50,7 +50,7 @@ module API
@hook
=
user_project
.
hooks
.
new
({
"url"
=>
params
[
:url
]})
if
@hook
.
save
present
@hook
,
with:
Entities
::
Hook
present
@hook
,
with:
Entities
::
Project
Hook
else
if
@hook
.
errors
[
:url
].
present?
error!
(
"Invalid url given"
,
422
)
...
...
@@ -73,7 +73,7 @@ module API
attrs
=
attributes_for_keys
[
:url
]
if
@hook
.
update_attributes
attrs
present
@hook
,
with:
Entities
::
Hook
present
@hook
,
with:
Entities
::
Project
Hook
else
if
@hook
.
errors
[
:url
].
present?
error!
(
"Invalid url given"
,
422
)
...
...
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