Skip to content

Instantly share code, notes, and snippets.

@rbazinet
Created June 6, 2013 12:10
Embed
What would you like to do?
Simple Ruby class to shorten URLs using TinyURL.
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