diff --git a/README.md b/README.md index 8b14d55..f48daf6 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,10 @@ Everything that is not available as a function can be requested by calling `make ## History +### 0.12.0 + +* Replaced `restler` with `needle` + ### 0.11.0 * Update optional fields diff --git a/main.js b/main.js index 6b26d68..936ea09 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ require('es6-promise').polyfill(); -var rest = require('restler'); +var rest = require('needle'); var objectAssign = require('object-assign'); var minRequestDelay = 500; @@ -82,7 +82,7 @@ Trello.prototype.makeRequest = function (requestMethod, path, options, callback) 'get': rest.get, 'put': rest.put, 'putjson' : rest.put, - 'delete': rest.del + 'delete': rest.delete }; if (!methods[method]) { @@ -212,7 +212,7 @@ Trello.prototype.addMemberToCard = function (cardId, memberId, callback) { Trello.prototype.delMemberFromCard = function (cardId, memberId, callback) { var query = this.createQuery(); - return makeRequest(rest.del, this.uri + '/1/cards/' + cardId + '/members/' + memberId, {query: query}, callback); + return makeRequest(rest.delete, this.uri + '/1/cards/' + cardId + '/members/' + memberId, {query: query}, callback); }; Trello.prototype.getBoards = function(memberId, callback) { @@ -365,7 +365,7 @@ Trello.prototype.getCardsOnListWithExtraParams = function (listId, extraParams, } Trello.prototype.deleteCard = function (cardId, callback) { - return makeRequest(rest.del, this.uri + '/1/cards/' + cardId, {query: this.createQuery()}, callback); + return makeRequest(rest.delete, this.uri + '/1/cards/' + cardId, {query: this.createQuery()}, callback); }; Trello.prototype.addWebhook = function (description, callbackUrl, idModel, callback) { @@ -382,7 +382,7 @@ Trello.prototype.addWebhook = function (description, callbackUrl, idModel, callb Trello.prototype.deleteWebhook = function (webHookId, callback) { var query = this.createQuery(); - return makeRequest(rest.del, this.uri + '/1/webhooks/' + webHookId, { query: query }, callback); + return makeRequest(rest.delete, this.uri + '/1/webhooks/' + webHookId, { query: query }, callback); }; Trello.prototype.getLabelsForBoard = function(boardId, callback) { @@ -410,7 +410,7 @@ Trello.prototype.addLabelOnBoard = function(boardId, name, color, callback) { }; Trello.prototype.deleteLabel = function(labelId, callback) { - return makeRequest(rest.del, this.uri + '/1/labels/' + labelId, {query: this.createQuery()}, callback); + return makeRequest(rest.delete, this.uri + '/1/labels/' + labelId, {query: this.createQuery()}, callback); }; Trello.prototype.addLabelToCard = function(cardId, labelId, callback) { @@ -420,7 +420,7 @@ Trello.prototype.addLabelToCard = function(cardId, labelId, callback) { }; Trello.prototype.deleteLabelFromCard = function(cardId, labelId, callback){ - return makeRequest(rest.del, this.uri + '/1/cards/' + cardId + '/idLabels/'+labelId, {query: this.createQuery()}, callback); + return makeRequest(rest.delete, this.uri + '/1/cards/' + cardId + '/idLabels/'+labelId, {query: this.createQuery()}, callback); }; Trello.prototype.updateCardPos = function(cardId, position, callback) { diff --git a/package.json b/package.json index dfaac25..9ebe6bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "trello", - "version": "0.11.0", + "version": "0.12.0", "author": "Norbert Eder ", "description": "This module provides an easy way to make requests to the Trello API.", "contributors": [ @@ -52,7 +52,7 @@ "dependencies": { "es6-promise": "^4.2.8", "object-assign": "~4.1.0", - "restler": "^3.4.0" + "needle": "3.0.0" }, "devDependencies": { "mocha": "^9.1.3", diff --git a/test/spec.js b/test/spec.js index c35d2dd..1662fff 100644 --- a/test/spec.js +++ b/test/spec.js @@ -7,7 +7,7 @@ var fs = require('fs'); chai.should(); chai.use(sinonChai); -var restler = require('restler'); +var restler = require('needle'); var Trello = require('../main'); describe('Trello', function () { @@ -73,14 +73,14 @@ describe('Trello', function () { }); it('should not throw error if a method passed is DELETE', function (done) { - sinon.stub(restler, 'del').callsFake(function (path, options) { + sinon.stub(restler, 'delete').callsFake(function (path, options) { return {once: function (event, callback) { callback(null, null); }}; }); expect(trello.makeRequest.bind(trello, 'DELETE', 'somePath', {}, function () {})).to.not.throw(Error); - restler.del.restore(); + restler.delete.restore(); done(); }); @@ -464,7 +464,7 @@ describe('Trello', function () { var del; beforeEach(function (done) { - sinon.stub(restler, 'del').callsFake(function (uri, options) { + sinon.stub(restler, 'delete').callsFake(function (uri, options) { return { once: function (event, callback) { callback(null, null); @@ -473,8 +473,8 @@ describe('Trello', function () { }); trello.deleteWebhook('x1', function (result) { - query = restler.del.args[0][1].query; - del = restler.del; + query = restler.delete.args[0][1].query; + del = restler.delete; done(); }); @@ -489,7 +489,7 @@ describe('Trello', function () { }); afterEach(function () { - restler.del.restore(); + restler.delete.restore(); }); }); @@ -817,14 +817,14 @@ describe('Trello', function () { var del; beforeEach(function (done) { - sinon.stub(restler, 'del').callsFake(function (uri, options) { + sinon.stub(restler, 'delete').callsFake(function (uri, options) { return {once: function (event, callback) { callback(null, null); }}; }); trello.deleteLabel('labelId', function () { - del = restler.del; + del = restler.delete; done(); }); }); @@ -834,7 +834,7 @@ describe('Trello', function () { }); afterEach(function () { - restler.del.restore(); + restler.delete.restore(); }); }); @@ -875,14 +875,14 @@ describe('Trello', function () { var del; beforeEach(function (done) { - sinon.stub(restler, 'del').callsFake(function (uri, options) { + sinon.stub(restler, 'delete').callsFake(function (uri, options) { return {once: function (event, callback) { callback(null, null); }}; }); trello.deleteLabelFromCard('cardId', 'labelId', function () { - del = restler.del; + del = restler.delete; done(); }); }); @@ -892,7 +892,7 @@ describe('Trello', function () { }); afterEach(function () { - restler.del.restore(); + restler.delete.restore(); }); });