Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[api] Add Users#destroy
  • Loading branch information
mmalecki committed Oct 12, 2012
1 parent 2aabe1d commit 6b137c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion node.js/lib/client/users.js
Expand Up @@ -110,4 +110,18 @@ Users.prototype.update = function (username, object, callback) {
this.request('PUT', ['users', username], object, callback, function (res, result) {
callback(null, result);
});
}
};

//
// ### function destroy (username, callback)
// #### @username {String} User to delete
// #### @callback {function} Continuation to pass control to when complete
// Delete user account. Use with extreme caution.
//
// So sad to see you go.
//
Users.prototype.destroy = function (username, object, callback) {
this.request('DELETE', ['users', username], callback, function (res, result) {
callback(null, result);
});
};
7 changes: 7 additions & 0 deletions node.js/test/commands/users-test.js
Expand Up @@ -48,4 +48,11 @@ vows.describe('users').addBatch(makeApiCall(
.put('/users/moses', { prophet: true})
.reply(200, {}, { 'x-powered-by': 'Nodejitsu' })
}
)).addBatch(makeApiCall(
'users delete jesus',
function setup() {
nock('https://api.mockjitsu.com')
.del('/users/jesus')
.reply(200, {}, { 'x-powered-by': 'Nodejitsu' });
}
)).export(module);

0 comments on commit 6b137c8

Please sign in to comment.