From 85b9220c1ffce2384029145afd119ff9ac623d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 13 Aug 2021 11:03:24 +0200 Subject: [PATCH 1/3] tokens to CrmApiV2 contructor --- src/CrmApiV2.php | 7 +++++-- src/Transport/ApiInterface.php | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CrmApiV2.php b/src/CrmApiV2.php index 134c16e..6377d03 100644 --- a/src/CrmApiV2.php +++ b/src/CrmApiV2.php @@ -22,9 +22,12 @@ class CrmApiV2 */ private static $apiInterface; - public function __construct() + public function __construct(string $bearerToken = null, string $bearerPwd = null) { - self::$apiInterface = self::$apiInterface ?: new ApiInterface(); + self::$apiInterface = self::$apiInterface ?: new ApiInterface( + $bearerToken, + $bearerPwd + ); return $this; } diff --git a/src/Transport/ApiInterface.php b/src/Transport/ApiInterface.php index 4fda294..93fbd5e 100644 --- a/src/Transport/ApiInterface.php +++ b/src/Transport/ApiInterface.php @@ -58,8 +58,10 @@ class ApiInterface */ protected static $apiToken; - public function __construct() + public function __construct(string $bearerToken = null, string $bearerPwd = null) { + static::$bearerToken = static::$bearerToken ?: $bearerToken; + static::$bearerPwd = static::$bearerPwd ?: $bearerPwd; static::$bearerToken = static::$bearerToken ?: Utils::getConfig('crm.token'); static::$bearerPwd = static::$bearerPwd ?: Utils::getConfig('crm.password'); static::$endpoint = static::$endpoint ?: Utils::getConfig('crm.endpoint'); From af980de8149010364a83ff4eff3c3bee68df47b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 13 Aug 2021 11:06:27 +0200 Subject: [PATCH 2/3] fix typo saveOrUpdateUserToTable --- src/WordPress/WPCrm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WordPress/WPCrm.php b/src/WordPress/WPCrm.php index 7c1dc8a..231b8c6 100644 --- a/src/WordPress/WPCrm.php +++ b/src/WordPress/WPCrm.php @@ -495,7 +495,7 @@ class WPCrm * * @return void */ - private static function _saveOrUpdateUserToTable() + private static function saveOrUpdateUserToTable() { if (self::getUserToTable(self::$user->crm_id)) { self::query( From 9292cb029b47b859c5e77fc154b49d6caf2f2b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 13 Aug 2021 11:07:14 +0200 Subject: [PATCH 3/3] bump version to 2.0.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ad74c61..48b30de 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "library", "description": "LDC CRM Client V2", "license": "MIT", - "version": "2.0.4", + "version": "2.0.5", "authors": [ { "name": "Jérémy Munsch",