Created
December 30, 2009 20:30
-
-
Save mwunsch/266365 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| status = Weary.get("http://twitter.com/statuses/user_timeline") do |r| | |
| r.with = {:id => 'markwunsch'} | |
| end | |
| status.before_send do |request| | |
| puts "Sending a request to #{request.uri}" | |
| end | |
| status.on_complete do |response| | |
| if response.success? | |
| puts response.body | |
| else | |
| puts "Something went wrong: #{response.code}: #{response.message}" | |
| end | |
| end |
This file contains hidden or 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
| Weary.get "http://twitter.com/statuses/user_timeline" do |req| | |
| req.follows = false | |
| req.with = {:id => 'markwunsch'} | |
| req.credentials = {:username => 'markwunsch', :password => 'secret'} | |
| req.headers = {"User-Agent" => Weary::UserAgents["Safari 4.0.2 - Mac"]} | |
| end |
This file contains hidden or 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
| status.perform do |response| | |
| puts "Request to #{response.url}, complete. Got a #{response.code}." | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment