Skip to content
Browse files

Added "get_account_info" function to the module, getting understandin…

…g of how to add more functions.
  • Loading branch information...
1 parent c1d2766 commit 98682ad6e052bd577ac102725c0e5c9d97e96793 @JonLim JonLim committed Jul 19, 2011
Showing with 25 additions and 1 deletion.
  1. +24 −0 lib/postageapp.js
  2. +1 −1 package.json
View
24 lib/postageapp.js
@@ -51,6 +51,30 @@ module.exports = function(apiKey) {
request.on('response', function (response) {});
request.end(JSON.stringify(payload));
+ },
+
+ accountInfo: function () {
+ var api = http.createClient(80, 'api.postageapp.com');
+
+ var request = api.request('POST', '/v.1.0/get_account_info.json',
+ {
+ 'host': 'api.postageapp.com',
+ 'content-type': 'application/json',
+ 'user-agent': 'PostageApp Node.JS ' + postageVersion + ' (Node.JS ' + process.version + ')'
+ });
+
+ var payload = {
+ api_key: apiKey
+ }
+
+ request.on('response', function (response) {
+ console.log('STATUS: ' + response.statusCode);
+ response.setEncoding('utf8');
+ response.on('data', function (chunk) {
+ console.log('BODY: ' + chunk);
+ });
+ });
+ request.end(JSON.stringify(payload));
}
}
};
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "postageapp",
- "version": "0.0.2",
+ "version": "0.0.3",
"node": ">= 0.4.0",
"homepage": "https://github.com/postageapp/postageapp-nodejs",
"repository": {

0 comments on commit 98682ad

Please sign in to comment.
Something went wrong with that request. Please try again.