Sha256: 16b431dff0590440f9251ada9dccc44a1ec8ee9988000416f5b46e53a6984ca8

Contents?: true

Size: 564 Bytes

Versions: 7

Compression:

Stored size: 564 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$/ unless config.raw
        conn.adapter config.adapter
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
taric-0.3.4 lib/taric/connection.rb
taric-0.3.3 lib/taric/connection.rb
taric-0.3.1 lib/taric/connection.rb
taric-0.3.0 lib/taric/connection.rb
taric-0.2.4 lib/taric/connection.rb
taric-0.2.2 lib/taric/connection.rb
taric-0.2.1 lib/taric/connection.rb