Skip to content

Commit 285c111

Browse files
committed
Add delete company
1 parent 51982e4 commit 285c111

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ $client->companies->update([
371371
'name' => 'foocorp',
372372
]);
373373

374+
/** Delete a company by ID */
375+
$client->companies->delete('531ee472cce572a6ec000006');
376+
374377
/** List Companies */
375378
$client->companies->getCompanies([]);
376379

src/IntercomCompanies.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ public function update($options)
3232
{
3333
return $this->create($options);
3434
}
35+
36+
/**
37+
* Deletes a Company.
38+
*
39+
* @see https://developers.intercom.com/intercom-api-reference/reference#delete-a-company
40+
* @param array $options
41+
* @return stdClass
42+
* @throws Exception
43+
*/
44+
public function delete($id, $options = [])
45+
{
46+
$path = $this->companyPath($id);
47+
return $this->client->delete($path, $options);
48+
}
3549

3650
/**
3751
* Attaches a Contact to a Company.

tests/IntercomCompaniesTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ public function testCompanyGet()
2929
$companies = new IntercomCompanies($this->client);
3030
$this->assertSame('foo', $companies->getCompanies([]));
3131
}
32+
33+
public function testCompanyDelete()
34+
{
35+
$this->client->method('delete')->willReturn('foo');
36+
37+
$companies = new IntercomCompanies($this->client);
38+
$this->assertSame('foo', $companies->delete(''));
39+
}
3240

3341
public function testCompanyPath()
3442
{

0 commit comments

Comments
 (0)