]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm.rb
Return usernames correctly.
[rails.git] / lib / osm.rb
index 57714c68ebdebd7db30e6e3cd5db649ec384a387..1941d6dafc41b9532ffd23e6455428bc2d316494 100644 (file)
@@ -79,7 +79,7 @@ module OSM
       lat = -1
       lon = -1
       ele = -1
-      date = Time.now();
+      date = DateTime.now();
       gotlatlon = false
       gotele = false
       gotdate = false
@@ -98,7 +98,7 @@ module OSM
 
       parser.listen( :characters, %w{ time } ) do |text|
         if text && text != ''
-          date = Time.parse(text)
+          date = DateTime.parse(text)
           gotdate = true
         end
       end
@@ -280,7 +280,7 @@ module OSM
       image << link
     end
 
-    def add(latitude=0, longitude=0, title_text='dummy title', url='http://www.example.com/', description_text='dummy description', timestamp=Time.now)
+    def add(latitude=0, longitude=0, title_text='dummy title', url='http://www.example.com/', description_text='dummy description', timestamp=DateTime.now)
       item = XML::Node.new 'item'
 
       title = XML::Node.new 'title'
@@ -290,18 +290,22 @@ module OSM
       link << url
       item << link
 
+      guid = XML::Node.new 'guid'
+      guid << url
+      item << guid
+
       description = XML::Node.new 'description'
       description << description_text
       item << description
 
       pubDate = XML::Node.new 'pubDate'
-      pubDate << timestamp.xmlschema
+      pubDate << timestamp.to_s(:rfc822)
       item << pubDate
 
       if latitude
         lat_el = XML::Node.new 'geo:lat'
         lat_el << latitude.to_s
-        item << lat_el if lat_el
+        item << lat_el
       end
 
       if longitude