function create (url, callback) {
var body = {
shorturl: {
original_url: url
}
};
this.api.post('shorturls', null, body, function (error, result) {
this.api.retrieveData(error, result, 'shorturls', callback);
});
}
You forgot to bind(this).
function create (url, callback) {
var body = {
shorturl: {
original_url: url
}
};
this.api.post('shorturls', null, body, function (error, result) {
this.api.retrieveData(error, result, 'shorturls', callback);
}.bind(this));
}
Please also see my PR, it is pending:
https://github.com/oneall/node-js-sdk/pull/4