-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Intercom; | ||
|
||
use Http\Client\Exception; | ||
use stdClass; | ||
|
||
class IntercomTeams extends IntercomResource | ||
{ | ||
/** | ||
* Returns list of Teams. | ||
* | ||
* @see https://developers.intercom.io/reference#list-teams | ||
* @param array $options | ||
* @return stdClass | ||
* @throws Exception | ||
*/ | ||
public function getTeams($options = []) | ||
{ | ||
return $this->client->get("teams", $options); | ||
} | ||
|
||
/** | ||
* Gets a single Team based on the Intercom ID. | ||
* | ||
* @see https://developers.intercom.com/reference#view-a-team | ||
* @param integer $id | ||
* @param array $options | ||
* @return stdClass | ||
* @throws Exception | ||
*/ | ||
public function getTeam($id, $options = []) | ||
{ | ||
$path = $this->teamPath($id); | ||
return $this->client->get($path, $options); | ||
} | ||
|
||
/** | ||
* Returns endpoint path to Team with given ID. | ||
* | ||
* @param string $id | ||
* @return string | ||
*/ | ||
public function teamPath($id) | ||
{ | ||
return 'teams/' . $id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Intercom\Test; | ||
|
||
use Intercom\IntercomTeams; | ||
|
||
class IntercomTeamsTest extends TestCase | ||
{ | ||
public function testTeamsList() | ||
{ | ||
$this->client->method('get')->willReturn('foo'); | ||
|
||
$teams = new IntercomTeams($this->client); | ||
$this->assertSame('foo', $teams->getTeams()); | ||
} | ||
|
||
public function testTeamsGet() | ||
{ | ||
$this->client->method('get')->willReturn('foo'); | ||
|
||
$teams = new IntercomTeams($this->client); | ||
$this->assertSame('foo', $teams->getTeam(1)); | ||
} | ||
|
||
public function testTeamsGetPath() | ||
{ | ||
$teams = new IntercomTeams($this->client); | ||
$this->assertSame('teams/1', $teams->teamPath(1)); | ||
} | ||
} |