Sha256: abf4885b0633ea4c439333938a10d6e6565bc468fd64367a2260954cc36cca1e

Contents?: true

Size: 973 Bytes

Versions: 5

Compression:

Stored size: 973 Bytes

Contents

require 'xommelier/atom'

module Xommelier
  module Atom
    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

5 entries across 5 versions & 1 rubygems

Version Path
xommelier-0.1.7 lib/xommelier/atom/threading.rb
xommelier-0.1.6 lib/xommelier/atom/threading.rb
xommelier-0.1.5 lib/xommelier/atom/threading.rb
xommelier-0.1.4 lib/xommelier/atom/threading.rb
xommelier-0.1.3 lib/xommelier/atom/threading.rb