Sha256: a6889f0a07e4ad7b3163f69affdccdfdadadb49d9f25ed951e3c378a1f025ce0

Contents?: true

Size: 1.05 KB

Versions: 22

Compression:

Stored size: 1.05 KB

Contents

require 'xommelier/atom'

module Xommelier
  module Atom
    # Implments Atom Threading Extensions
    # See RFC 4685 {http://tools.ietf.org/html/rfc4685.html}
    module Threading
      include Xommelier::Xml

      xmlns 'http://purl.org/syndication/thread/1.0', as: :thr

      class InReplyTo < Xml::Element
        element_name 'in-reply-to'

        attribute :ref

        may do
          attribute :href, type: Uri
          attribute :type, type: String
          attribute :source
        end
      end
    end

    # Extends Atom elements
    class Entry
      may do
        element :in_reply_to, type: Threading::InReplyTo, as: Threading::InReplyTo.element_name
        element :total, type: Integer, ns: Threading.xmlns
      end

      def replies_feed_url
        links.find { |link| link.rel == 'replies' && link.type == 'application/atom+xml' }.try(:href)
      end
    end

    class Link
      may do
        attribute :count,   type: Integer, ns: Threading.xmlns
        attribute :updated, type: Time,    ns: Threading.xmlns
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
xommelier-0.1.30 lib/xommelier/atom/threading.rb
xommelier-0.1.29 lib/xommelier/atom/threading.rb
xommelier-0.1.28 lib/xommelier/atom/threading.rb
xommelier-0.1.27 lib/xommelier/atom/threading.rb
xommelier-0.1.26 lib/xommelier/atom/threading.rb
xommelier-0.1.25 lib/xommelier/atom/threading.rb
xommelier-0.1.24 lib/xommelier/atom/threading.rb
xommelier-0.1.23 lib/xommelier/atom/threading.rb
xommelier-0.1.22 lib/xommelier/atom/threading.rb
xommelier-0.1.21 lib/xommelier/atom/threading.rb
xommelier-0.1.20 lib/xommelier/atom/threading.rb
xommelier-0.1.19 lib/xommelier/atom/threading.rb
xommelier-0.1.18 lib/xommelier/atom/threading.rb
xommelier-0.1.16 lib/xommelier/atom/threading.rb
xommelier-0.1.15 lib/xommelier/atom/threading.rb
xommelier-0.1.14 lib/xommelier/atom/threading.rb
xommelier-0.1.13 lib/xommelier/atom/threading.rb
xommelier-0.1.12 lib/xommelier/atom/threading.rb
xommelier-0.1.11 lib/xommelier/atom/threading.rb
xommelier-0.1.10 lib/xommelier/atom/threading.rb