| Server IP : 82.208.35.60 / Your IP : 216.73.216.89 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/air-sport_cz/www/modules/ps_eventbus/src/Api/ |
Upload File : |
<?php
namespace PrestaShop\Module\PsEventbus\Api;
use GuzzleHttp\Client;
use Link;
use PrestaShop\Module\PsEventbus\Exception\EnvVarException;
use PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts;
class EventBusSyncClient extends GenericClient
{
/**
* @var string
*/
private $baseUrl;
/**
* EventBusSyncClient constructor.
*
* @param Link $link
* @param PsAccounts $psAccountsService
* @param string $baseUrl
*
* @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException
* @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleVersionException
*/
public function __construct(Link $link, PsAccounts $psAccountsService, $baseUrl)
{
$this->baseUrl = $baseUrl;
$this->setLink($link);
$token = $psAccountsService->getPsAccountsService()->getOrRefreshToken();
$client = new Client([
'base_url' => $this->baseUrl,
'defaults' => [
'timeout' => $this->timeout,
'exceptions' => $this->catchExceptions,
'headers' => [
'Accept' => 'application/json',
'Authorization' => "Bearer $token",
],
],
]);
parent::__construct($client);
}
/**
* @param string $jobId
*
* @return array|bool
*
* @throws EnvVarException
*/
public function validateJobId($jobId)
{
$this->setRoute($this->baseUrl . "/job/$jobId");
return $this->get();
}
}