Sha256: 881ca27665957649709b8c87cc2f2989b90f5aa87c76798a75052ff2e079c09c
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true # @title Building an Atom feed require 'xommelier/atom/full' require 'active_support/core_ext/numeric/time' feed = Xommelier::Atom::Feed.new feed.id = 'http://example.com/blog' feed.title = 'Example.com blog' feed.complete = Xommelier::Atom::History::Complete.new feed.entry = entry = Xommelier::Atom::Entry.new( id: 'http://example.com/blog/2012/03/05', title: "Happy Xommelier's day!", updated: 5.days.ago ) # Adding the only one link entry.link = Xommelier::Atom::Link.new( href: entry.id, rel: 'alternate', type: 'text/html' ) # Add more links later entry.links << Xommelier::Atom::Link.new( href: "#{entry.id}/comments.atom", rel: 'replies', type: 'application/atom+xml', count: 5 ) # Add Comments 3.times do |i| feed.entries << Xommelier::Atom::Entry.new( id: "http://example.com/blog/2012/03/05#comment_#{i}", title: ('Hooray! ' * (i + 1)).strip, updated: (5 - i).days.ago ).tap do |comment| comment.in_reply_to = Xommelier::Atom::Threading::InReplyTo.new( ref: entry.id, href: entry.link.href ) end end puts feed.to_xml
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xommelier-0.1.35 | example/building_an_atom_feed.rb |