11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/bitbucket_rest_api/middleware.rb', line 11
def self.default(options = {})
api = options[:api]
proc do |builder|
builder.use BitBucket::Request::Jsonize
builder.use Faraday::Request::UrlEncoded
builder.use Faraday::Request::Multipart
builder.use BitBucket::Request::OAuth, {:consumer_key => api.client_id, :consumer_secret => api.client_secret, :token => api.oauth_token, :token_secret => api.oauth_secret} if api.client_id? and api.client_secret?
builder.use BitBucket::Request::BasicAuth, api.authentication if api.basic_authed?
builder.use Faraday::Response::Logger if ENV['DEBUG']
unless options[:raw]
builder.use BitBucket::Response::Mashify
builder.use BitBucket::Response::Jsonize
end
builder.use BitBucket::Response::RaiseError
builder.adapter options[:adapter]
end
end
|