Feed Fetcher plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install svn://rubyforge.org/var/svn/ambroseplugins/feed_fetcher
The main function that you'll be using is the class method get_feed_source on the FeedFetcher class. If successful, it'll return a FeedSource object, that you can interrogate for the feed details or the items in the current feed. If it fails, it'll throw an exception that you can use to determine the problem and return a message to the user.
Here's the code that I use to call the feed fetcher from within my Blog model. If it works, I'm setting a couple of instance members on self.
begin result = FeedFetcher::FeedFetcher.get_feed_source(site_url) if result self.feed_url = result.url self.title = result.title end rescue FeedFetcher::NoFeedForPageError @feed_error = "Sorry, we couldn't find a feed for this URL. Your blog needs to have a RSS feed facility for us to use it on Playful Bent." rescue FeedFetcher::PageFeedError @feed_error = "You blog has a RSS feed, which is great. However, it doesn't work for us right now, which is less great. Sorry, this wont work." rescue FeedFetcher::PageDoesntExistError @feed_error = "Are you sure you typed that right? We just tried to fetch that URL and we couldn't find anything there at all." end
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago

