feedzirra-redis

Since v1.0.0, feedjira replaces feedzirra. All future development has moved to feedjira-redis. Please update your projects accordingly.

FeedzirraRedis uses Datamapper’s dm-redis-adapter to provide a persistance layer for the Feedzirra RSS/Atom feed consumption library.

Example Usage

FeedzirraRedis can be used in much the same fashion as Feedzirra itself. One common use for FeedzirraRedis is to avoid updating the feed with every page hit, so you could update the feed from a Rakefile on a cron job instead.

Shared

DataMapper.setup(:default, { :adapter  => 'redis' })
FEED_URL = 'https://github.com/logankoester/feedzirra-redis/commits/master.atom'

Rakefile

namespace :blog do
  desc 'Grab the latest blog posts'
  task :update do
    FeedzirraRedis::Feed.fetch_and_parse(FEED_URL)
  end
end

FeedzirraRedis::Feed is actually a Datamapper model that wraps the interface to Feedzirra::Feed with some code to add persistence. Feeds are uniquely identified by their feed_url property, so when you call fetch_and_parse or update a second time the new entries are associated with the original feed.

Run rake blog:update to grab some entries.

Action

Now you just need to fetch the object your Rakefile created.

@feed = FeedzirraRedis::Feed.first(:feed_url => FEED_URL)

View

FeedzirraRedis::Entry is also a Datamapper model, but it shares the same properties as Feedzirra::Entry.

%h1= @feed.title
  - @feed.entries.each do |e|
    %h2= e.title
    %p= e.content

See the Feedzirra documentation or read the code (it’s short!) for further details.

Contributing to feedzirra-redis

Copyright © 2011-2014 Logan Koester. See LICENSE.txt for further details.