benburkert / hosebird

A Ruby gem for Twitter's new Streaming API codename Hosebird

This URL has Read+Write access

hosebird / README.textile
100644 76 lines (55 sloc) 1.798 kb

hosebird

Overview

Hosebird is a Ruby library for Twitter’s new Streaming API codename Hosebird. Hosebird will open a persistent HTTP connection which receives updates in near-realtime.

For example, hosebird makes it easy to monitor twitter for caps lock abuse.


require 'hosebird' username, password = #... twitter = Twitter::Base.new(Twitter::HTTPAuth.new(username, password))

Hosebird::Spritzer.subscribe(twitter) do |status|
if status[:text].upcase == status[:text] && status[:text] =~ /\w+/
twitter.update(“@#{status[:user][:screen_name]} ur caps r on, btw”, :in_reply_to_status_id => status[:id])
end
end

Installation

Requirements

Optional

Installing from GitHub

sudo gem install benburkert-hosebird

Examples

Growlr: A Realtime Twitter Client

Note: Requires OSX with Growl

1. Create a ~/.twitter YAML file with your twitter username & password:
</code>
echo "username: oprah
password: harpo" > ~/.twitter

2. Checkout the hosebird source:

git clone git://github.com/benburkert/hosebird.git

3. Run the growler example:

ruby hosebird/examples/growlr.rb

Spritzr: Same as Growlr, but for the Public Timeline

Run hosebird/examples/spritzr.rb instead of hosebird/examples/growlr.rb.