sailthru-client
Advanced tools
Comparing version 1.0.0 to 1.0.1
(function() { | ||
var SailthruUtil, md5; | ||
md5 = require('hashlib').md5; | ||
var SailthruUtil, crypto; | ||
crypto = require('crypto'); | ||
exports.SailthruUtil = SailthruUtil = (function() { | ||
function SailthruUtil() {} | ||
SailthruUtil.getSignatureHash = function(params, secret) { | ||
return md5(SailthruUtil.getSignatureString(params, secret)); | ||
return SailthruUtil.md5(SailthruUtil.getSignatureString(params, secret)); | ||
}; | ||
@@ -12,2 +12,8 @@ SailthruUtil.getSignatureString = function(params, secret) { | ||
}; | ||
SailthruUtil.md5 = function(data) { | ||
var md5; | ||
md5 = crypto.createHash('md5'); | ||
md5.update(data); | ||
return md5.digest('hex'); | ||
}; | ||
SailthruUtil.extractParamValues = function(params) { | ||
@@ -14,0 +20,0 @@ var k, temp, v, values; |
{ | ||
"name": "sailthru-client", | ||
"description": "Node.js client for Sailthru API", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -16,3 +16,2 @@ "name": "Prajwal Tuladhar", | ||
"dependencies": { | ||
"hashlib": ">=1.0.0" | ||
}, | ||
@@ -19,0 +18,0 @@ "dev-dependencies": { |
@@ -5,1 +5,56 @@ sailthru-node-client | ||
A simple client library to remotely access the `Sailthru REST API` as per [http://docs.sailthru.com/api](http://docs.sailthru.com/api) | ||
Installation | ||
------------ | ||
### npm install sailthru-client | ||
Examples | ||
-------- | ||
### Initialization | ||
var apiKey = '******', | ||
apiSecret = '*****', | ||
sailthru = require('sailthru-client').createSailthruClient(apiKey, apiSecret); | ||
### [send](http://docs.sailthru.com/api/send) | ||
//send | ||
var template = 'my-template', | ||
email = 'praj@sailthru.com', | ||
options = { | ||
'vars': { | ||
'name': 'Prajwal Tuladhar', | ||
'address': 'Queens, NY' | ||
}, | ||
'options': { | ||
'test': 1, | ||
'replyto': 'praj@infynyxx.com' | ||
} | ||
}; | ||
sailthru.send(template, email, function(response, err) { | ||
if (err) { | ||
console.log("Status Code: " + err.statusCode); | ||
console.log("Error Code: " + err.error); | ||
console.log("Error Message: " + err.errormsg); | ||
} else { | ||
//process output | ||
} | ||
}, options); | ||
//multi-send | ||
var emails = ['praj@sailthru.com', 'ian@sailthru.com', 'will@sailthru.com'], | ||
template = 'multi-template', | ||
options = { | ||
'options': { | ||
'test': 1 | ||
} | ||
}; | ||
sailthru.multiSend(template, emails, function(response, err) { | ||
if (err) { | ||
//Process error | ||
} else { | ||
//process JSON output | ||
} | ||
}, options); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
355
60
2
24893
12
- Removedhashlib@>=1.0.0
- Removedhashlib@1.0.1(transitive)