From 25936fad050c62e3be1c0fa3912891dca8ecb745 Mon Sep 17 00:00:00 2001 From: Steve Coast Date: Fri, 1 Dec 2006 10:09:18 +0000 Subject: [PATCH] ways plural api --- app/controllers/way_controller.rb | 15 +++++++++++++++ config/routes.rb | 1 + 2 files changed, 16 insertions(+) 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' -- 2.43.2