diff --git a/lib/recurly/base_client.php b/lib/recurly/base_client.php index 691a2d7d..0c4c06ed 100644 --- a/lib/recurly/base_client.php +++ b/lib/recurly/base_client.php @@ -23,10 +23,13 @@ abstract class BaseClient * * @param string $api_key The API key to use when making requests */ - public function __construct(string $api_key, LoggerInterface $logger = null) + public function __construct(string $api_key, LoggerInterface $logger = null, HttpAdapterInterface $http_adapter = null) { $this->_api_key = $api_key; - $this->http = new HttpAdapter; + if (is_null($http_adapter)) { + $http_adapter = new HttpAdapter; + } + $this->http = $http_adapter; if (is_null($logger)) { $logger = new \Recurly\Logger('Recurly', LogLevel::WARNING); } diff --git a/lib/recurly/http_adapter_interface.php b/lib/recurly/http_adapter_interface.php new file mode 100644 index 00000000..843e7a5b --- /dev/null +++ b/lib/recurly/http_adapter_interface.php @@ -0,0 +1,11 @@ +