12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/admincredible/connection.rb', line 12
def build_connection
Faraday.new(config.connection_options) do |builder|
builder.use Faraday::Response::RaiseError
builder.use Admincredible::Middleware::Response::Logger, config.logger if config.logger
builder.response :json, :content_type => 'application/json'
builder.use Faraday::Request::OAuth, config.oauth_options if config.oauth?
builder.request :multipart
builder.request :json
builder.request :retry, 2 unless config.oauth?
builder.request :step unless config.oauth?
builder.adapter config.adapter || Faraday.default_adapter
end
end
|