mirror of
https://github.com/opdavies/glassboxx-sdk-php.git
synced 2025-02-17 22:50:48 +00:00
Make the Client parameter optional for requests
Make the Client parameter optional when creating auth token, customer or order requests, and create a new Client instance within the abstract request if one isn't passed in.
This commit is contained in:
parent
532dfd43a1
commit
2ba89e1c6a
10 changed files with 15 additions and 14 deletions
|
|
@ -13,13 +13,17 @@ abstract class AbstractRequest
|
|||
{
|
||||
use UsesConfigTrait;
|
||||
|
||||
public const BASE_URL = 'https://server.glassboxx.co.uk/rest/V1';
|
||||
public const BASE_URL = 'https://server.glassboxx.co.uk';
|
||||
|
||||
/** @var HttpClient */
|
||||
protected $client;
|
||||
|
||||
public function __construct(HttpClientInterface $client)
|
||||
public function __construct(HttpClientInterface $client = null)
|
||||
{
|
||||
if (!$client) {
|
||||
$client = HttpClient::createForBaseUri(self::BASE_URL);
|
||||
}
|
||||
|
||||
$this->client = $client;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue