Sha256: 8b6be068b2038386120312793677836d05cdd4b56a13142c7b1f5c357cc03334

Contents?: true

Size: 850 Bytes

Versions: 22

Compression:

Stored size: 850 Bytes

Contents

require 'xommelier/atom'

module Xommelier
  module Atom
    # Implements Feed Paging and Archiving
    # See RFC 5005 {http://tools.ietf.org/html/rfc5005.html}
    module History
      include Xommelier::Xml

      xmlns 'http://purl.org/syndication/history/1.0', as: :fh

      class Complete < Xml::Element; end
      class Archive < Xml::Element; end
    end

    class Feed
      may do
        element :complete, type: History::Complete
        element :archive, type: History::Archive
      end

      alias complete? complete
      alias archive? archive

      %w(first last previous next
         prev-archive next-archive current).each do |rel|
        define_method(:"#{rel.underscore}_feed_url") do
          links.find { |link| link.rel == rel && link.type == 'application/atom+xml' }.try(:href)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
xommelier-0.1.9 lib/xommelier/atom/history.rb
xommelier-0.1.8 lib/xommelier/atom/history.rb