Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Rubygem for the IceRocket API
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
Gemfile
LICENSE
README.md
Rakefile
ice_rocket.gemspec

README.md

IceRocket

A rubygem for accessing the IceRocket API written by Chris Oliver

Installation

Add this line to your application's Gemfile:

gem 'ice_rocket', '~> 0.0.2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ice_rocket

Usage

Using the IceRocket API is as simple as creating a search object and then fetching pages of results:

search = IceRocket::Search.new("new york", :sourceid => "YOURSOURCEID", :dl => Date.today - 2, :dh => Date.today, :per_page => 50)
results = search.fetch :page => 3

results["rss"]["channel"]["totalResults"] # 13760
results["rss"]["channel"]["startIndex"]   # 101 = (page * per_page) + 1
results["rss"]["channel"]["item"].length  # 50

There are a number of parameters and more readable equivalents that you can use with the Search object:

:sourceid          - Your source ID key
:dh  or :date_high - Upper limit of the date filter
:dl  or :date_low  - Lower limit of the date filter
:lng or :language  - Language ("en", "de", etc)
:n   or :per_page  - Number of items per page. Must be less than or equal to 50

search = IceRocket::Search.new("new york", :sourceid => "YOURSOURCEID", :dl => Date.today - 2, :dh => Date.today, :per_page => 50)

The fetch method also takes the following:

:p or :page - The page number to retrieve

results = search.fetch :page => 3

If you would like to add debugging messages to IceRocket:

IceRocket::Search.debug_output $stderr

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.