Sha256: fdbb5c2733e2227c990d0d5091d14dafc812017168979a26fccecfc18bb7120b
Contents?: true
Size: 554 Bytes
Versions: 1
Compression:
Stored size: 554 Bytes
Contents
class Zemanta class Fetcher extend ActiveSupport::Autoload autoload :Cache autoload :Web def initialize(opts = {}) @opts = opts end def post @response = cache.fetch || web.fetch cache.save(@response) parse(@response) end private def cache @cache ||= Cache.new(@opts) end def web Web.new(request_opts) end def parse(data) JSON.parse(data) end def request_opts @request_opts ||= Zemanta.config.request_opts.merge(@opts) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zemanta_client-0.0.1 | lib/zemanta/fetcher.rb |