Sha256: 6eb14caa50b7d8160eaa9bd63384386228ce73b308e4d17a7d226245ee4039de

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

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

module Rhymba
  # @private
  module Connection
    private

    def connection
      options = {
        :headers => post_header,
        :proxy => proxy,
        :url => endpoint,
        :ssl => { :ca_path => ca_path, :ca_file => ca_file },
      }

      Faraday::Connection.new(options) do |connection|
        Array(middlewares).each do |middleware|
          connection.use middleware
        end
        connection.use Faraday::Request::Multipart
        connection.use Faraday::Request::UrlEncoded
        connection.use Faraday::Response::ParseJson
        connection.use FaradayMiddleware::RaiseHttpException
        connection.adapter(adapter)
        
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rhymba-api-0.0.1 lib/rhymba/connection.rb