From 9f86bcbd4cb2b5610e4ea070bc4e19ae64470b13 Mon Sep 17 00:00:00 2001 From: Ryan Davies Date: Wed, 11 Jan 2023 17:18:38 +0000 Subject: [PATCH] Add delete customer endpoint --- src/Customers/CustomersEndpoint.php | 7 +++++++ tests/Customers/CustomerClientIntegrationTest.php | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Customers/CustomersEndpoint.php b/src/Customers/CustomersEndpoint.php index 83749d40..3b91b4fb 100644 --- a/src/Customers/CustomersEndpoint.php +++ b/src/Customers/CustomersEndpoint.php @@ -68,6 +68,13 @@ public function list( ); } + public function delete(int $customerId): void + { + $this->restClient->deleteResource( + sprintf('/v2/customers/%d', $customerId) + ); + } + /** * @return Customer[]|PagedCollection */ diff --git a/tests/Customers/CustomerClientIntegrationTest.php b/tests/Customers/CustomerClientIntegrationTest.php index f5d4d5e0..acc9191f 100644 --- a/tests/Customers/CustomerClientIntegrationTest.php +++ b/tests/Customers/CustomerClientIntegrationTest.php @@ -307,4 +307,15 @@ public function testGetCustomersLazyLoadsPages() ['GET', 'https://api.helpscout.net/v2/customers?page=2'], ]); } + + public function testDeleteCustomer() + { + $this->stubResponse($this->getResponse(201)); + $this->client->customers()->delete(1); + + $this->verifySingleRequest( + 'https://api.helpscout.net/v2/customers/1', + 'DELETE' + ); + } }