Class: Twitorious::URL::Isgd

Inherits:
Object
  • Object
show all
Defined in:
lib/twitorious/url/isgd.rb

Instance Method Summary collapse

Constructor Details

#initializeIsgd

Returns a new instance of Isgd.



6
7
8
9
# File 'lib/twitorious/url/isgd.rb', line 6

def initialize
  @auth = Twitorious::Auth::Basic.new("not", "needed")
  @host = URI.parse("http://is.gd")
end

Instance Method Details

#shorten(url) ⇒ Object



11
12
13
14
15
# File 'lib/twitorious/url/isgd.rb', line 11

def shorten(url)
  body = @auth.get @host, "/api.php?longurl=#{CGI.escape(url)}"
  return nil if body == "{}"
  return body
end