Skip to content

Commit 6bbe4d8

Browse files
committed
Added support for gist comments
1 parent 25bdb5c commit 6bbe4d8

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

lib/Github/Api/Gist/Comments.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,33 @@
55
use Github\Api\AbstractApi;
66

77
/**
8-
*
98
* @link https://developer.github.com/v3/gists/comments/
109
* @author Kayla Daniels <[email protected]>
11-
* @author Edoardo Rivello <edoardo.rivello at gmail dot com>
1210
*/
1311
class Comments extends AbstractApi
1412
{
15-
// GET /gists/:gist_id/comments
1613
public function all($gist)
1714
{
18-
return $this->get('gists/'.rawurlencode($gist)."/comments");
15+
return $this->get('gists/'.rawurlencode($gist).'/comments');
1916
}
2017

21-
//GET /gists/:gist_id/comments/:id
2218
public function show($gist, $comment)
2319
{
2420
return $this->get('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
2521
}
2622

27-
//POST /gists/:gist_id/comments
2823
public function create($gist, $body)
2924
{
30-
return $this->post('gists/'.rawurlencode($gist)."/comments", array($body));
25+
return $this->post('gists/'.rawurlencode($gist).'/comments', array($body));
3126
}
3227

33-
//PATCH /gists/:gist_id/comments/:id
3428
public function update($gist, $comment_id, $body)
3529
{
36-
return $this->patch('gists/'.rawurlencode($gist)."/comments/".rawurlencode($comment_id), array($body));
30+
return $this->patch('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment_id), array($body));
3731
}
3832

39-
//DELETE /gists/:gist_id/comments/:id
4033
public function remove($gist, $comment)
4134
{
42-
return $this->delete('gists/'.rawurlencode($gist)."/comments/".rawurlencode($comment));
35+
return $this->delete('gists/'.rawurlencode($gist).'/comments/'.rawurlencode($comment));
4336
}
44-
}
37+
}

lib/Github/Api/Gists.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function unstar($id)
7575
}
7676

7777
/**
78-
* List an gists comments.
78+
* Get a gist's comments.
7979
*
8080
* @link http://developer.github.com/v3/gists/comments/
8181
*
@@ -85,5 +85,4 @@ public function comments()
8585
{
8686
return new Comments($this->client);
8787
}
88-
8988
}

test/Github/Tests/Api/Gist/CommentsTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ class CommentsTest extends TestCase
99
/**
1010
* @test
1111
*/
12-
13-
// GET /gists/:gist_id/comments
1412
public function shouldGetAllGistComments()
1513
{
1614
$expectedValue = array(array('comment1data'), array('comment2data'));
@@ -40,7 +38,6 @@ public function shouldShowGistComment()
4038
$this->assertEquals($expectedValue, $api->show(123, 123));
4139
}
4240

43-
4441
/**
4542
* @test
4643
*/
@@ -51,13 +48,12 @@ public function shouldCreateGistComment()
5148
$api = $this->getApiMock();
5249
$api->expects($this->once())
5350
->method('post')
54-
->with('gists/123/comments', array("Test body"))
51+
->with('gists/123/comments', array('Test body'))
5552
->will($this->returnValue($expectedValue));
5653

57-
$this->assertEquals($expectedValue, $api->create('123', "Test body"));
54+
$this->assertEquals($expectedValue, $api->create('123', 'Test body'));
5855
}
5956

60-
6157
/**
6258
* @test
6359
*/
@@ -95,4 +91,4 @@ protected function getApiClass()
9591
{
9692
return 'Github\Api\Gist\Comments';
9793
}
98-
}
94+
}

test/Github/Tests/Api/GistsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,4 @@ protected function getApiClass()
226226
{
227227
return 'Github\Api\Gists';
228228
}
229-
}
229+
}

0 commit comments

Comments
 (0)