File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ $gists = $github->api('gists')->all();
3737$gist = $github->api('gists')->show(1);
3838```
3939
40+ #### Get a specific revision of a gist
41+
42+ ``` php
43+ $gist = $github->api('gists')->show(1, 'd189dbd4c5d96442db74ebcb62bb38e661a0c8ce');
44+ ```
45+
4046#### Get commits for a single gist
4147
4248``` php
Original file line number Diff line number Diff line change @@ -51,6 +51,21 @@ public function show($number)
5151 return $ this ->get ('/gists/ ' .rawurlencode ($ number ));
5252 }
5353
54+ /**
55+ * Get a specific revision of a gist.
56+ *
57+ * @param int $number
58+ * @param string $sha
59+ *
60+ * @link https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist
61+ *
62+ * @return array
63+ */
64+ public function revision ($ number , $ sha )
65+ {
66+ return $ this ->get ('/gists/ ' .rawurlencode ($ number ).'/ ' .rawurlencode ($ sha ));
67+ }
68+
5469 public function create (array $ params )
5570 {
5671 if (!isset ($ params ['files ' ]) || (!is_array ($ params ['files ' ]) || 0 === count ($ params ['files ' ]))) {
Original file line number Diff line number Diff line change @@ -52,6 +52,22 @@ public function shouldShowGist()
5252 $ this ->assertEquals ($ expectedArray , $ api ->show (123 ));
5353 }
5454
55+ /**
56+ * @test
57+ */
58+ public function shouldShowGistWithSpecificReference ()
59+ {
60+ $ expectedArray = ['id ' => '123 ' , 'sha ' => 'd189dbd4c5d96442db74ebcb62bb38e661a0c8ce ' ];
61+
62+ $ api = $ this ->getApiMock ();
63+ $ api ->expects ($ this ->once ())
64+ ->method ('get ' )
65+ ->with ('/gists/123/d189dbd4c5d96442db74ebcb62bb38e661a0c8ce ' )
66+ ->will ($ this ->returnValue ($ expectedArray ));
67+
68+ $ this ->assertEquals ($ expectedArray , $ api ->revision (123 , 'd189dbd4c5d96442db74ebcb62bb38e661a0c8ce ' ));
69+ }
70+
5571 /**
5672 * @test
5773 */
You can’t perform that action at this time.
0 commit comments