From c85c146aa2042710caddc6666ce8f9e07b2fe5ca Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sun, 23 Oct 2016 09:46:39 +0200 Subject: Add support for token attr in project hooks API The UI allows to define a token to validate payload on the target URL, this patch adds the feature to the API. --- lib/api/entities.rb | 2 +- lib/api/project_hooks.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/api') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ab9d2d54f4b..94586040fa4 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -50,7 +50,7 @@ module API expose :project_id, :push_events expose :issues_events, :merge_requests_events, :tag_push_events expose :note_events, :build_events, :pipeline_events, :wiki_page_events - expose :enable_ssl_verification + expose :enable_ssl_verification, :token end class BasicProjectDetails < Grape::Entity diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index 14f5be3b5f6..dd93a85dc54 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -47,7 +47,8 @@ module API :build_events, :pipeline_events, :wiki_page_events, - :enable_ssl_verification + :enable_ssl_verification, + :token ] @hook = user_project.hooks.new(attrs) @@ -82,7 +83,8 @@ module API :build_events, :pipeline_events, :wiki_page_events, - :enable_ssl_verification + :enable_ssl_verification, + :token ] if @hook.update_attributes attrs -- cgit v1.2.3 From f77be11cb9caa62cdd4690a53c73b6d34e102148 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Tue, 1 Nov 2016 11:40:06 +0000 Subject: Ensure hook tokens are write-only in the API --- lib/api/entities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/api') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 94586040fa4..ab9d2d54f4b 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -50,7 +50,7 @@ module API expose :project_id, :push_events expose :issues_events, :merge_requests_events, :tag_push_events expose :note_events, :build_events, :pipeline_events, :wiki_page_events - expose :enable_ssl_verification, :token + expose :enable_ssl_verification end class BasicProjectDetails < Grape::Entity -- cgit v1.2.3