File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ $gists = $github->api('gists')->all();
37
37
$gist = $github->api('gists')->show(1);
38
38
```
39
39
40
+ #### Get a specific revision of a gist
41
+
42
+ ``` php
43
+ $gist = $github->api('gists')->show(1, 'd189dbd4c5d96442db74ebcb62bb38e661a0c8ce');
44
+ ```
45
+
40
46
#### Get commits for a single gist
41
47
42
48
``` php
Original file line number Diff line number Diff line change @@ -51,6 +51,21 @@ public function show($number)
51
51
return $ this ->get ('/gists/ ' .rawurlencode ($ number ));
52
52
}
53
53
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
+
54
69
public function create (array $ params )
55
70
{
56
71
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()
52
52
$ this ->assertEquals ($ expectedArray , $ api ->show (123 ));
53
53
}
54
54
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
+
55
71
/**
56
72
* @test
57
73
*/
You can’t perform that action at this time.
0 commit comments