Rails plugin to load feeds or XML resources into an ActiveRecord model
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app/models
rails_generators/feedsucker
spec
tasks
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

Feedsucker
==========

Rails plugin to load feeds (using FeedTools) or XML resources (using REXML::XPath expressions) into an ActiveRecord model (called FeedsuckerPost).

Feedsucker uses another AR model (called FeedsuckerFeed) to store the settings of the different sources it should suck from.

FeedsuckerPost model currently has the following fields: title, content, date, url, blog_title and blog_url (and the foreign key of the FeedsuckerFeed from which the data was sucked).

FeedsuckerFeed model has the following fields: title, url, number_of_posts, xpath_post_title, xpath_post_content, xpath_post_date, xpath_post_url, xpath_blog_title and xpath_blog_url.

Example
=======
To create a RSS/Atom feed to suck from:

    FeedsuckerFeed.create(
      :title => 'RSS/Atom example',
      :nicetitle => 'atom-example',
      :number_of_posts => 3, # optional (all posts in feed if blank),
	  :delete_preview => true, # optional: delete all posts from a feed, before it´s sucked (default -> true)
      :url => 'http://example.com/posts.atom')

To create it but sucking from XML resouce index: 

    FeedsuckerFeed.create(
      :title => 'XML resource index example',
      :nicetitle => 'xml-example',
      :url => 'http://example.com/temas/arte-y-arquitectura/xml',
      :number_of_posts => 3, # optional (all posts if blank)
      :xpath_post_title => '//post-title/text()',
      :xpath_post_content => '//post-body/text()',
      :xpath_post_date => '//post-date/text()',
      :xpath_post_url => '//post-id/text()',
      :xpath_blog_title => '//blog-title/text()',
      :xpath_blog_url => '//blog-url/text()')

To suck a feed:

    FeedsuckerFeed.find_by_title('atom-example').suck!

To suck them all:

    FeedsuckerFeed.suck_all!

To show sucked items in a view:

    <% FeedsuckerFeed.find_by_title('Calippo').posts.each do |post| %>
    <h3><%= post.title %></h3>
    [...]
    <% end %>


Installation
============

With:

    script/plugin install git://github.com/thecocktail/feedsucker.git

Or:

    git submodule add git://github.com/thecocktail/feedsucker.git vendor/plugins/feedsucker

And then:

    script/generate feedsucker


Bugs & feedback
===============

ruby at listas dot the-cocktail dot com

Copyright (c) 2009 The Cocktail Experience S.L., released under the MIT license