Skip to content

Commit

Permalink
MA-1155 #time 20m Changed sparkpost to SparkPost
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Noel committed Dec 10, 2014
1 parent 4e1cf4d commit 5b59d56
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
16 changes: 8 additions & 8 deletions lib/SendGridCompatibility/Email.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Email(options){
}

/**
* Sendgrid email compatibility functions
* SendGrid email compatibility functions
*
* @param Most have a single value to map
* Add functions will often contain a key / value pair
Expand Down Expand Up @@ -70,31 +70,31 @@ Email.prototype.addSection = function (key, value){
Email.prototype.setSections = function (sections){
this.section = sections;
};
// Sparkpost doesn't currently support addUniqueArg, throw an error
// SparkPost doesn't currently support addUniqueArg, throw an error
Email.prototype.addUniqueArg = function (){
throw new Error('Unique Argument compatibility is not supported.');
};
// Sparkpost doesn't currently support setUniqueArgs, throw an error
// SparkPost doesn't currently support setUniqueArgs, throw an error
Email.prototype.setUniqueArgs = function (){
throw new Error('Unique Argument compatibility is not supported.');
};
// Sparkpost doesn't currently support addCategory, throw an error
// SparkPost doesn't currently support addCategory, throw an error
Email.prototype.addCategory = function (){
throw new Error('Category compatibility is not supported.');
};
// Sparkpost doesn't currently support setCategories, throw an error
// SparkPost doesn't currently support setCategories, throw an error
Email.prototype.setCategories = function (){
throw new Error('Category compatibility is not supported.');
};
// Sparkpost doesn't currently support addFilter, throw an error
// SparkPost doesn't currently support addFilter, throw an error
Email.prototype.addFilter = function (){
throw new Error('Filter compatibility is not supported.');
};
// Sparkpost doesn't currently support setFilters, throw an error
// SparkPost doesn't currently support setFilters, throw an error
Email.prototype.setFilters = function (){
throw new Error('Filter compatibility is not supported.');
};
// Sparkpost doesn't currently support addFile, throw an error
// SparkPost doesn't currently support addFile, throw an error
Email.prototype.addFile = function (){
throw new Error('File compatibility is not supported.');
};
Expand Down
42 changes: 21 additions & 21 deletions lib/SendGridCompatibility/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ var transmission = require('../transmission');
var configuration = require('../configuration');

/**
* Sendgrid compatibility constructor
* SendGrid compatibility constructor
* Responsible for taking the api key and config options and
* translating them into a format compatible with sparkpost's
* translating them into a format compatible with SparkPost's
* configuration.setConfig function.
*
* @param username: dropped sendgrid username string
* @param username: dropped SendGrid username string
* @param apiKey: api key string
* @param options: optional additional options object
*/
Expand All @@ -25,10 +25,10 @@ var sendgrid = function(username, apiKey, options) {
};

/**
* Private Method for translating a user's sendgrid config options
* to a sparkpost compatible set by dropping unnecessary data
* Private Method for translating a user's SendGrid config options
* to a SparkPost compatible set by dropping unnecessary data
*
* @param payload: sendgrid formatted config options object
* @param payload: SendGrid formatted config options object
* @returns object: config options with incompatible entries removed
*/
var translateConfig = function(options) {
Expand All @@ -46,12 +46,12 @@ var translateConfig = function(options) {
};

/**
* Private Method for translating a user's sendgrid substitutions and sections
* to a consolidated sparkpost substitutionData object
* Private Method for translating a user's SendGrid substitutions and sections
* to a consolidated SparkPost substitutionData object
*
* @param payload: sendgrid formatted object or sendgrid Email object to
* be translated into a sparkpost payload
* @returns object: substitutionData object as per sparkpost payload format
* @param payload: SendGrid formatted object or SendGrid Email object to
* be translated into a SparkPost payload
* @returns object: substitutionData object as per SparkPost payload format
*/
var consolidateSubstitutionData = function(payload) {
var substitutionData = {};
Expand All @@ -66,12 +66,12 @@ var consolidateSubstitutionData = function(payload) {
};

/**
* Private Method for translating a user's sendgrid to and toname to a recipients
* Private Method for translating a user's SendGrid to and toname to a recipients
* array that the transmissions "Class" can understand
*
* @param payload: sendgrid formatted object or sendgrid Email object to
* be translated into a sparkpost payload
* @returns array: recipients array as per sparkpost payload format
* @param payload: SendGrid formatted object or SendGrid Email object to
* be translated into a SparkPost payload
* @returns array: recipients array as per SparkPost payload format
*/
var parseTo = function(payload){
var recipients = [];
Expand All @@ -93,12 +93,12 @@ var parseTo = function(payload){
};

/**
* Private Method for translating a user's sendgrid payload to a format
* Private Method for translating a user's SendGrid payload to a format
* that the transmissions "Class" can understand
*
* @param payload: sendgrid formatted object or sendgrid Email object to
* be translated into a sparkpost payload
* @returns object: translation from sendgrid payload to sparkpost payload
* @param payload: SendGrid formatted object or SendGrid Email object to
* be translated into a SparkPost payload
* @returns object: translation from SendGrid payload to SparkPost payload
*/
var translatePayload = function(payload) {
var sub = consolidateSubstitutionData(payload)
Expand Down Expand Up @@ -132,8 +132,8 @@ var translatePayload = function(payload) {
* private helper methods to translate an Email or inline object
* and then pass that content to the transmissions send function.
*
* @param payload: sendgrid formatted object or sendgrid Email object to
* be translated into a sparkpost payload and sent
* @param payload: SendGrid formatted object or SendGrid Email object to
* be translated into a SparkPost payload and sent
*/
sendgrid.prototype.send = function(payload, callback) {
var translated = translatePayload(payload);
Expand Down

0 comments on commit 5b59d56

Please sign in to comment.