lib/tumblr/connection.rb in tumblr_client-0.6.9 vs lib/tumblr/connection.rb in tumblr_client-0.6.11

- old
+ new

@@ -8,13 +8,14 @@ default_options = { :headers => { :accept => "application/json", :user_agent => "Tumblr v1.0" }, - :url => "http://api.tumblr.com/" + :url => "http://#{api_host}/" } - Faraday.new("http://api.tumblr.com/", default_options.merge(options)) do |builder| - builder.use Tumblr::Request::TumblrOAuth, Tumblr::credentials if not Tumblr::credentials.empty? + Faraday.new("http://#{api_host}/", default_options.merge(options)) do |builder| + data = { :api_host => api_host }.merge(credentials) + builder.use Tumblr::Request::TumblrOAuth, data unless credentials.empty? builder.use Faraday::Request::UrlEncoded builder.use FaradayMiddleware::ParseJson, :content_type => "application/json" builder.use Faraday::Adapter::NetHttp end end