7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/tumblr/connection.rb', line 7
def connection(options={})
default_options = {
:headers => {
:accept => "application/json",
:user_agent => "Tumblr v1.0"
},
:url => "http://api.tumblr.com/"
}
Faraday.new("http://api.tumblr.com/", default_options.merge(options)) do |builder|
builder.use Tumblr::Request::TumblrOAuth, Tumblr::credentials if not Tumblr::credentials.empty?
builder.use Faraday::Request::UrlEncoded
builder.use FaradayMiddleware::ParseJson, :content_type => "application/json"
builder.use Faraday::Adapter::NetHttp
end
end
|