Class: Zemanta::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/zemanta/fetcher.rb,
lib/zemanta/fetcher/web.rb,
lib/zemanta/fetcher/cache.rb,
lib/zemanta/fetcher/parser.rb,
lib/zemanta/fetcher/cache/key.rb,
lib/zemanta/fetcher/cache/response.rb,
lib/zemanta/fetcher/cache/null_response.rb

Defined Under Namespace

Classes: Cache, Parser, Web

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Fetcher

Returns a new instance of Fetcher.



3
4
5
# File 'lib/zemanta/fetcher.rb', line 3

def initialize(opts = {})
  @opts = opts
end

Instance Method Details

#postObject



7
8
9
10
11
# File 'lib/zemanta/fetcher.rb', line 7

def post
  @response = cache.fetch || web.fetch
  cache.save(@response)
  parse(@response)
end