Comparing version 0.2.1 to 0.2.2
// Generated by CoffeeScript 1.6.2 | ||
(function() { | ||
var ApiBase, _ref, | ||
var ApiBase, querystring, _ref, | ||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -10,2 +10,4 @@ __hasProp = {}.hasOwnProperty, | ||
querystring = require('querystring'); | ||
module.exports.ApiBaseHTTP = (function(_super) { | ||
@@ -76,15 +78,32 @@ __extends(ApiBaseHTTP, _super); | ||
ApiBaseHTTP.prototype._translateUrl = function(path) { | ||
return ("" + this.options.path + "/" + this.options.base_url + "/" + path + "?private_token=" + this.options.token).replace(/\/\//, '/'); | ||
ApiBaseHTTP.prototype._translateUrl = function(path, params) { | ||
var url; | ||
if (params == null) { | ||
params = {}; | ||
} | ||
url = ("" + this.options.path + "/" + this.options.base_url + "/" + path + "?private_token=" + this.options.token).replace(/\/\//, '/'); | ||
if (params) { | ||
url += "&" + (querystring.stringify(params)); | ||
} | ||
return url; | ||
}; | ||
ApiBaseHTTP.prototype.get = function(path, fn) { | ||
ApiBaseHTTP.prototype.get = function(path, params, fn) { | ||
var options; | ||
if (params == null) { | ||
params = {}; | ||
} | ||
if (fn == null) { | ||
fn = null; | ||
} | ||
if ('function' === typeof params) { | ||
fn = params; | ||
params = {}; | ||
} | ||
options = { | ||
path: this._translateUrl(path), | ||
method: 'GET' | ||
path: this._translateUrl(path, params), | ||
method: 'GET', | ||
params: params | ||
}; | ||
@@ -194,2 +213,3 @@ return this._request(options, fn); | ||
} | ||
console.log(options); | ||
this.debug(options.path); | ||
@@ -196,0 +216,0 @@ this._request_options(options); |
@@ -29,10 +29,21 @@ // Generated by CoffeeScript 1.6.2 | ||
Projects.prototype.all = function(fn) { | ||
var _this = this; | ||
Projects.prototype.all = function(params, fn) { | ||
var _ref1, | ||
_this = this; | ||
if (params == null) { | ||
params = {}; | ||
} | ||
if (fn == null) { | ||
fn = null; | ||
} | ||
if ('function' === typeof params) { | ||
fn = params; | ||
params = {}; | ||
} | ||
this.debug("Projects::all()"); | ||
return this.get("projects", function(data) { | ||
if ((_ref1 = params.per_page) == null) { | ||
params.per_page = 100; | ||
} | ||
return this.get("projects", params, function(data) { | ||
if (fn) { | ||
@@ -39,0 +50,0 @@ return fn(data); |
{ | ||
"name": "gitlab", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "gitlab api nodejs library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46987
941