Class: MultiShorten::IsGd

Inherits:
UrlShortener show all
Defined in:
lib/multi_shorten/url_shorteners.rb

Overview

URL Shortener for is.gd

Class Method Summary collapse

Methods inherited from UrlShortener

#fail

Class Method Details

.shorten(url) ⇒ Object



75
76
77
78
79
80
81
82
# File 'lib/multi_shorten/url_shorteners.rb', line 75

def self.shorten url
  response = get "/create.php", :query => {:format => "json", :url => URI.encode(url)}
  unless response.parsed_response["shorturl"].nil?
    { :status => :success, :short_url => response.parsed_response["shorturl"] }
  else
    fail
  end
end