require 'faraday_middleware' Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f} module Sambatech # @private module Connection private def connection(raw=false) options = { :headers => {'Accept' => "application/xml; charset=utf-8", 'User-Agent' => user_agent}, :proxy => proxy, :ssl => {:verify => false}, :url => endpoint, :params => {:key => key}, } Faraday::Connection.new(options) do |connection| connection.use Faraday::Request::UrlEncoded connection.use FaradayMiddleware::Mashify unless raw unless raw connection.use Faraday::Response::ParseXml end connection.use FaradayMiddleware::RaiseHttpException connection.adapter(adapter) end end end end