Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adapter_options to client #169

Merged
merged 3 commits into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/adyen/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@
module Adyen
class Client
attr_accessor :ws_user, :ws_password, :api_key, :oauth_token, :client, :adapter
attr_reader :env, :connection_options
attr_reader :env, :connection_options, :adapter_options

def initialize(ws_user: nil, ws_password: nil, api_key: nil, oauth_token: nil, env: :live, adapter: nil, mock_port: 3001,
live_url_prefix: nil, mock_service_url_base: nil, connection_options: nil)
live_url_prefix: nil, mock_service_url_base: nil, connection_options: nil, adapter_options: nil)
@ws_user = ws_user
@ws_password = ws_password
@api_key = api_key
@oauth_token = oauth_token
@env = env
@adapter = adapter || Faraday.default_adapter
@adapter_options = adapter_options || Faraday.default_adapter_options
@mock_service_url_base = mock_service_url_base || "http://localhost:#{mock_port}"
@live_url_prefix = live_url_prefix
@connection_options = connection_options || Faraday::ConnectionOptions.new
Expand Down Expand Up @@ -118,7 +119,7 @@ def call_adyen_api(service, action, request_data, headers, version, _with_applic

# initialize Faraday connection object
conn = Faraday.new(url, @connection_options) do |faraday|
faraday.adapter @adapter
faraday.adapter @adapter, **@adapter_options
faraday.headers['Content-Type'] = 'application/json'
faraday.headers['User-Agent'] = "#{Adyen::NAME}/#{Adyen::VERSION}"

Expand Down