feed_us_grabber

ENVIRONEMNT

To be used with Rails 3.x and Ruby 1.9x. We’re proud of our software, and we want to tell you more about it. We also want to hear about what you do so we can help figure out whether Feed.Us is a good fit. Please call us (414-244-9900) or email us ([email protected]) or Skype us (feedussoftware) or visit us at feed.us

INSTALLATION

Follow these steps to download and install the feed_us_grabber gem:

  1. In your rails application, edit your Gemfile to include:

gem ‘feed_us_grabber’

  1. Run bundle install from the command line (this will download the feed_us_grabber to your environment)

  1. Open config/routes.rb and add following line:

match “rails_app/FeedUsGrabber” => “FeedUsGrabber#index”

** where rails_app is the root URL to your application. The match is case sensitive.

  1. Update environment.rb and include require ‘net/http’

  1. Your installation is complete

USAGE

(1) Add following line to each controller (or app/controllers/application_controller.rb): include FeedUsGrabberHelper (2) Add following code inside your controllers actions: @grabber = feedUsGrabber(:FeedUsURL => ‘<FEED.US URL>’,:FeedUsCacheInterval => FEED_INTERVAL, :FeedUsCacheIntervalLength => FEED_INTERVAL_LENGTH, :FeedUsCacheGroup => ‘FEED CACHE GROUP NAME’)

If you want to use FeedUsGrabber inside action index under controller “test” add following code inside action index of “test” controller

* Example 1 def index @grabber = feedUsGrabber(:FeedUsURL => ‘render.feed.us/Feed.aspx?g=00767d50-bde8-e111-9875-4040419a7f04’,:FeedUsCacheInterval => CI_DAYS, :FeedUsCacheIntervalLength => 2, :FeedUsCacheGroup => ‘demo’) end * Example 2 The most basic configuration is (Note you will replace the URL listed with the URL of your content from “Export” on Feed.Us): def index @grabber = feedUsGrabber(:FeedUsURL => ‘render.feed.us/Feed.aspx?g=00767d50-bde8-e111-9875-4040419a7f04’) end (3) Inside the view of the action add the following code to render your content <%= feedUsGrabberRender @grabber %> Example index.erb of “test” looks like <table> <tr> <td width=‘20%’> <%= feedUsGrabberRender @grabber %> </td> <td> Some text </td> </tr> </table>

CLEARING CACHE

To clear cache goto following url rails_app/FeedUsGrabber

  • Clear a specific cache group

rails_app/FeedUsGrabber?cachecommand=clear&group=demo OR

rails_app/FeedUsGrabber?group=demo

  • Clear entire cache

rails_app/FeedUsGrabber?cachecommand=clearall

  • Clear cache in specific folder

rails_app/FeedUsGrabber?cachecommand=clear&folder=myFolder (can also optionally include group=demo to clear the cache group demo under the myFolder directory)

:Note that if you receive a failure message that your IP is not authorized to clear the cache, add your IP to the ClientWhiteList in your controller (where xxx.xx.xx.xx is your IP) def index @grabber = feedUsGrabber(:FeedUsURL => ‘render.feed.us/Feed.aspx?g=00767d50-bde8-e111-9875-4040419a7f04’, :ClientWhiteList => ‘xxx.xx.xx.xx’) end

You can also specify multiple IP’s seperated with a comma :ClientWhiteList => ‘xxx.xx.xx.xx,yyy.yy.yy.yy’

LOCATION OF CACHE

Cache is maintained under RAILS_ROOT/tmp

LOCATION OF LOG

Log is maintained under RAILS_ROOT/log/FeedUsGrabber.log

Contributing to feed_us_grabber

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Feed.Us See LICENSE.txt for further details.