diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-10-19 17:08:30 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2016-11-02 15:14:12 +0300 |
commit | 57fd233a557158dbaa1a227f7c549fbe6a45e799 (patch) | |
tree | 6b6b6fb091ba260807246c85f51b9e91213b4fce | |
parent | a4827ee2b9a5dd51356a4e11455c0075fe6cea69 (diff) |
Update docs and unexpose token
-rw-r--r-- | doc/api/system_hooks.md | 30 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/system_hooks.rb | 1 | ||||
-rw-r--r-- | spec/requests/api/system_hooks_spec.rb | 1 |
4 files changed, 22 insertions, 12 deletions
diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index 073e99b7147..569831af540 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -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 + } ] ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index c6c7747d022..47a5874ae75 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -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 diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb index ca95c044ecc..32f731c5652 100644 --- a/lib/api/system_hooks.rb +++ b/lib/api/system_hooks.rb @@ -12,6 +12,7 @@ module API end get do hooks = SystemHook.all + present hooks, with: Entities::Hook end diff --git a/spec/requests/api/system_hooks_spec.rb b/spec/requests/api/system_hooks_spec.rb index cdf0874dbdc..55567941e08 100644 --- a/spec/requests/api/system_hooks_spec.rb +++ b/spec/requests/api/system_hooks_spec.rb @@ -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) |