BuzzFeed - Automated Buzz From The Web Model
It is popular to have a “Buzz From The Web” widget on the site. This plugin will allow you just that. Use this plugin for automated combining of RSS/Atom links from various internet sources. It provides a background worker that periodically updates the Buzz model with fresh RSS/Atom links from sources you define.
Installation (Rails 3 ready)
Add this line to your Gemfile (and run bundle install):
gem 'buzz_feed'
Run the generator which will generate some configuration files.
rails g buzz_feed
rake db:migrate
The plugin comes with a Buzz model file. You can override the default model by creating a new app/models/buzz.rb file.
Setup
The generator creates a config/buzz_feed.yml where you configure the plugin. Here is a sample where I defined two sources (smashingmagazine and github RSS sources; the name can be whatever).
development: &defaults
service:
smashingmagazine:
url: 'http://rss1.smashingmagazine.com/feed/'
github:
url: 'https://github.com/xpepermint.private.atom?token=1b4b0b956ba3130cc47e420fdb44556f'
The generator also creates config/initializers/buzz_feed.rb that has defined a Rufus scheduler for periodical reading/updating the Buzz model. You can comment this out to disable periodical updates.
Examples
You can manually read a feed like this:
data = BuzzFeed::Client.read('github').each do |item|
puts item[:id]
puts item[:title]
puts item[:url]
puts item[:created_at]
end
To manually update the Buzz model with fresh links do this:
BuzzFeed::Client.update('smashingmagazine')
In case you would like to update all services do this:
BuzzFeed::Client.update_all
You can list all defined service names like this:
data = BuzzFeed::Client.service_names.each do |name|
puts name
end
Rake tasks are also available:
rake buzz_feed:update_all
rake buzz_feed:update('smashingmagazine')