Skip to content

Commit

Permalink
Add delete company
Browse files Browse the repository at this point in the history
  • Loading branch information
emilsundberg committed Jun 19, 2021
1 parent 51982e4 commit 285c111
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,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

0 comments on commit 285c111

Please sign in to comment.