File tree Expand file tree Collapse file tree 6 files changed +92
-0
lines changed Expand file tree Collapse file tree 6 files changed +92
-0
lines changed Original file line number Diff line number Diff line change 1717 * [ Releases] ( repo/releases.md )
1818 * [ Assets] ( repo/assets.md )
1919* [ Users] ( users.md )
20+ * [ Meta] ( meta.md )
2021
2122Additional features:
2223
Original file line number Diff line number Diff line change 1+ ## Users API
2+ [ Back to the navigation] ( index.md )
3+
4+
5+ Wrap [ GitHub User API] ( http://developer.github.com/v3/meta/ ) .
6+
7+ ### Get information about GitHub services
8+
9+ ``` php
10+ $service = $client->api('meta')->service();
11+ ```
12+
13+ return
14+
15+ ```
16+ array(3) {
17+ 'verifiable_password_authentication' => bool
18+ 'hooks' =>
19+ array(1) {
20+ [0] =>
21+ string(15) "127.0.0.1/22"
22+ }
23+ 'git' =>
24+ array(1) {
25+ [0] =>
26+ string(15) "127.0.0.1/22"
27+ }
28+ }
29+ ```
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Github \Api ;
4+
5+ /**
6+ * Getting GitHub service information
7+ *
8+ * @link https://developer.github.com/v3/meta/
9+ * @author Claude Dioudonnat <[email protected] > 10+ */
11+ class Meta extends AbstractApi
12+ {
13+ /**
14+ * Get the ip address of the hook and git servers for the github.com service
15+ *
16+ * @return array Informations about the service of github.com
17+ */
18+ public function service ()
19+ {
20+ return $ this ->get ('meta ' );
21+ }
22+ }
Original file line number Diff line number Diff line change @@ -139,6 +139,10 @@ public function api($name)
139139 $ api = new Api \Authorizations ($ this );
140140 break ;
141141
142+ case 'meta ' :
143+ $ api = new Api \Meta ($ this );
144+ break ;
145+
142146 default :
143147 throw new InvalidArgumentException (sprintf ('Undefined api instance called: "%s" ' , $ name ));
144148 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Github \Tests \Api ;
4+
5+ class MetaTest extends TestCase
6+ {
7+ /**
8+ * @test
9+ */
10+ public function shouldGetInformationService ()
11+ {
12+ $ expectedArray = array (
13+ 'hooks ' => array (
14+ '127.0.0.1/32 '
15+ ),
16+ 'git ' => array (
17+ '127.0.0.1/32 '
18+ ),
19+ 'verifiable_password_authentication ' => true
20+ );
21+
22+ $ api = $ this ->getApiMock ();
23+ $ api ->expects ($ this ->once ())
24+ ->method ('get ' )
25+ ->will ($ this ->returnValue ($ expectedArray ));
26+
27+ $ this ->assertEquals ($ expectedArray , $ api ->service ());
28+ }
29+
30+ protected function getApiClass ()
31+ {
32+ return 'Github\Api\Meta ' ;
33+ }
34+ }
Original file line number Diff line number Diff line change @@ -168,6 +168,8 @@ public function getApiClassesProvider()
168168
169169 array ('authorization ' , 'Github\Api\Authorizations ' ),
170170 array ('authorizations ' , 'Github\Api\Authorizations ' ),
171+
172+ array ('meta ' , 'Github\Api\Meta ' )
171173 );
172174 }
173175
You can’t perform that action at this time.
0 commit comments