+ when :put
+ new_way = Way.from_xml(request.raw_post)
+
+ if new_way
+ unless new_way.preconditions_ok? # are the segments (and their nodes) visible?
+ render :nothing => true, :status => HTTP_PRECONDITION_FAILED
+ return
+ end
+
+ way.user_id = @user.id
+ way.tags = new_way.tags
+ way.segs = new_way.segs
+ way.timestamp = new_way.timestamp
+ way.visible = true
+
+ if way.id == new_way.id and way.save_with_history
+ render :nothing => true
+ else
+ render :nothing => true, :status => 500
+ end
+ else
+ render :nothing => true, :status => 400 # if we got here the doc didnt parse
+ end
+ end
+ end
+
+ def ways
+ response.headers["Content-Type"] = 'text/xml'
+ ids = params['ways'].split(',').collect {|w| w.to_i }
+ if ids.length > 0
+ waylist = Way.find(ids)
+ doc = OSM::API.new.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