Class: MultiShorten::B54

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

Overview

URL Shortener for B54

Class Method Summary collapse

Methods inherited from UrlShortener

#fail

Class Method Details

.shorten(url) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/multi_shorten/url_shorteners.rb', line 32

def self.shorten url
  response = get "/api", :query => {:action => "shorturl", :url => URI.encode(url), :format => "json"} rescue return fail
  if response["shorturl"]
    {:status => :success, :short_url => URI.unescape(response["shorturl"])}
  else
    fail
  end
end