Sha256: 932d9cc4b661b1cc08303ec7b591ca0733e646ec96c2d10826c7af32ba33b159

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require 'typhoeus'
require 'json'
require 'digest/md5'

require 'zemanta/cache'
require 'zemanta/cache/disk'
require 'zemanta/configuration'
require 'zemanta/configuration/null_storage'
require 'zemanta/fetcher'
require 'zemanta/fetcher/web'
require 'zemanta/fetcher/cache'
require 'zemanta/fetcher/cache/null_response'
require 'zemanta/fetcher/cache/response'
require 'zemanta/fetcher/cache/key'
require 'zemanta/markup'
require "zemanta/markup/link"
require 'zemanta/markup/link/target'

class Zemanta
  def initialize(text)
    @text = text
  end

  def suggest_markup(opts = {})
    Markup.new(suggest_markup_request(opts))
  end

  def self.configure
    yield config
  end

  def self.config
    @configuration ||= Configuration.new
  end

  private

  def suggest_markup_request(opts)
    @response ||= request({ text: @text, method: "zemanta.suggest_markup" }.merge(opts))['markup']
  end

  def request(opts)
    Fetcher.new(opts).post
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zemanta_client-0.0.2 lib/zemanta.rb