Sha256: b7ed12ed582fc1e1b836cdb28c1d1ef7d42565fc6b57554220da53095a818ea0

Contents?: true

Size: 512 Bytes

Versions: 1

Compression:

Stored size: 512 Bytes

Contents

require 'faraday_middleware'

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 FaradayMiddleware::Mashify
        conn.response :raise_error
        conn.response :json, :content_type => /\bjson$/
        conn.adapter config.adapter
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
taric-0.1.4 lib/taric/connection.rb