diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-03 16:05:40 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-03 16:05:40 +0000 |
commit | d8153e31257c7a0ddc6123cc1a7d893a16e1b87a (patch) | |
tree | 0cefd42a039c646b930655742f57f627e7d112c0 /lib | |
parent | d54f3a10efa7f40b4368cb19fe32c98804d6c0bd (diff) | |
parent | 37f229c7358a48c6a9af3481927e9e4faee17e3d (diff) | |
download | gitlab-ce-d8153e31257c7a0ddc6123cc1a7d893a16e1b87a.tar.gz |
Merge branch 'zj-expose-system-hooks' into 'master'
Expose more info for SystemHooks
See merge request !6964
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 7 | ||||
-rw-r--r-- | lib/api/system_hooks.rb | 9 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ab9d2d54f4b..d52496451a2 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -43,14 +43,13 @@ module API end class Hook < Grape::Entity - expose :id, :url, :created_at + expose :id, :url, :created_at, :push_events, :tag_push_events + expose :enable_ssl_verification end class ProjectHook < Hook - expose :project_id, :push_events - expose :issues_events, :merge_requests_events, :tag_push_events + expose :project_id, :issues_events, :merge_requests_events expose :note_events, :build_events, :pipeline_events, :wiki_page_events - expose :enable_ssl_verification end class BasicProjectDetails < Grape::Entity diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb index 794e34874f4..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 @@ -19,10 +20,14 @@ module API success Entities::Hook end params do - requires :url, type: String, desc: 'The URL for the system hook' + requires :url, type: String, desc: "The URL to send the request to" + optional :token, type: String, desc: 'The token used to validate payloads' + optional :push_events, type: Boolean, desc: "Trigger hook on push events" + optional :tag_push_events, type: Boolean, desc: "Trigger hook on tag push events" + optional :enable_ssl_verification, type: Boolean, desc: "Do SSL verification when triggering the hook" end post do - hook = SystemHook.new declared(params).to_h + hook = SystemHook.new declared(params, include_missing: false).to_h if hook.save present hook, with: Entities::Hook |