Sha256: 6c2aef12b90db763f8e37e5a6e7b51e48cb5a4252f1b1af0829813fbb2504cee

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

require 'xommelier/atom'
require 'open-uri'

# Reading a feed
feed = Xommelier::Atom::Feed.parse(open('http://example.com/blog.atom'))
puts feed.id, feed.title, feed.updated

feed.each(:entry) do |entry|
  puts feed.id, feed.title, feed.published, feed.updated
  puts feed.content || feed.summary
end

# Building a feed
feed = Xommelier::Atom::Feed.new
feed.id = 'http://example.com/blog'
feed.title = 'Example.com blog'

5.times do |i|
  entry = Xommelier::Atom::Entry.new
  entry.id = "http://example.com/blog/#{i}"
  entry.title = "Example.com blog entry #{i}"
  entry.updated = (5 - i).days.ago

  feed << entry
end

puts feed.to_xml

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xommelier-0.0.1 examples/atom.rb