]> git.openstreetmap.org Git - rails.git/commitdiff
ways plural api
authorSteve Coast <steve@asklater.com>
Fri, 1 Dec 2006 10:09:18 +0000 (10:09 +0000)
committerSteve Coast <steve@asklater.com>
Fri, 1 Dec 2006 10:09:18 +0000 (10:09 +0000)
app/controllers/way_controller.rb
config/routes.rb

index 3a11d8a6054f5cb6c92bd15f7e45868131b34de4..ff568620baf3b71177e6a1fbb98dbeffe594033f 100644 (file)
@@ -77,4 +77,19 @@ class WayController < ApplicationController
     end
   end
 
     end
   end
 
+  def ways
+    response.headers["Content-Type"] = 'application/xml'
+    ids = params['ways'].split(',').collect {|w| w.to_i }
+    if ids.length > 0
+      waylist = Way.find(ids)
+      doc = get_xml_doc
+      waylist.each do |way|
+        doc.root << way.to_xml_node
+      end 
+      render :text => doc.to_s
+    else
+      render :nothing => true, :status => 400
+    end
+  end
+
 end
 end
index e8cf82559b76def9c68a2648d88b46f4b2c5cd24..c36984c11c437bf83cde1b347050e228290825f7 100644 (file)
@@ -15,6 +15,7 @@ ActionController::Routing::Routes.draw do |map|
   map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
   map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => nil
   map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'rest', :id => nil
   map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
   map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => nil
   map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'rest', :id => nil
+  map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
 
   map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
   
 
   map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'