Sha256: 5d2aeefc4d9240d77fcee722d898dca0f9b393c9f6da1e88f06580a9b8a09eb6

Contents?: true

Size: 835 Bytes

Versions: 2

Compression:

Stored size: 835 Bytes

Contents

require 'faraday_middleware'
Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f}

module EPayCo
  # @private
  module Connection
    private

    def connection(raw=false)
      options = {
        :headers => {
          'Accept' => "application/json; charset=utf-8;",
          'Content-Type' => "application/json",
          'User-Agent' => user_agent},
        :proxy => proxy,
        :url => endpoint,
      }.merge(connection_options)

      Faraday::Connection.new(options) do |connection|
        connection.use Faraday::Request::UrlEncoded
        unless raw
          connection.use FaradayMiddleware::Mashify 
          connection.use Faraday::Response::ParseJson
        end
        connection.use FaradayMiddleware::RaiseHttpException
        connection.adapter(adapter)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
epayco-0.0.3 lib/epayco/connection.rb
epayco-0.0.2 lib/epayco/connection.rb