Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,9 @@ $client->companies->update([
'name' => 'foocorp',
]);

/** Delete a company by ID */
$client->companies->delete('531ee472cce572a6ec000006');

/** List Companies */
$client->companies->getCompanies([]);

Expand Down
14 changes: 14 additions & 0 deletions src/IntercomCompanies.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ public function update($options)
{
return $this->create($options);
}

/**
* Deletes a Company.
*
* @see https://developers.intercom.com/intercom-api-reference/reference#delete-a-company
* @param array $options
* @return stdClass
* @throws Exception
*/
public function delete($id, $options = [])
{
$path = $this->companyPath($id);
return $this->client->delete($path, $options);
}

/**
* Attaches a Contact to a Company.
Expand Down
8 changes: 8 additions & 0 deletions tests/IntercomCompaniesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public function testCompanyGet()
$companies = new IntercomCompanies($this->client);
$this->assertSame('foo', $companies->getCompanies([]));
}

public function testCompanyDelete()
{
$this->client->method('delete')->willReturn('foo');

$companies = new IntercomCompanies($this->client);
$this->assertSame('foo', $companies->delete(''));
}

public function testCompanyPath()
{
Expand Down