From 3e4cdc338f4ad5ad83d77961437ee70cab4909ed Mon Sep 17 00:00:00 2001 From: webeweb Date: Tue, 21 Feb 2023 17:34:47 +0100 Subject: [PATCH] Update dependencies --- composer.json | 2 +- src/Provider/AbstractProvider.php | 9 ++++----- src/Request/AbstractRequest.php | 10 ++-------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 61035dc..5b29e46 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "ext-json": "*", "guzzlehttp/guzzle": "^6.0|^7.0", "psr/log": "^1.0", - "webeweb/core-library": "^8.0" + "webeweb/core-library": "^8.69" }, "require-dev": { "phpunit/phpunit": "^7.0|^9.0" diff --git a/src/Provider/AbstractProvider.php b/src/Provider/AbstractProvider.php index d025702..2a9d1ce 100644 --- a/src/Provider/AbstractProvider.php +++ b/src/Provider/AbstractProvider.php @@ -56,7 +56,7 @@ public function __construct(string $apiToken = null, LoggerInterface $logger = n } /** - * Build the configuration. + * Builds the configuration. * * @return array Returns the configuration. */ @@ -74,7 +74,7 @@ private function buildConfiguration(): array { } /** - * Call the API. + * Calls the API. * * @param AbstractRequest $request The request. * @param array $queryData The query data. @@ -87,7 +87,7 @@ private function buildConfiguration(): array { protected function callApi(AbstractRequest $request, array $queryData, bool $apiToken = true): string { if (true === $apiToken && null === $this->getApiToken()) { - throw new InvalidArgumentException('The mandatory parameter "api_token" is missing'); + throw $this->newMandatoryParameterException("api_token"); } $query = true === $apiToken ? ["api_token" => $this->getApiToken()] : []; @@ -95,11 +95,10 @@ protected function callApi(AbstractRequest $request, array $queryData, bool $api try { $config = $this->buildConfiguration(); - $client = new Client($config); $method = "GET"; - $uri = substr($request->getResourcePath(), 1); + $uri = substr($this->buildResourcePath($request), 1); $options = [ "query" => array_merge($query, $queryData), ]; diff --git a/src/Request/AbstractRequest.php b/src/Request/AbstractRequest.php index f4fa6a7..81ab8bd 100644 --- a/src/Request/AbstractRequest.php +++ b/src/Request/AbstractRequest.php @@ -12,6 +12,7 @@ namespace WBW\Library\Pappers\Request; use WBW\Library\Pappers\Response\AbstractResponse; +use WBW\Library\Provider\Request\AbstractRequest as BaseRequest; /** * Abstract request. @@ -20,7 +21,7 @@ * @package WBW\Library\Pappers\Request * @abstract */ -abstract class AbstractRequest { +abstract class AbstractRequest extends BaseRequest { /** * Constructor. @@ -37,13 +38,6 @@ public function __construct() { */ abstract public function deserializeResponse(string $rawResponse): AbstractResponse; - /** - * Get the resource path. - * - * @return string Returns the resource path. - */ - abstract public function getResourcePath(): string; - /** * Serializes the request. *