public
Description: A Ruby gem for Twitter's new Streaming API codename Hosebird
Homepage:
Clone URL: git://github.com/benburkert/hosebird.git
name age message
file .document Sun May 17 13:32:15 -0700 2009 Initial commit to hosebird. [benburkert]
file .gitignore Sun May 17 13:32:15 -0700 2009 Initial commit to hosebird. [benburkert]
file LICENSE Sun May 17 13:32:15 -0700 2009 Initial commit to hosebird. [benburkert]
file README.textile Mon May 18 15:23:22 -0700 2009 Forgot to add aikidoka as a dependency. [benburkert]
file Rakefile Tue May 19 14:37:09 -0700 2009 Assume the github version of aikidoka for now. [benburkert]
file VERSION Tue May 19 14:42:41 -0700 2009 Version bump to 0.1.1 [benburkert]
directory examples/ Mon May 18 14:42:52 -0700 2009 Added the Growlr & Spritzr examples. [benburkert]
file hosebird.gemspec Tue May 19 14:48:06 -0700 2009 Version 0.1.1 gemspec. [benburkert]
directory lib/ Tue May 19 14:40:34 -0700 2009 Account for response headers & chunked data. [benburkert]
directory test/ Mon May 18 12:57:40 -0700 2009 PostStream tests. [benburkert]
README.textile

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.