postageapp
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib/postageapp'); | ||
module.exports = require('./lib/postageapp'); |
var http = require('http'); | ||
var crypto = require('crypto'); | ||
var postageVersion = '1.1.4'; | ||
var postageVersion = require('../package.json').version; | ||
@@ -6,0 +6,0 @@ module.exports = function(apiKey) { |
{ | ||
"name": "postageapp", | ||
"version": "1.1.4", | ||
"node": ">= 0.4.0", | ||
"homepage": "https://github.com/postageapp/postageapp-nodejs", | ||
"repository": { | ||
"type":"git", | ||
"url":"https://github.com/postageapp/postageapp-nodejs" | ||
"name": "postageapp", | ||
"version": "1.1.5", | ||
"node": ">= 0.6.0", | ||
"homepage": "https://github.com/postageapp/postageapp-nodejs", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/postageapp/postageapp-nodejs" | ||
}, | ||
"author": { | ||
"name": "PostageApp", | ||
"url": "http://postageapp.com/" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Scott Tadman", | ||
"email": "tadman@postageapp.com", | ||
"url": "http://postageapp.com/" | ||
}, | ||
"author": {"name":"PostageApp", "url":"http://postageapp.com"}, | ||
"contributors": [{"name":"Jon Lim", "email": "jon@postageapp.com", "url":"http://postageapp.com"}], | ||
"description": "Node.JS package for sending emails through PostageApp", | ||
"licenses": [{"type": "MIT", "url": "https://github.com/postageapp/postageapp-nodejs/blob/master/LICENSE"}], | ||
"main": "index" | ||
{ | ||
"name": "Jon Lim", | ||
"email": "jon@postageapp.com" | ||
} | ||
], | ||
"description": "Client library for PostageApp", | ||
"license": "MIT", | ||
"main": "index", | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"chai": "^3.5.0", | ||
"mocha": "^3.1.2" | ||
} | ||
} |
@@ -16,26 +16,6 @@ # PostageApp for Node.JS | ||
In your app directory type: | ||
In your application's main directory: | ||
npm install postageapp --save | ||
### Manual | ||
* Download this: https://github.com/postageapp/postageapp-nodejs/tarball/master | ||
* Unzip that download. | ||
* Copy the resulting folder to `node_modules` | ||
* Rename the folder you just copied to `postageapp` | ||
### GIT Submodule | ||
In your app directory type: | ||
git submodule add git@github.com:postageapp/postageapp-nodejs.git plugins/postage | ||
git submodule init | ||
git submodule update | ||
### GIT Clone | ||
In your `node_modules` directory type | ||
<pre><code>git clone git@github.com:postageapp/postageapp-nodejs.git postageapp</code></pre> | ||
## Sending a Message | ||
@@ -42,0 +22,0 @@ |
@@ -1,61 +0,62 @@ | ||
var assert = require("assert"), | ||
settings = require('./settings.json'), | ||
postageapp = require('../lib/postageapp')(settings.apikey); | ||
var assert = require('chai').assert; | ||
var settings = require('./config/test.json'); | ||
var postageapp = require('../lib/postageapp')(settings.apikey); | ||
describe('postageapp', function () { | ||
this.timeout(5000); | ||
this.timeout(5000); | ||
describe('version', function() { | ||
it('should return a version string', function() { | ||
assert.equal('string', typeof(postageapp.version())); | ||
}); | ||
describe('version', function() { | ||
it('should return a version string', function() { | ||
assert.equal('string', typeof(postageapp.version())); | ||
}); | ||
}); | ||
describe('sendMessage', function () { | ||
it('should get a successful response back from the server', function (done) { | ||
postageapp.sendMessage({ | ||
content: "hello world", | ||
recipients: 'test@null.postageapp.com' | ||
}, function(throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}); | ||
}); | ||
describe('sendMessage', function () { | ||
it('should get a successful response back from the server', function (done) { | ||
postageapp.sendMessage({ | ||
content: "hello world", | ||
recipients: 'test@null.postageapp.com' | ||
}, function(throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}); | ||
}); | ||
it('should invoke the error callback for a bogus request', function(done) { | ||
postageapp.sendMessage({}, function() {}, function(err, r) { | ||
assert.equal('precondition_failed', r.response.status); | ||
done(); | ||
}); | ||
}); | ||
it('should invoke the error callback for a bogus request', function(done) { | ||
postageapp.sendMessage({}, function() {}, function(err, r) { | ||
assert.equal('precondition_failed', r.response.status); | ||
done(); | ||
}); | ||
}); | ||
it('should work with utf8-encoded content', function(done) { | ||
postageapp.sendMessage({ | ||
content: "hello snowman ☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃", | ||
recipients: "test@null.postageapp.com" | ||
}, function(throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}, function(err) { | ||
console.log(err); | ||
assert(false, 'should not have received an error') | ||
done(); | ||
}); | ||
}); | ||
it('should work with utf8-encoded content', function(done) { | ||
postageapp.sendMessage({ | ||
content: "hello snowman ☃☃☃☃☃☃☃☃☃☃☃☃☃☃☃", | ||
recipients: "test@null.postageapp.com" | ||
}, function(throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}, function(err) { | ||
console.log(err); | ||
assert(false, 'should not have received an error') | ||
done(); | ||
}); | ||
}); | ||
it('should support recipient override', function(done) { | ||
postageapp.sendMessage({ | ||
content: 'recipient override test', | ||
recipients: 'test@null.postageapp.com', | ||
recipient_override: 'test2@null.postageapp.com' | ||
}, function (throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}, function (err) { | ||
console.log(err); | ||
assert(false, 'should not have received an error'); | ||
done(); | ||
}); | ||
}); | ||
it('should support recipient override', function(done) { | ||
postageapp.sendMessage({ | ||
content: 'recipient override test', | ||
recipients: 'test@null.postageapp.com', | ||
recipient_override: 'test2@null.postageapp.com' | ||
}, function (throwaway, r) { | ||
assert.equal('ok', r.response.status); | ||
done(); | ||
}, function (err) { | ||
console.log(err); | ||
assert(false, 'should not have received an error'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
205
13695
2
149