Sha256: 4e696901664e80d2a8c844099763a6e5b2ae4e158eedd78da73a1a58f0a44fca

Contents?: true

Size: 625 Bytes

Versions: 6

Compression:

Stored size: 625 Bytes

Contents

module Zemanta
  class Configuration
    attr_accessor :custom_request_opts, :format, :api_key, :cache_storage

    def initialize
      @custom_request_opts = {}
      @format = "json"
      @cache_storage = NullStorage.new
    end

    def request_opts
      {
        api_key: actual_api_key,
        format: @format
      }.merge(@custom_request_opts)
    end

    def end_point
      "http://api.zemanta.com/services/rest/0.0/"
    end

    private

    def actual_api_key
      @api_key || ENV["ZEMANTA_KEY"] or raise "You need to specify ZEMANTA_KEY in your environment or set api_key in your config"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zemanta_client-0.0.8 lib/zemanta/configuration.rb
zemanta_client-0.0.7 lib/zemanta/configuration.rb
zemanta_client-0.0.6 lib/zemanta/configuration.rb
zemanta_client-0.0.5 lib/zemanta/configuration.rb
zemanta_client-0.0.4 lib/zemanta/configuration.rb
zemanta_client-0.0.3 lib/zemanta/configuration.rb