Module: LoyalSpider::FetchAble::InstanceMethods

Defined in:
lib/loyal_spider/ables/fetch_able.rb

Instance Method Summary collapse

Instance Method Details

#base_urlObject



30
31
32
# File 'lib/loyal_spider/ables/fetch_able.rb', line 30

def base_url
  self.fetch_options.base_url
end

#fetch(options = {}, &block) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/loyal_spider/ables/fetch_able.rb', line 34

def fetch options={}, &block
  self._before_fetch options if self.respond_to?(:_before_fetch, true)
  self.before_fetch options if self.respond_to?(:before_fetch, true)

  result = _perform_fetch options, &block

  if result.success?
    self.after_fetch_success(result) if self.respond_to?(:after_fetch_success, true)
    self._after_fetch_success(result) if self.respond_to?(:_after_fetch_success, true)
  else
    self.after_fetch_fail(result) if self.respond_to?(:after_fetch_fail, true)
    self._after_fetch_fail(result) if self.respond_to?(:_after_fetch_fail, true)
  end

  result
end