Closed nelgau closed 10 years ago
I really like this change. Thanks @nelgau. This should open up all sorts of interesting new funtionality from your adapter of choice ;)
On Sunday, November 24, 2013, Nelson Gauthier wrote:
Although Saddle permits the specification of arbitrary Faraday adapters, there's presently no way to pass arguments to the initializer. This pull request extends the :http_adapter client option to specify both in a backward-compatible manner. Now it's possible to make good use of all third-party adapters. ;)
def self.http_adapter { :key => :thrawn, :args => [{ :strategy => :synapse, :down_failures => 2, :down_retry_delay => 30, :max_requests => 100 }] }end
The decision to use :key to designate the registered symbol of an adapter middleware was motivated by the internal name given to it in Faraday. See https://github.com/lostisland/faraday/blob/master/lib/faraday/rack_builder.rb#L99 .
/cc @mLewisLogic https://github.com/mLewisLogic
You can merge this Pull Request by running
git pull https://github.com/mLewisLogic/saddle adapter-args
Or view, comment on, or merge it at:
https://github.com/mLewisLogic/saddle/pull/6 Commit Summary
- Allow passing arguments to an adapter's initializer
File Changes
- M lib/saddle/options.rbhttps://github.com/mLewisLogic/saddle/pull/6/files#diff-0(3)
- M lib/saddle/requester.rbhttps://github.com/mLewisLogic/saddle/pull/6/files#diff-1(9)
Patch Links:
I'll merge this and push a new version to our local gem repository.
Although Saddle permits the specification of arbitrary Faraday adapters, there's presently no way to pass arguments to the initializer. This pull request extends the
:http_adapter
client option to specify both in a backward-compatible manner. Now it's possible to make good use of all third-party adapters. ;)The decision to use
:key
to designate the registered symbol of an adapter middleware was motivated by the internal name given to it in Faraday. See https://github.com/lostisland/faraday/blob/master/lib/faraday/rack_builder.rb#L99./cc @mLewisLogic