-
- case request.method
-
- when :get
- unless node
- render :nothing => true, :status => 500
- return
- end
-
- unless node.visible
- render :nothing => true, :status => 410
- return
- end
-
- render :text => node.to_xml.to_s
- return
-
- when :delete
- if node.visible
- node.visible = 0
- node.save_with_history
- render :nothing => true
- else
- render :nothing => true, :status => 410
- end
-
- when :put
- new_node = Node.from_xml(request.raw_post)
-
- node.timestamp = Time.now
- node.user_id = @user.id
-
- node.latitude = new_node.latitude
- node.longitude = new_node.longitude
- node.tags = new_node.tags
-
- if node.id == new_node.id and node.save_with_history
- render :nothing => true, :status => 200
- else
- render :nothing => true, :status => 500
- end
- return
+ new_node = Node.from_xml(request.raw_post)
+
+ unless new_node and new_node.id == node.id
+ raise OSM::BadUserInput.new("The id in the url (#{node.id}) is not the same as provided in the xml (#{new_node.id})")