add support for closing changesets

This commit is contained in:
Christopher Schmidt 2008-05-11 21:18:42 +00:00
parent 9cbc370a7e
commit 6f1aad0d04
2 changed files with 16 additions and 0 deletions

View file

@ -54,6 +54,21 @@ class ChangesetController < ApplicationController
render :nothing => true, :status => :not_found
end
end
def close
begin
if not request.put?
render :nothing => true, :status => :method_not_allowed
return
end
changeset = Changeset.find(params[:id])
changeset.open = false
changeset.save
render :nothing => true
rescue ActiveRecord::RecordNotFound
render :nothing => true, :status => :not_found
end
end
def upload
if not request.put?

View file

@ -3,6 +3,7 @@ ActionController::Routing::Routes.draw do |map|
# API
map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read'
map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close'
map.connect "api/#{API_VERSION}/changeset/upload", :controller => 'changeset', :action => 'upload'
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'