Class: Twitorious::URL::Isgd
- Inherits:
-
Object
- Object
- Twitorious::URL::Isgd
- Defined in:
- lib/twitorious/url/isgd.rb
Instance Method Summary collapse
-
#initialize ⇒ Isgd
constructor
A new instance of Isgd.
- #shorten(url) ⇒ Object
Constructor Details
#initialize ⇒ Isgd
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 |