class UrlExpander::Expanders::Cligs

Expand Cligs URLS Usage: UrlExpander::Client.expand(“cli.gs/2BAzKa”)

Constants

PATTERN

NOTICE: We ignored the / before the key cli.gs/2BAzKa => '2BAzKa' without /

Attributes

parent_klass[R]

Public Class Methods

new(short_url, options={}) click to toggle source
Calls superclass method UrlExpander::Expanders::API::new
# File lib/url_expander/expanders/api/cligs.rb, line 16
def initialize(short_url, options={})
  @parent_klass = self
  super(short_url,options)
  fetch_url
end

Private Instance Methods

fetch_url() click to toggle source
# File lib/url_expander/expanders/api/cligs.rb, line 30
def fetch_url
  response = Request.get("/api/v1/cligs/expand?clig=#{@shortner_key}").response
  
  case response.response
    when Net::HTTPOK
      @long_url = response.body
    else
      raise UrlExpander::Error.new(response.body,response.code)
  end
end