Sha256: 2ef28ce5c07dc34ed17caae9e00bc92ce02b7eda9e6ae6e8b1fa588682d6d066
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'faraday_middleware' Dir[File.expand_path('../../faraday/*.rb', __FILE__)].each{|f| require f} module Thounds # @private module Connection private def connection(raw=false) options = { :headers => {'Accept' => "application/#{format}", 'User-Agent' => user_agent}, :proxy => proxy, :ssl => {:verify => false}, :url => api_endpoint, } Faraday::Connection.new(options) do |connection| connection.use Faraday::Request::Multipart connection.use Faraday::Request::OAuth, authentication if authenticated? connection.adapter(adapter) connection.use Faraday::Response::RaiseHttp5xx unless raw case format.to_s.downcase when 'json' then connection.use Faraday::Response::ParseJson when 'xml' then connection.use Faraday::Response::ParseXml end end connection.use Faraday::Response::RaiseHttp4xx connection.use Faraday::Response::Mashify unless raw end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
thounds-0.0.2 | lib/thounds/connection.rb |
thounds-0.0.1 | lib/thounds/connection.rb |