Simple Ruby class to shorten URLs using TinyURL.
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
class Tinyurl | |
include HTTParty | |
base_uri 'tinyurl.com' | |
def shorten(url) | |
self.class.get("/api-create.php?url=#{url}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment