-
-
Save nakajima/108480 to your computer and use it in GitHub Desktop.
aesthetics
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
| # Currently it looks like this: | |
| class Twitter | |
| include Typhoeus | |
| remote_defaults :on_success => lambda {|response| JSON.parse(response.body)}, | |
| :on_failure => lambda {|response| puts "error code: #{response.code}"}, | |
| :base_uri => "http://search.twitter.com" | |
| define_remote_method :search, :path => '/search.json' | |
| define_remote_method :trends, :path => '/trends/:time_frame.json' | |
| end | |
| # I want it to look like this. Fork coming soon. | |
| class Twitter | |
| Typhoeus "http://search.twitter.com" do | |
| success { |response| JSON.parse(response.body) } | |
| failure { |response| puts "error code: #{response.code}" } | |
| expires_in 60 # instead of :cache_responses | |
| method :search, :path => '/search.json' | |
| method :trends, :path => '/trends/:time_frame.json' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment