ShortURL
Constants
SERVICES = {"isgd" => Services::Isgd.new, "tinyurl" => Services::TinyURL.new, "vgd" => Services::Vgd.new, "shorl" => Services::Shorl.new}
VERSION = "0.2.1"
Class methods
all_services
Returns all available shortening services.
ShortURL.all_services # => [:isgd, :tinyurl, ...]
expand(short_url : String)
Expands shortened url via http get request.
ShortURL.expand("http://tinyurl.com/2tx") # => "http://google.com"
Raises ShortURL::InvalidShortURL if short_url is invalid and it
can not be expanded.
shorten(url : String, service = :tinyurl)
Shortens an url using one of the available services.
ShortURL.shorten("http://google.com") # => "http://tinyurl.com/2tx"
ShortURL.shorten("http://google.com", :isgd) # => "http://is.gd/OwycZW"
# ...