Created
March 3, 2010 17:42
-
-
Save joshwand/320800 to your computer and use it in GitHub Desktop.
httparty/yajl streaming testcase 2
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 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