Update docs and unexpose token
This commit is contained in:
parent
a4827ee2b9
commit
57fd233a55
4 changed files with 22 additions and 12 deletions
|
@ -27,11 +27,14 @@ Example response:
|
|||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id" : 1,
|
||||
"url" : "https://gitlab.example.com/hook",
|
||||
"created_at" : "2015-11-04T20:07:35.874Z"
|
||||
}
|
||||
{
|
||||
"id":1,
|
||||
"url":"https://gitlab.example.com/hook",
|
||||
"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
|
|||
| Attribute | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `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:
|
||||
|
||||
|
@ -59,11 +66,14 @@ Example response:
|
|||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id" : 2,
|
||||
"url" : "https://gitlab.example.com/hook",
|
||||
"created_at" : "2015-11-04T20:07:35.874Z"
|
||||
}
|
||||
{
|
||||
"id":1,
|
||||
"url":"https://gitlab.example.com/hook",
|
||||
"created_at":"2016-10-31T12:32:15.192Z",
|
||||
"push_events":true,
|
||||
"tag_push_events":false,
|
||||
"enable_ssl_verification":true
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ module API
|
|||
|
||||
class Hook < Grape::Entity
|
||||
expose :id, :url, :created_at, :push_events, :tag_push_events
|
||||
expose :enable_ssl_verification, :token
|
||||
expose :enable_ssl_verification
|
||||
end
|
||||
|
||||
class ProjectHook < Hook
|
||||
|
|
|
@ -12,6 +12,7 @@ module API
|
|||
end
|
||||
get do
|
||||
hooks = SystemHook.all
|
||||
|
||||
present hooks, with: Entities::Hook
|
||||
end
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ describe API::API, api: true do
|
|||
it "returns an array of hooks" do
|
||||
get api("/hooks", admin)
|
||||
|
||||
byebug
|
||||
expect(response).to have_http_status(200)
|
||||
expect(json_response).to be_an Array
|
||||
expect(json_response.first['url']).to eq(hook.url)
|
||||
|
|
Loading…
Reference in a new issue