Permalink
Browse files

Merge pull request #6 from psobot/patch-2

Removed calls to deprecated node API.
  • Loading branch information...
2 parents 890da6c + de4322a commit 71df01e2b8c7d306d9fddc132002dd7b4a3a1476 PostageApp committed Sep 24, 2012
Showing with 25 additions and 16 deletions.
  1. +25 −16 lib/postageapp.js
View
@@ -5,14 +5,17 @@ var postageVersion = '1.1.0';
module.exports = function(apiKey) {
return {
sendMessage: function (options, callback) {
- var api = http.createClient(80, 'api.postageapp.com');
-
- var request = api.request('POST', '/v.1.0/send_message.json',
- {
+ var request = http.request({
+ 'port': 80,
+ 'host': 'api.postageapp.com',
+ 'method': 'POST',
+ 'path': '/v.1.0/send_message.json',
+ 'headers': {
'host': 'api.postageapp.com',
'content-type': 'application/json',
'user-agent': 'PostageApp Node.JS ' + postageVersion + ' (Node.JS ' + process.version + ')'
- });
+ }
+ });
var recipients = options.recipients;
@@ -64,14 +67,17 @@ module.exports = function(apiKey) {
},
accountInfo: function () {
- var api = http.createClient(80, 'api.postageapp.com');
-
- var request = api.request('POST', '/v.1.0/get_account_info.json',
- {
+ var request = http.request({
+ 'port': 80,
+ 'host': 'api.postageapp.com',
+ 'method': 'POST',
+ 'path': '/v.1.0/get_account_info.json',
+ 'headers': {
'host': 'api.postageapp.com',
'content-type': 'application/json',
'user-agent': 'PostageApp Node.JS ' + postageVersion + ' (Node.JS ' + process.version + ')'
- });
+ }
+ });
var payload = {
api_key: apiKey
@@ -88,13 +94,16 @@ module.exports = function(apiKey) {
},
messageStatus: function (options) {
- var api = http.createClient(80, 'api.postageapp.com');
-
- var request = api.request('POST', '/v.1.0/message_status.json',
- {
+ var request = http.request({
+ 'port': 80,
'host': 'api.postageapp.com',
- 'content-type': 'application/json',
- 'user-agent': 'PostageApp Node.JS ' + postageVersion + ' (Node.JS ' + process.version + ')'
+ 'method': 'POST',
+ 'path': '/v.1.0/message_status.json',
+ 'headers': {
+ 'host': 'api.postageapp.com',
+ 'content-type': 'application/json',
+ 'user-agent': 'PostageApp Node.JS ' + postageVersion + ' (Node.JS ' + process.version + ')'
+ }
});
var desiredUID = options.desiredUID;

0 comments on commit 71df01e

Please sign in to comment.