Skip to content

Commit 9ffdbcb

Browse files
authored
fix adapter options for faraday 1.x, fixes #177 (#178)
* fix adapter options for faraday 1.x, fixes #177 * fix initialize * revert initialize, add option for faraday1.x
1 parent e4694a3 commit 9ffdbcb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/adyen/client.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, e
2323
@oauth_token = oauth_token
2424
@env = env
2525
@adapter = adapter || Faraday.default_adapter
26-
@adapter_options = adapter_options || Faraday.default_adapter_options
26+
if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.1')
27+
# for faraday 2.1 and higher
28+
@adapter_options = adapter_options || Faraday.default_adapter_options
29+
else
30+
# for faraday 1.x and 2.0
31+
@adapter_options = adapter_options || {}
32+
end
2733
@mock_service_url_base = mock_service_url_base || "http://localhost:#{mock_port}"
2834
@live_url_prefix = live_url_prefix
2935
@connection_options = connection_options || Faraday::ConnectionOptions.new

0 commit comments

Comments
 (0)