Created
March 2, 2010 19:12
-
-
Save joshwand/319809 to your computer and use it in GitHub Desktop.
httparty/yajl streaming testcase 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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