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