Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
ADD: create update complete comments
Browse files Browse the repository at this point in the history
  • Loading branch information
florianholzapfel committed May 24, 2013
1 parent f48fb71 commit 651076a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ var comment = function(client, xml) {
utils.parse_xml(this, xml.comment || xml);
}
};
comment.prototype.create = function(item, callback) {
this.client.create_item('/comments.xml', utils.to_xml(item, 'comment'), callback, comment);
};
comment.prototype.delete = function(callback) {
var url = '/comments/' + this.id + '.xml';

Expand All @@ -39,5 +42,12 @@ comment.prototype.delete = function(callback) {
comment.prototype.get = function(id, callback) {
this.client.get_item('/comments/' + id + '.xml', callback, comment);
};
comment.prototype.to_xml = function(excluded_keys) {
return utils.to_xml(this, 'comment', excluded_keys);
};
comment.prototype.update = function(callback) {
var path = '/comments/' + this.id + '.xml';
this.client.send('PUT', path, this.to_xml(), callback);
};

module.exports = comment;

0 comments on commit 651076a

Please sign in to comment.