Module: FeedMe

Defined in:
lib/feed_me.rb,
lib/feed_me/consts.rb,
lib/feed_me/feed_parser.rb,
lib/feed_me/feed_struct.rb,
lib/feed_me/item_parser.rb,
lib/feed_me/simple_struct.rb

Defined Under Namespace

Classes: AbstractParser, AtomFeedParser, FeedParser, FeedStruct, InvalidFeedFormat, ItemParser, Rss2FeedParser, Rss2ItemParser, SimpleStruct

Constant Summary collapse

ROOT_NODES =
{
  :atom => "//feed[@xmlns='http://www.w3.org/2005/Atom']",
  :rss2 => "//rss[@version=2.0]/channel"
}
FEED_PROPERTIES =
{
  :atom => {
    :title => :title,
    :updated_at => [:updated, :time],
    :feed_id => :id,
    :url => ["link[@rel=alternate]", :href],
    :href => ["link[@rel=self]", :href],
    :description => :subtitle,
    :generator => :generator,
    :author => {
      :email => 'author/email',
      :name => 'author/name',
      :uri => 'author/uri'
    },
    :entries => :special
  },
  :rss2 => {
    :title => :title,
    :updated_at => [:lastBuildDate, :time],
    :feed_id => :undefined,
    :url => :link,
    :href => :undefined,
    :description => :description,
    :generator => :generator,
    :author => :special,
    :entries => :special
  }
}
ITEM_PROPERTIES =
{
  :atom => {
    :title => :title,
    :updated_at => [:updated, :time],
    :item_id => :id,
    :url => ["link[@rel=alternate]", :href],
    :content => :content,
    :author => {
      :email => 'author/email',
      :name => 'author/name',
      :uri => 'author/uri'
    }
  },
  :rss2 => {
    :title => :title,
    :updated_at => [:pubDate, :time],
    :item_id => :guid,
    :url => :link,
    :content => :description,
    :author => :special,
    :categories => [:category, :array]
  }
}
AUTHOR_PROPERTIES =
{
  :atom => {
    :name => :name,
    :uri => :uri,
    :email => :email
  }
}

Class Method Summary collapse

Class Method Details

.open(file) ⇒ Object



28
29
30
# File 'lib/feed_me.rb', line 28

def self.open(file)
  FeedMe::FeedParser.parse(file)
end

.parse(feed) ⇒ Object



24
25
26
# File 'lib/feed_me.rb', line 24

def self.parse(feed)
  FeedMe::FeedParser.parse(feed)
end