Skip to content

Instantly share code, notes, and snippets.

@joshwand
Created March 2, 2010 19:12
Show Gist options
  • Save joshwand/319809 to your computer and use it in GitHub Desktop.
Save joshwand/319809 to your computer and use it in GitHub Desktop.
httparty/yajl streaming testcase 1
require 'rubygems'
require 'httparty'
require 'uri'
class MyTest
# include HTTParty
TWITTER_USERNAME = "your twitter username"
TWITTER_PASSWORD = "your twitter password"
def do_httparty_request
p HTTParty.get("http://whoismyrepresentative.com/whoismyrep.php?zip=46544")
end
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
test = MyTest.new
# uncomment below to break Yajl::HttpStream
# test.do_httparty_request
test.do_yajl_stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment