From 2c5bcf2e1b5b5574238555657296a8831b989d1e Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 23 Mar 2016 22:36:35 +0100 Subject: Add endpoints for archiving and unarchiving --- lib/api/projects.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib/api') diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 6fcb5261e40..aa60a39f341 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -244,6 +244,34 @@ module API end end + # Archive project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # PUT /projects/:id/archive + put ':id/archive' do + authorize!(:archive_project, user_project) + + user_project.archive! + + present @project, with: Entities::Project + end + + # Unarchive project + # + # Parameters: + # id (required) - The ID of a project + # Example Request: + # PUT /projects/:id/unarchive + put ':id/unarchive' do + authorize!(:archive_project, user_project) + + user_project.unarchive! + + present @project, with: Entities::Project + end + # Remove project # # Parameters: -- cgit v1.2.1 From 3549d7c1d402c10c567c239b006132c45b0c0d1e Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Thu, 24 Mar 2016 13:36:45 +0100 Subject: PUT becomes POST on archiving endpoints Also the specs have a minor improvement. Mainly the access right spec. Changes are reflected in the docs --- lib/api/projects.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/api') diff --git a/lib/api/projects.rb b/lib/api/projects.rb index aa60a39f341..24b31005475 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -250,12 +250,12 @@ module API # id (required) - The ID of a project # Example Request: # PUT /projects/:id/archive - put ':id/archive' do + post ':id/archive' do authorize!(:archive_project, user_project) user_project.archive! - present @project, with: Entities::Project + present user_project, with: Entities::Project end # Unarchive project @@ -264,12 +264,12 @@ module API # id (required) - The ID of a project # Example Request: # PUT /projects/:id/unarchive - put ':id/unarchive' do + post ':id/unarchive' do authorize!(:archive_project, user_project) user_project.unarchive! - present @project, with: Entities::Project + present user_project, with: Entities::Project end # Remove project -- cgit v1.2.1