]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm.rb
Use full list of osm xml root attributes in builder templates
[rails.git] / lib / osm.rb
index 71e12534ffe57c348d4802d81aeb40f9a4b31cbf..1951e3c31287f82d1bc15929a17573834e3a0c6e 100644 (file)
@@ -494,14 +494,20 @@ module OSM
       doc = XML::Document.new
       doc.encoding = XML::Encoding::UTF_8
       root = XML::Node.new "osm"
       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
       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)
   end
 
   def self.ip_to_country(ip_address)
@@ -510,7 +516,7 @@ module OSM
     if ipinfo
       country = ipinfo.country_code2
     else
     if ipinfo
       country = ipinfo.country_code2
     else
-      country = http_client.get("http://api.hostip.info/country.php?ip=#{ip_address}").body
+      country = http_client.get("https://api.hostip.info/country.php?ip=#{ip_address}").body
       country = "GB" if country == "UK"
     end
 
       country = "GB" if country == "UK"
     end