lib/tumblr/connection.rb in tumblr_client-0.8.2 vs lib/tumblr/connection.rb in tumblr_client-0.8.3
- old
+ new
@@ -3,19 +3,20 @@
module Tumblr
module Connection
def connection(options={})
-
+ options = options.clone
+
default_options = {
:headers => {
:accept => 'application/json',
:user_agent => "tumblr_client (ruby) - #{Tumblr::VERSION}"
},
:url => "http://#{api_host}/"
}
- client = options[:client] ||= Faraday.default_adapter
+ client = options.delete(:client) || Faraday.default_adapter
Faraday.new("http://#{api_host}/", default_options.merge(options)) do |conn|
data = { :api_host => api_host }.merge(credentials)
unless credentials.empty?
conn.request :oauth, data