diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-20 20:32:44 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2017-02-28 08:32:39 +0100 |
commit | c280acb00b3d4f3e071bfd36eecc8fffcebc2bb2 (patch) | |
tree | f806ba67c4c22945d8a9e6a66c108d3d37e9bd65 /lib/api/v3/triggers.rb | |
parent | f2dd2604134ac62301db765ff0b14ff692e21bd6 (diff) | |
download | gitlab-ce-c280acb00b3d4f3e071bfd36eecc8fffcebc2bb2.tar.gz |
Backport API to V3
Diffstat (limited to 'lib/api/v3/triggers.rb')
-rw-r--r-- | lib/api/v3/triggers.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/api/v3/triggers.rb b/lib/api/v3/triggers.rb new file mode 100644 index 00000000000..4051d4bca8d --- /dev/null +++ b/lib/api/v3/triggers.rb @@ -0,0 +1,30 @@ +module API + module V3 + class Triggers < Grape::API + include PaginationParams + + params do + requires :id, type: String, desc: 'The ID of a project' + end + resource :projects do + desc 'Delete a trigger' do + success ::API::Entities::Trigger + end + params do + requires :token, type: String, desc: 'The unique token of trigger' + end + delete ':id/triggers/:token' do + authenticate! + authorize! :admin_build, user_project + + trigger = user_project.triggers.find_by(token: params[:token].to_s) + return not_found!('Trigger') unless trigger + + trigger.destroy + + present trigger, with: ::API::Entities::Trigger + end + end + end + end +end |