# 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')
# - '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
# 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
# - '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')
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 }