]> git.openstreetmap.org Git - rails.git/blobdiff - config/routes.rb
various map API rails stuff
[rails.git] / config / routes.rb
index 3ad3dddf41ae16c6a5d53611e8b4567032e55ec2..3dad762ffa86b129caf22eae4b161810fb61ac28 100644 (file)
@@ -1,20 +1,20 @@
 ActionController::Routing::Routes.draw do |map|
 
   # API
+  API_VERSION = '0.4' # change this in envronment.rb too
+  map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
+  map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'node', :action => 'history', :id => nil
+  map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'rest', :id => nil
 
-  map.connect 'api/0.4/node/create', :controller => 'node', :action => 'create'
-  map.connect 'api/0.4/node/:id/history', :controller => 'node', :action => 'history', :id => nil
-  map.connect 'api/0.4/node/:id', :controller => 'node', :action => 'rest', :id => nil
+  map.connect "api/#{API_VERSION}/segment/create", :controller => 'segment', :action => 'create'
+  map.connect "api/#{API_VERSION}/segment/:id/history", :controller => 'segment', :action => 'history'
+  map.connect "api/#{API_VERSION}/segment/:id", :controller => 'segment', :action => 'rest'
 
-  map.connect 'api/0.4/segment/create', :controller => 'segment', :action => 'create'
-  map.connect 'api/0.4/segment/:id/history', :controller => 'segment', :action => 'history'
-  map.connect 'api/0.4/segment/:id', :controller => 'segment', :action => 'rest'
+  map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
+  map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'way', :action => 'history'
+  map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'rest'
 
-  map.connect 'api/0.4/way/create', :controller => 'way', :action => 'create'
-  map.connect 'api/0.4/way/:id/history', :controller => 'way', :action => 'history'
-  map.connect 'api/0.4/way/:id', :controller => 'way', :action => 'rest'
-
-  map.connect 'api/0.4/map', :controller => 'api', :action => 'map'
+  map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
   
   # web site