Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/gists.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ $gists = $github->api('gists')->all();
$gist = $github->api('gists')->show(1);
```

#### Get commits for a single gist

```php
$commits = $github->api('gists')->commits(1);
```

#### Create a gist

```php
Expand Down
5 changes: 5 additions & 0 deletions lib/Github/Api/Gists.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public function update($id, array $params)
return $this->patch('gists/'.rawurlencode($id), $params);
}

public function commits($id)
{
return $this->get('gists/'.rawurlencode($id).'/commits');
}

public function fork($id)
{
return $this->post('gists/'.rawurlencode($id).'/fork');
Expand Down
16 changes: 16 additions & 0 deletions test/Github/Tests/Api/GistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,22 @@ public function shouldShowGist()
$this->assertEquals($expectedArray, $api->show(123));
}

/**
* @test
*/
public function shouldShowCommits()
{
$expectedArray = array('id' => '123');

$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('gists/123/commits')
->will($this->returnValue($expectedArray));

$this->assertEquals($expectedArray, $api->commits(123));
}

/**
* @test
*/
Expand Down