# create list of permissions
xml.instruct! :xml, :version => "1.0"
-xml.osm("version" => API_VERSION.to_s, "generator" => "OpenStreetMap Server") do
+xml.osm(OSM::API.new.xml_root_attributes) do
xml.permissions do
@permissions.each do |permission|
xml.permission :name => permission
xml.instruct!
-xml.osm(:version => API_VERSION, :generator => GENERATOR) do |osm|
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << (render(:partial => "note", :collection => @notes) || "")
end
xml.instruct!
-xml.osm(:version => API_VERSION, :generator => GENERATOR) do |osm|
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "note", :object => @note)
end
xml.instruct! :xml, :version => "1.0"
-xml.osm("version" => API_VERSION, "generator" => GENERATOR) do |osm|
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "api_user", :object => @user)
end
xml.instruct! :xml, :version => "1.0"
-xml.osm("version" => API_VERSION, "generator" => GENERATOR) do |osm|
+xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "api_user", :collection => @users)
end
doc = XML::Document.new
doc.encoding = XML::Encoding::UTF_8
root = XML::Node.new "osm"
- root["version"] = API_VERSION.to_s
- root["generator"] = GENERATOR
- root["copyright"] = COPYRIGHT_OWNER
- root["attribution"] = ATTRIBUTION_URL
- root["license"] = LICENSE_URL
+ xml_root_attributes.each do |k, v|
+ root[k] = v
+ end
doc.root = root
doc
end
+
+ def xml_root_attributes
+ { "version" => API_VERSION.to_s,
+ "generator" => GENERATOR,
+ "copyright" => COPYRIGHT_OWNER,
+ "attribution" => ATTRIBUTION_URL,
+ "license" => LICENSE_URL }
+ end
end
def self.ip_to_country(ip_address)