diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-05-31 10:01:22 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-05-31 10:04:42 +0200 |
commit | c9c92152de83283b07dc4c5a876730af98b1ac56 (patch) | |
tree | 9c5078a392cac4e95df56ff48f2720610ea0ec7d /sonar-server/src | |
parent | 49d5f33b357d2a49cee0f2a511cd354a21ec6398 (diff) | |
download | sonarqube-c9c92152de83283b07dc4c5a876730af98b1ac56.tar.gz sonarqube-c9c92152de83283b07dc4c5a876730af98b1ac56.zip |
SONAR-2405 Configured routes.rb to have more RESTful URLs
And also updated the documentation.
Diffstat (limited to 'sonar-server/src')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb | 20 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/config/routes.rb | 1 |
2 files changed, 11 insertions, 10 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb index 50341983fd3..9882beb6ceb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb @@ -25,7 +25,7 @@ class Api::ReviewsController < Api::ApiController # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) verify :method => :put, :only => [ :update ] verify :method => :post, :only => [ :create ] - verify :method => :delete, :only => [ :delete ] + verify :method => :delete, :only => [ :destroy ] def index convert_markdown=(params[:output]=='HTML') @@ -47,8 +47,8 @@ class Api::ReviewsController < Api::ApiController # - 'false_positive' : if "true", creates a false-positive review # # Example : - # - POST "/api/reviews/create?violation_id=1&assignee=fabrice&text=Hello%20World! - # - POST "/api/reviews/create?violation_id=2&false_positive=true&text=No%20violation%20here + # - POST "/api/reviews/?violation_id=1&assignee=fabrice&text=Hello%20World! + # - POST "/api/reviews/?violation_id=2&false_positive=true&text=No%20violation%20here # def create begin @@ -108,11 +108,11 @@ class Api::ReviewsController < Api::ApiController # state 'false_positive' of the review # # Example : - # - PUT "/api/reviews/update?id=1&false_positive=true&new_text=Because - # - PUT "/api/reviews/update?id=1&assignee=fabrice - # - PUT "/api/reviews/update?id=1&assignee=none - # - PUT "/api/reviews/update?id=1&new_text=New%20Comment! - # - PUT "/api/reviews/update?id=1&text=Modified%20Comment! + # - PUT "/api/reviews/?id=1&false_positive=true&new_text=Because + # - PUT "/api/reviews/?id=1&assignee=fabrice + # - PUT "/api/reviews/?id=1&assignee=none + # - PUT "/api/reviews/?id=1&new_text=New%20Comment! + # - PUT "/api/reviews/?id=1&text=Modified%20Comment! # def update begin @@ -176,9 +176,9 @@ class Api::ReviewsController < Api::ApiController # - 'comment_id' : the id of the comment to delete (for the moment, only the last comment can be deleted) # # Example : - # - DELETE "/api/reviews/update?id=1&comment=5 + # - DELETE "/api/reviews/?id=1&comment=5 # - def delete + def destroy begin # 1- Get some parameters convert_markdown=(params[:output]=='HTML') diff --git a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb index f485d1cdef5..6f4aafef2a0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb +++ b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb @@ -11,6 +11,7 @@ ActionController::Routing::Routes.draw do |map| api.resources :events, :only => [:index, :show, :create, :destroy] api.resources :user_properties, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ } api.resources :favorites, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ } + api.resources :reviews, :only => [:index, :create, :update, :destroy], :requirements => { :id => /.*/ } end map.connect 'api/metrics', :controller => 'api/metrics', :action => 'index', :conditions => { :method => :get } |