File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed
Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,9 @@ $client->companies->update([
270270
271271/** List Companies */
272272$client->companies->getCompanies([]);
273+
274+ /** Get a company by ID */
275+ $client->companies->getCompany("531ee472cce572a6ec000006");
273276```
274277
275278## Admins
Original file line number Diff line number Diff line change @@ -58,4 +58,28 @@ public function getCompanies($options)
5858 {
5959 return $ this ->client ->get ("companies " , $ options );
6060 }
61+
62+ /**
63+ * Gets a single Company based on the Intercom ID.
64+ *
65+ * @see https://developers.intercom.com/reference#view-a-company
66+ * @param string $id
67+ * @param array $options
68+ * @return mixed
69+ * @throws \GuzzleHttp\Exception\GuzzleException
70+ */
71+ public function getCompany ($ id , $ options = [])
72+ {
73+ $ path = $ this ->companyPath ($ id );
74+ return $ this ->client ->get ($ path , $ options );
75+ }
76+
77+ /**
78+ * @param string $id
79+ * @return string
80+ */
81+ public function companyPath ($ id )
82+ {
83+ return 'companies/ ' . $ id ;
84+ }
6185}
Original file line number Diff line number Diff line change @@ -36,4 +36,20 @@ public function testCompanyGet()
3636 $ companies = new IntercomCompanies ($ stub );
3737 $ this ->assertEquals ('foo ' , $ companies ->getCompanies ([]));
3838 }
39+
40+ public function testCompanyPath ()
41+ {
42+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
43+ $ users = new IntercomCompanies ($ stub );
44+ $ this ->assertEquals ('companies/foo ' , $ users ->companyPath ("foo " ));
45+ }
46+
47+ public function testCompanyGetById ()
48+ {
49+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
50+ $ stub ->method ('get ' )->willReturn ('foo ' );
51+
52+ $ users = new IntercomCompanies ($ stub );
53+ $ this ->assertEquals ('foo ' , $ users ->getCompany ("foo " ));
54+ }
3955}
You can’t perform that action at this time.
0 commit comments