Merge tag '2.0.5'

This commit is contained in:
Jérémy Munsch 2021-08-17 11:14:27 +02:00
commit c9af0afe07
4 changed files with 10 additions and 5 deletions

View file

@ -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",

View file

@ -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;
}

View file

@ -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');

View file

@ -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(