9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/flickr/client/connection.rb', line 9
def connection(options = {})
@connection = Faraday.new(:url => endpoint(options[:secure])) do |builder|
builder.use Faraday::Request::OAuth, authentication_options(options)
builder.use Faraday::Request::Multipart
builder.use Faraday::Request::UrlEncoded
builder.use Faraday::Response::RaiseFlickrError
if (options[:format] or format).to_s == 'json'
builder.use Faraday::Response::ParseJson
else
builder.use Faraday::Response::ParseXml
end
builder.use Faraday::Response::RaiseError
builder.use Faraday::Response::Logger if options[:enable_logging] or enable_logging
builder.adapter adapter
end
end
|