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

Updates to add Portfolio functionality and to send an email #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/ET_Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var ClickEvent = require('./objects/ClickEvent');
var OpenEvent = require('./objects/OpenEvent');
var SentEvent = require('./objects/SentEvent');
var UnsubEvent = require('./objects/UnsubEvent');
var Portfolio = require('./objects/Portfolio');



Expand Down Expand Up @@ -252,5 +253,9 @@ ET_Client.prototype.unsubEvent = function(options) {
return new UnsubEvent(this, options);
};

ET_Client.prototype.portfolio = function(options) {
return new Portfolio(this, options);
};


module.exports = ET_Client;
module.exports = ET_Client;
2 changes: 1 addition & 1 deletion lib/objects/ContentArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ ContentArea.prototype.delete = function(cb) {



module.exports = ContentArea;
module.exports = ContentArea;
11 changes: 9 additions & 2 deletions lib/objects/Email.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ Email.prototype.delete = function(cb) {
);
};

Email.prototype.send = function(cb) {
this.parent.SoapClient.create(
'Send',
this.props,
this.options,
cb
);
}


module.exports = Email;
module.exports = Email;
67 changes: 67 additions & 0 deletions lib/objects/Portfolio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
var util = require('util');
var helpers = require('../helpers');

/*
https://code.exacttarget.com/apis-sdks/fuel-sdks/folders/folder-create.html
*/

var Portfolio = function (parent, options) {

this.parent = parent;
this.objName = 'Portfolio';

this.config = options;
options = options || {};
this.options = options.options || {};
this.props = options.props || {}; //props corresponds to the Objects attribute in the SOAP envelope.
};


Portfolio.prototype.post = function(cb) {
this.parent.SoapClient.create(
this.objName,
this.props,
this.options,
cb
);
};


Portfolio.prototype.get = function(cb) {
var filter = {filter: this.config.filter} || null;

if (!this.props || helpers.isEmpty(this.props)) {
cb({error: 'A property list is required for Content Area retrieval.', documentation: 'https://code.exacttarget.com/apis-sdks/fuel-sdks/content-areas/content-area-retrieve.html'});
} else {
this.parent.SoapClient.retrieve(
this.objName,
this.props,
filter,
cb
);
}
};


Portfolio.prototype.patch = function(cb) {
this.parent.SoapClient.update(
this.objName,
this.props,
this.options,
cb
);
};


Portfolio.prototype.delete = function(cb) {
this.parent.SoapClient.delete(
this.objName,
this.props,
this.options,
cb
);
};



module.exports = Portfolio;