class AtomFeed::AtomFeedEntry

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File lib/atom_feed/atom_feed_entry.rb, line 6
def initialize(node)
  @node = node
end

Public Instance Methods

authors() click to toggle source

Array of authors (optional).

# File lib/atom_feed/atom_feed_entry.rb, line 26
def authors
  nodes = @node.xpath("atom:author", ::AtomFeed::NS) || []
  nodes.map { |node| AtomPerson.new(node) }
end
categories() click to toggle source

categories (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 52
def categories
  nodes = @node.xpath("atom:category", ::AtomFeed::NS) || []
  nodes.map { |node| AtomCategory.new(node) }
end
content() click to toggle source

Content (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 38
def content
  node = @node.at_xpath("atom:content", ::AtomFeed::NS)
  return nil unless node
  AtomText.new(node)
end
contributors() click to toggle source

contributors (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 58
def contributors
  nodes = @node.xpath("atom:contributor", ::AtomFeed::NS) || []
  nodes.map { |node| AtomPerson.new(node) }
end
id() click to toggle source

Entry id (required).

# File lib/atom_feed/atom_feed_entry.rb, line 11
def id
  @node.at_xpath("atom:id", ::AtomFeed::NS).content
end
published() click to toggle source

Published (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 64
def published
  time = @node.at_xpath("atom:published", ::AtomFeed::NS).try(:content)
  return nil unless time
  Time.parse(time)
end
rights() click to toggle source

rights (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 78
def rights
  node = @node.at_xpath("atom:rights", ::AtomFeed::NS)
  return nil unless node
  AtomText.new(node)
end
source() click to toggle source

source (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 71
def source
  if node = @node.at_xpath("atom:source", ::AtomFeed::NS)
    AtomFeedEntry.new(node)
  end
end
summary() click to toggle source

Summary (optional)

# File lib/atom_feed/atom_feed_entry.rb, line 45
def summary
  node = @node.at_xpath("atom:summary", ::AtomFeed::NS)
  return nil unless node
  AtomText.new(node)
end
title() click to toggle source

Entry title (required).

# File lib/atom_feed/atom_feed_entry.rb, line 16
def title
  @node.at_xpath("atom:title", ::AtomFeed::NS).content
end
updated() click to toggle source

Entry update date (required).

# File lib/atom_feed/atom_feed_entry.rb, line 21
def updated
  Time.parse @node.at_xpath("atom:updated", ::AtomFeed::NS).content
end