Skip to content

Commit 3d35275

Browse files
committed
add groupMembers resource
1 parent 6df74af commit 3d35275

File tree

7 files changed

+58
-83
lines changed

7 files changed

+58
-83
lines changed

Makefile

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
gitlab
22
=======
33

4-
[![Build Status](https://secure.travis-ci.org/repo-utils/gitlab.png)](http://travis-ci.org/repo-utils/gitlab)
5-
[![Coverage Status](https://coveralls.io/repos/repo-utils/gitlab/badge.png)](https://coveralls.io/r/repo-utils/gitlab)
4+
[![NPM version][npm-image]][npm-url]
5+
[![build status][travis-image]][travis-url]
6+
[![Test coverage][coveralls-image]][coveralls-url]
7+
[![Gittip][gittip-image]][gittip-url]
8+
[![David deps][david-image]][david-url]
9+
[![node version][node-image]][node-url]
10+
[![npm download][download-image]][download-url]
11+
12+
[npm-image]: https://img.shields.io/npm/v/node-gitlab.svg?style=flat-square
13+
[npm-url]: https://npmjs.org/package/node-gitlab
14+
[travis-image]: https://img.shields.io/travis/repo-utils/gitlab.svg?style=flat-square
15+
[travis-url]: https://travis-ci.org/repo-utils/gitlab
16+
[coveralls-image]: https://img.shields.io/coveralls/repo-utils/gitlab.svg?style=flat-square
17+
[coveralls-url]: https://coveralls.io/r/repo-utils/gitlab?branch=master
18+
[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat-square
19+
[gittip-url]: https://www.gittip.com/fengmk2/
20+
[david-image]: https://img.shields.io/david/repo-utils/gitlab.svg?style=flat-square
21+
[david-url]: https://david-dm.org/repo-utils/gitlab
22+
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
23+
[node-url]: http://nodejs.org/download/
24+
[download-image]: https://img.shields.io/npm/dm/node-gitlab.svg?style=flat-square
25+
[download-url]: https://npmjs.org/package/node-gitlab
626

727
![logo](https://raw.github.com/repo-utils/gitlab/master/logo.png)
828

@@ -13,7 +33,7 @@ Gitlab API nodejs client.
1333
## Install
1434

1535
```bash
16-
$ npm install node-gitlab
36+
$ npm install node-gitlab --save
1737
```
1838

1939
## Usage

lib/gitlab.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ var util = require('util');
1616
var Milestone = require('./milestone');
1717
var Project = require('./project');
1818
var Member = require('./member');
19-
var Hook = require('./hook');
2019
var GlobalHook = require('./globalHook.js');
2120
var Issue = require('./issue');
2221
var User = require('./user');
2322
var Repository = require('./repository');
2423
var MergeRequest = require('./merge_request');
2524
var RepositoryFile = require('./repository_file');
2625

26+
module.exports = Gitlab;
27+
2728
/**
2829
* Create a gitlab API client.
2930
*
@@ -34,23 +35,31 @@ var RepositoryFile = require('./repository_file');
3435
function Gitlab(options) {
3536
options = options || {};
3637
options.api = options.api || 'https://gitlab.com/api/v3';
37-
this.constructor.super_.call(this, options);
38+
restful.RESTFulClient.call(this, options);
3839

3940
this.privateToken = options.privateToken;
4041

41-
this.milestones = new Milestone(this);
42-
this.members = new Member(this);
43-
this.hooks = new Hook(this);
44-
this.globalHooks = new GlobalHook(this);
45-
this.issues = new Issue(this);
46-
this.users = new User(this);
47-
this.merge_requests = this.mergeRequests = new MergeRequest(this);
48-
4942
this.addResources({
5043
projects: Project,
5144
repository: Repository,
5245
repositoryFiles: RepositoryFile,
46+
mergeRequests: MergeRequest,
47+
users: User,
48+
issues: Issue,
49+
globalHooks: GlobalHook,
50+
members: Member,
51+
milestones: Milestone,
52+
hooks: {
53+
resourcePath: '/projects/:id/hooks',
54+
idName: 'hook_id',
55+
},
56+
groupMembers: {
57+
resourcePath: '/groups/:id/members',
58+
idName: 'user_id',
59+
},
5360
});
61+
62+
this.merge_requests = this.mergeRequests;
5463
}
5564

5665
util.inherits(Gitlab, restful.RESTFulClient);
@@ -60,6 +69,6 @@ Gitlab.prototype.setAuthentication = function (req) {
6069
return req;
6170
};
6271

63-
exports.create = function (options) {
72+
Gitlab.create = function (options) {
6473
return new Gitlab(options);
6574
};

lib/hook.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

package.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,27 @@
44
"description": "Gitlab API nodejs client.",
55
"main": "index.js",
66
"scripts": {
7-
"test": "make test-all",
8-
"blanket": { "pattern": "gitlab/lib" },
9-
"travis-cov": { "threshold": 100 }
7+
"test": "mocha -R spec -t 20000 -r should-http test/*.test.js",
8+
"test-cov": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -t 20000 -r should-http test/*.test.js",
9+
"test-travis": "node --harmony node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- -t 20000 -r should-http test/*.test.js",
10+
"jshint": "jshint .",
11+
"autod": "autod -w --prefix '~' && npm run cnpm",
12+
"cnpm": "npm install --registry=https://registry.npm.taobao.org",
13+
"contributors": "contributors -f plain -o AUTHORS"
1014
},
1115
"dependencies": {
12-
"debug": "~1.0.2",
13-
"restful-client": "~0.2.0"
16+
"debug": "~1.0.4",
17+
"restful-client": "~1.0.0"
1418
},
1519
"devDependencies": {
1620
"autod": "*",
1721
"blanket": "*",
1822
"contributors": "*",
1923
"coveralls": "*",
2024
"mocha": "*",
21-
"mocha-lcov-reporter": "*",
22-
"pedding": "~0.0.3",
23-
"should": "~3.3.2",
24-
"travis-cov": "*"
25+
"pedding": "~1.0.0",
26+
"should": "~4.0.4",
27+
"should-http": "*"
2528
},
2629
"homepage": "https://github.com/repo-utils/gitlab",
2730
"repository": {

test/issue.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('issue.test.js', function () {
8282
state_event: 'close',
8383
}, function (err, row) {
8484
should.not.exists(err);
85-
row.title.should.include(' update');
85+
row.title.should.containEql(' update');
8686
row.state.should.equal('closed');
8787
done();
8888
});

test/repository.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe.skip('repository.test.js', function () {
216216
should.ok(Buffer.isBuffer(blob));
217217
blob.should.be.instanceof(Buffer);
218218
blob.length.should.above(0);
219-
blob.toString().should.include('alidata - lib/alidata.js');
219+
blob.toString().should.containEql('alidata - lib/alidata.js');
220220
done();
221221
});
222222
});
@@ -230,7 +230,7 @@ describe.skip('repository.test.js', function () {
230230
should.ok(Buffer.isBuffer(raw));
231231
raw.should.be.a.Buffer;
232232
raw.length.should.above(0);
233-
raw.toString().should.include('gitlab-client-unittest\n=======\n\n');
233+
raw.toString().should.containEql('gitlab-client-unittest\n=======\n\n');
234234
done();
235235
});
236236
});

0 commit comments

Comments
 (0)