Skip to content

Commit

Permalink
- When using settings() to update the client settings, check if the…
Browse files Browse the repository at this point in the history
… description needs to be reloaded due to a version change. (#172)
  • Loading branch information
jwcobb authored Aug 19, 2022
1 parent 7fe7a3a commit 0904d30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 4.4.4 (August 19, 2022)
- When using `settings()` to update the client settings, check if the description needs to be reloaded due to a version change.

## 4.4.3 (July 22, 2022)
- Remove unused `include_tevo_section_mappings` parameter from `listings()` method.

Expand Down
14 changes: 12 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Client
*
* @const string
*/
const VERSION = '4.4.3';
const VERSION = '4.4.4';

/**
* Guzzle service description
Expand Down Expand Up @@ -62,7 +62,9 @@ public function __construct(array $settings = [], array $middleware = [])
$this->settings = $settings;

// Use the TEvoAuth middleware to handle the request signing
$this->middleware = array_merge([new TEvoAuthMiddleware($this->settings['apiToken'], $this->settings['apiSecret'])], $middleware);
$this->middleware = array_merge([
new TEvoAuthMiddleware($this->settings['apiToken'], $this->settings['apiSecret']),
], $middleware);

// Don’t need these anymore
unset($this->settings['apiToken'], $this->settings['apiSecret']);
Expand All @@ -89,8 +91,16 @@ public function __construct(array $settings = [], array $middleware = [])
*/
public function settings(array $settings): Client
{
if (isset($settings['apiVersion']) && $settings['apiVersion'] !== $this->settings['apiVersion']) {
$reloadDescription = true;
}

$this->settings = array_merge($this->settings, $settings);

if ($reloadDescription) {
$this->reloadDescription();
}

if ($this->serviceClient) {
$this->buildClient();
}
Expand Down

0 comments on commit 0904d30

Please sign in to comment.