Skip to content

Instantly share code, notes, and snippets.

@eric
Created October 14, 2010 22:08
Show Gist options
  • Save eric/627173 to your computer and use it in GitHub Desktop.
Save eric/627173 to your computer and use it in GitHub Desktop.
def connection
@connection ||= Faraday::Connection.new(:url => @uri.to_s) do |conn|
conn.use Faraday::Request::ActiveSupportJson
conn.adapter Faraday.default_adapter
conn.use Tinder::FaradayResponse::RaiseOnAuthenticationFailure
conn.use Faraday::Response::ActiveSupportJson
conn.use Tinder::FaradayResponse::WithIndifferentAccess
conn.headers['Content-Type'] = 'application/json'
conn.proxy ENV['HTTP_PROXY']
end
end
@campfire.connection.connection.build do |conn|
conn.use Faraday::Request::ActiveSupportJson
conn.adapter :test do |stub|
stub.get('/rooms.json') {[ 200, {}, fixture('rooms.json') ]}
end
conn.use Tinder::FaradayResponse::RaiseOnAuthenticationFailure
conn.use Faraday::Response::ActiveSupportJson
conn.use Tinder::FaradayResponse::WithIndifferentAccess
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment