Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

madmimi-node

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

madmimi-node - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

examples/addToList.js

47

lib/index.js
var https = require('https'),
http = require('http'),
querystring = require('querystring'),
xml2js = require('xml2js');
xml2js = require('xml2js'),
jade = require('Jade');

@@ -32,3 +33,2 @@

if(!cb) { cb = function () {} };

@@ -43,3 +43,3 @@

var req = httpClient.request(requestOptions, function(res) {

@@ -71,10 +71,5 @@ res.body = "";

function _sendMail(options, cb) {
optionsParameterized = querystring.stringify(options, "&", "=");
self.sendMail = function (options, cb) {
options.username = self.username;
options.api_key = self.api_key;
optionsParameterized = querystring.stringify(options, "&", "=");
var requestOptions = {

@@ -88,3 +83,20 @@ host: 'api.madmimi.com',

self.request(requestOptions, optionsParameterized, cb);
};
self.sendMail = function (options, cb) {
options.username = self.username;
options.api_key = self.api_key;
if (options.jade) {
jade.renderFile(options.jade, function(err, html){
if(err) throw err;
delete options.jade;
options.raw_html = html;
_sendMail(options, cb);
});
} else {
_sendMail(options, cb);
}
};

@@ -131,3 +143,3 @@

var parser = new xml2js.Parser();
parser.addListener('end', function(result) {

@@ -155,4 +167,4 @@ logger("result_js:");

};
optionsParameterized = querystring.stringify(options, "&", "=");

@@ -175,11 +187,2 @@

function merge(source, target) {
target.forEach(function() {
Object.keys(o).forEach(function (attr) {
if (! o.__lookupGetter__(attr)) {
target[attr] = o[attr];
}
});
});
}
{
"name": "madmimi-node",
"description": "A client for the mad mimi api",
"version": "0.1.2",
"version": "0.1.3",
"homepage": "www.api.madmimi.com",

@@ -6,0 +6,0 @@ "repository": "git://github.com/garrensmith/Madmimi-node.git",

@@ -8,3 +8,6 @@ Madmimi Client

---------
## V1.3
* Support for [Jade](http://github.com/visionmedia/jade) (see examples)
## V1.1

@@ -11,0 +14,0 @@

@@ -17,3 +17,3 @@ var describe = require('Jody').describe,

madmimi = new Madmimi("fake@email.com", "fake-api-key");
}).
}).
it("Should create http request for api", function (async) {

@@ -31,3 +31,3 @@

}).
it("Should format email parameters", function (atEnd) {
it("Should format email parameters", function (async) {

@@ -42,1 +42,25 @@ madmimi.request = async(function (requestOptions, body) {

});
describe("Render Jade").
beforeEach( function () {
madmimi = new Madmimi("fake@email.com", "fake-api-key");
}).
it("Should render to html", function (async) {
madmimi.request = async(function (requestOptions, body) {
body.should().beEqual("promotion_name=Test%20Promotion&recipient=Jimi%20Hendrix%20%3Cjimi%40electricladyland.com%3E&subject=Test%20Promotion&from=no-reply%40guitargear.com&username=fake%40email.com&api_key=fake-api-key&raw_html=%3C!DOCTYPE%20html%3E%3Chead%3E%3Ctitle%3EGreat%20promotion!%3C%2Ftitle%3E%3C%2Fhead%3E%3Cbody%3E%3Cp%3ECool%20guitar%20stuff%20%5B%5Btracking_beacon%5D%5D%0A%3C%2Fp%3E%3C%2Fbody%3E");
});
var options = {
promotion_name:"Test Promotion",
recipient:"Jimi Hendrix <jimi@electricladyland.com>",
subject:"Test Promotion",
from:"no-reply@guitargear.com",
};
options.jade = process.cwd() + '/spec/fixtures/email.jade';
madmimi.sendMail(options, function () {});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc