File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -28,4 +28,23 @@ public function getAdmins($options = [])
2828 {
2929 return $ this ->client ->get ("admins " , $ options );
3030 }
31+
32+ /**
33+ * Gets a single Admin based on the Intercom ID.
34+ * @see https://developers.intercom.com/v2.0/reference#view-an-admin
35+ * @param integer $id
36+ * @param array $options
37+ * @return mixed
38+ * @throws \GuzzleHttp\Exception\GuzzleException
39+ */
40+ public function getAdmin ($ id , $ options = [])
41+ {
42+ $ path = $ this ->adminPath ($ id );
43+ return $ this ->client ->get ($ path , $ options );
44+ }
45+
46+ public function adminPath ($ id )
47+ {
48+ return 'admins/ ' . $ id ;
49+ }
3150}
Original file line number Diff line number Diff line change @@ -11,4 +11,21 @@ public function testAdminsList()
1111 $ users = new IntercomAdmins ($ stub );
1212 $ this ->assertEquals ('foo ' , $ users ->getAdmins ());
1313 }
14+
15+ public function testAdminsGet ()
16+ {
17+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
18+ $ stub ->method ('get ' )->willReturn ('foo ' );
19+
20+ $ users = new IntercomAdmins ($ stub );
21+ $ this ->assertEquals ('foo ' , $ users ->getAdmin (1 ));
22+ }
23+
24+ public function testAdminsGetPath ()
25+ {
26+ $ stub = $ this ->getMockBuilder ('Intercom\IntercomClient ' )->disableOriginalConstructor ()->getMock ();
27+
28+ $ users = new IntercomAdmins ($ stub );
29+ $ this ->assertEquals ('admins/1 ' , $ users ->adminPath (1 ));
30+ }
1431}
You can’t perform that action at this time.
0 commit comments