Class: UrlExpander::Expanders::Digbig

Inherits:
Basic
  • Object
show all
Defined in:
lib/url_expander/expanders/basic/digbig.rb

Overview

Expand Digbig URLS Usage: UrlExpander::Client.expand(“digbig.com/3bbd”)

Defined Under Namespace

Classes: Request

Constant Summary collapse

PATTERN =
%r'(http://(?:(?>[a-z0-9-]*\.)+?|)digbig\.com(/[\w/]+))'

Instance Attribute Summary collapse

Attributes inherited from Basic

#long_url, #parttern

Instance Method Summary collapse

Constructor Details

#initialize(short_url = "", options = {}) ⇒ Digbig

Returns a new instance of Digbig.



12
13
14
15
# File 'lib/url_expander/expanders/basic/digbig.rb', line 12

def initialize(short_url="", options={})
  @parent_klass = self
  super(short_url, options)
end

Instance Attribute Details

#parent_klassObject (readonly)

Returns the value of attribute parent_klass.



10
11
12
# File 'lib/url_expander/expanders/basic/digbig.rb', line 10

def parent_klass
  @parent_klass
end

Instance Method Details

#fetch_url(path) ⇒ Object

Custom fetcher.

Raises:



18
19
20
21
22
# File 'lib/url_expander/expanders/basic/digbig.rb', line 18

def fetch_url(path)
  url = super(path)
  raise UrlExpander::Error.new('page not found',404) if url == "/error_404.html"
  url
end