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
Boxiang Sun
gitlab-ce
Commits
57fd233a
Commit
57fd233a
authored
Oct 19, 2016
by
Zeger-Jan van de Weg
Committed by
Z.J. van de Weg
Nov 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs and unexpose token
parent
a4827ee2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
12 deletions
+22
-12
doc/api/system_hooks.md
doc/api/system_hooks.md
+20
-10
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/system_hooks.rb
lib/api/system_hooks.rb
+1
-0
spec/requests/api/system_hooks_spec.rb
spec/requests/api/system_hooks_spec.rb
+0
-1
No files found.
doc/api/system_hooks.md
View file @
57fd233a
...
@@ -27,11 +27,14 @@ Example response:
...
@@ -27,11 +27,14 @@ Example response:
```
json
```
json
[
[
{
{
"id"
:
1
,
"id"
:
1
,
"url"
:
"https://gitlab.example.com/hook"
,
"url"
:
"https://gitlab.example.com/hook"
,
"created_at"
:
"2015-11-04T20:07:35.874Z"
"created_at"
:
"2016-10-31T12:32:15.192Z"
,
}
"push_events"
:
true
,
"tag_push_events"
:
false
,
"enable_ssl_verification"
:
true
}
]
]
```
```
...
@@ -48,6 +51,10 @@ POST /hooks
...
@@ -48,6 +51,10 @@ POST /hooks
| Attribute | Type | Required | Description |
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| --------- | ---- | -------- | ----------- |
|
`url`
| string | yes | The hook URL |
|
`url`
| string | yes | The hook URL |
| token | string | no | The token to validate payloads |
| push_events | boolean | no | When true, the hook will fire on push events |
| tag_push_events | boolean | no | When true, the hook will fire on new tags being pushed |
| enable_ssl_verification | boolean | no | Do SSL verification when triggering the hook |
Example request:
Example request:
...
@@ -59,11 +66,14 @@ Example response:
...
@@ -59,11 +66,14 @@ Example response:
```
json
```
json
[
[
{
{
"id"
:
2
,
"id"
:
1
,
"url"
:
"https://gitlab.example.com/hook"
,
"url"
:
"https://gitlab.example.com/hook"
,
"created_at"
:
"2015-11-04T20:07:35.874Z"
"created_at"
:
"2016-10-31T12:32:15.192Z"
,
}
"push_events"
:
true
,
"tag_push_events"
:
false
,
"enable_ssl_verification"
:
true
}
]
]
```
```
...
...
lib/api/entities.rb
View file @
57fd233a
...
@@ -44,7 +44,7 @@ module API
...
@@ -44,7 +44,7 @@ module API
class
Hook
<
Grape
::
Entity
class
Hook
<
Grape
::
Entity
expose
:id
,
:url
,
:created_at
,
:push_events
,
:tag_push_events
expose
:id
,
:url
,
:created_at
,
:push_events
,
:tag_push_events
expose
:enable_ssl_verification
,
:token
expose
:enable_ssl_verification
end
end
class
ProjectHook
<
Hook
class
ProjectHook
<
Hook
...
...
lib/api/system_hooks.rb
View file @
57fd233a
...
@@ -12,6 +12,7 @@ module API
...
@@ -12,6 +12,7 @@ module API
end
end
get
do
get
do
hooks
=
SystemHook
.
all
hooks
=
SystemHook
.
all
present
hooks
,
with:
Entities
::
Hook
present
hooks
,
with:
Entities
::
Hook
end
end
...
...
spec/requests/api/system_hooks_spec.rb
View file @
57fd233a
...
@@ -30,7 +30,6 @@ describe API::API, api: true do
...
@@ -30,7 +30,6 @@ describe API::API, api: true do
it
"returns an array of hooks"
do
it
"returns an array of hooks"
do
get
api
(
"/hooks"
,
admin
)
get
api
(
"/hooks"
,
admin
)
byebug
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'url'
]).
to
eq
(
hook
.
url
)
expect
(
json_response
.
first
[
'url'
]).
to
eq
(
hook
.
url
)
...
...
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