Created
November 16, 2011 04:42
-
-
Save michelezonca/1369256 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
| # ... | |
| # Call a method asynchronously and get a Thread object | |
| thread = bitly.getShortenedUrl("http://www.mashape.com", "bitly-login", "bitly-api-key") { |response| | |
| shortenedUrl = response["shortenedUrl"] # See the API's documentation | |
| puts "Finally the shortened url is " + shortenedUrl | |
| } | |
| =begin | |
| Do other stuff here. If you program ends here be sure to join the thread otherwise | |
| you'll never see the response, because the main thread will end before the API call is executed | |
| You can do this with: thread.join() | |
| =end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment