Sha256: 4edefbaa21d4d3a36d33a1dadccc8f1c50ee44eb9cc401bf3020b3134f35341e

Contents?: true

Size: 546 Bytes

Versions: 6

Compression:

Stored size: 546 Bytes

Contents

require 'faraday_middleware/parse_oj'
require 'taric/faraday_middleware/http_exception'

module Taric
  module Connection
    def connection(config)
      options = {
          :headers => {'Accept' => "application/#{config.format}; charset=utf-8", 'User-Agent' => config.user_agent}
      }.merge(config.connection_opts)

      Faraday::Connection.new(options) do |conn|
        conn.use Taric::FaradayMiddleware::HttpException
        conn.response :oj, :content_type => /\bjson$/
        conn.adapter config.adapter
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
taric-0.2.0 lib/taric/connection.rb
taric-0.1.14 lib/taric/connection.rb
taric-0.1.13 lib/taric/connection.rb
taric-0.1.12 lib/taric/connection.rb
taric-0.1.11 lib/taric/connection.rb
taric-0.1.10 lib/taric/connection.rb