Module: Dljbz

Extended by:
Dljbz
Included in:
Dljbz
Defined in:
lib/dljbz.rb,
lib/dljbz/base.rb,
lib/dljbz/utils.rb,
lib/dljbz/request.rb,
lib/dljbz/shorten.rb,
lib/dljbz/version.rb

Defined Under Namespace

Modules: Utils Classes: Base, Request, Shorten

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#shorten(url = nil) ⇒ Object

Creates a new short URL

url = Dljbz.shorten('http://51qiangda.com')
url.short_url
=> "http://dlj.bz/51qd"

Raises:

  • (ArgumentError)


18
19
20
21
# File 'lib/dljbz.rb', line 18

def shorten(url=nil)
  raise ArgumentError.new("URL to shorten is required") if url.nil? || url.strip.empty?
  Dljbz::Shorten.new(url)
end