Skip to content

Instantly share code, notes, and snippets.

@joshwand
Created March 3, 2010 17:42
Show Gist options
  • Save joshwand/320800 to your computer and use it in GitHub Desktop.
Save joshwand/320800 to your computer and use it in GitHub Desktop.
httparty/yajl streaming testcase 2
require 'rubygems'
require 'httparty'
require 'uri'
class HttpPartyTest
def do_httparty_request
p HTTParty.get("http://whoismyrepresentative.com/whoismyrep.php?zip=46544")
end
end
class StreamerTest
TWITTER_USERNAME = "your twitter username"
TWITTER_PASSWORD = "your twitter password"
def do_yajl_stream
require 'yajl/http_stream'
p 'here we go!'
url = URI.parse("http://stream.twitter.com/1/statuses/sample.json")
url.user = TWITTER_USERNAME
url.password = TWITTER_PASSWORD
Yajl::HttpStream.get(url) do |m|
p m
end
end
end
httpPartyTest = HttpPartyTest.new
httpPartyTest.do_httparty_request
streamerTest = StreamerTest.new
streamerTest.do_yajl_stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment