From: Steve Coast Date: Fri, 1 Dec 2006 10:09:18 +0000 (+0000) Subject: ways plural api X-Git-Tag: live~8571 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/25936fad050c62e3be1c0fa3912891dca8ecb745?hp=f4743c08ac8a80fb7e20f5540fa405ce5efb7ff6;ds=inline ways plural api --- diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index 3a11d8a60..ff568620b 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -77,4 +77,19 @@ class WayController < ApplicationController 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 diff --git a/config/routes.rb b/config/routes.rb index e8cf82559..c36984c11 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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}/ways", :controller => 'way', :action => 'ways', :id => nil map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'