class UrlExpander::Expanders::Xrlus

Expand Xrl.us URLS – metamark.net/ Usage: UrlExpander::Client.expand(“xrl.us/bkz5iy”)

Constants

PATTERN

NOTICE: We ignored the / before the key xrl.us/bkz5iy => 'bkz5iy' without /

Attributes

parent_klass[R]
short_url[R]

Public Class Methods

new(short_url, options={}) click to toggle source
# File lib/url_expander/expanders/api/xrlus.rb, line 16
def initialize(short_url, options={})
  @parent_klass = self
  @short_url = short_url
  fetch_url
end

Private Instance Methods

fetch_url() click to toggle source
# File lib/url_expander/expanders/api/xrlus.rb, line 30
def fetch_url
  data = Request.get("/api/rest/simple?short_url=#{@short_url}").response.body
  unless(data[0..5] == 'ERROR:')
    @long_url = data
  else
    raise UrlExpander::Error.new(data,404)
  end
end