Introduces a method called middleware on the Client, that can be used like this:
client = DropboxApi::Client.new
client.middleware.prepend do |connection|
connection.request LoggingMiddleware
end
client.middleware.append do |connection|
connection.use InstrumentationMiddleware
end
The order of middleware is important, so prepend will let you set up the connection before DropboxApi modifies it (via an endpoint's builder.build call – usually in an initializer) and append will let you alter the connection after DropboxApi modifies it.
As the adapter must be the last item of middleware, there's one extra method on the middleware object, adapter=:
# Use the Excon gem instead of Net::HTTP to make requests
client.middleware.adapter = :excon
Addresses #29.
Introduces a method called
middleware
on theClient
, that can be used like this:The order of middleware is important, so
prepend
will let you set up the connection beforeDropboxApi
modifies it (via an endpoint'sbuilder.build
call – usually in an initializer) andappend
will let you alter the connection afterDropboxApi
modifies it.As the
adapter
must be the last item of middleware, there's one extra method on themiddleware
object,adapter=
: