Socket
Socket
Sign inDemoInstall

nodejitsu-api

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejitsu-api - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

examples/user-signup.js

12

lib/client.js

@@ -1,2 +0,2 @@

var parts = ['Apps', 'Users', 'Snapshots', 'Databases', 'Logs', 'Client']
var parts = ['Apps', 'Users', 'Snapshots', 'Databases', 'Logs', 'Client'];

@@ -11,5 +11,11 @@ parts.forEach(function (k) {

client[k.toLowerCase()] = new exports[k](options);
client[k.toLowerCase()].on('debug::request', debug);
client[k.toLowerCase()].on('debug::response', debug);
});
function debug (arguments) {
if (options.debug) {
console.log(arguments);
}
}
return client;
}
}

@@ -49,4 +49,5 @@ /*

Apps.prototype.create = function (app, callback) {
var appName = defaultUser.call(this, app.name);
this.request('POST', ['apps', username, app.name], app, callback, function (res, result) {
this.request('POST', ['apps', appName], app, callback, function (res, result) {
callback(null, result || res.statusCode);

@@ -155,3 +156,3 @@ })

Apps.prototype.available = function (app, callback) {
var appName = defaultUser.call(this, appName),
var appName = defaultUser.call(this, app.name),
argv = ['apps'].concat(appName.split('/')).concat('available');

@@ -158,0 +159,0 @@

@@ -10,2 +10,4 @@ /*

request = require('request'),
util = require('util'),
EventEmitter = require('events').EventEmitter,
Client = require('./client').Client;

@@ -31,2 +33,4 @@

util.inherits(Client, EventEmitter);
//

@@ -71,2 +75,6 @@ // ### @private function request (method, uri, [body], success, callback)

var self = this;
self.emit('debug::request', options);
this._request(options, function (err, response, body) {

@@ -76,5 +84,5 @@ if (err) {

}
var statusCode, result, error;
try {

@@ -88,2 +96,4 @@ statusCode = response.statusCode.toString();

self.emit('debug::response', { statusCode: statusCode, result: result });
var poweredBy = response.headers['x-powered-by'];

@@ -121,10 +131,14 @@ if (!poweredBy || poweredBy.indexOf('Nodejitsu') === -1) {

var self = this,
options,
out,
options,
out,
encoded,
proxy = self.options.get('proxy');
encoded = new Buffer(this.options.get('username') + ':' + this.options.get('password')).toString('base64');
fs.readFile(file, function (err, data) {
fs.stat(file, function (err, stat) {
if (err) {
return callback(err);
}
options = {

@@ -136,10 +150,10 @@ method: 'POST',

'Content-Type': contentType,
'Content-Length': data.length
'Content-Length': stat.size
}
};
if(proxy) {
options.proxy = proxy;
}
out = self._request(options, function (err, response, body) {

@@ -146,0 +160,0 @@ if (err) {

@@ -61,3 +61,3 @@ /*

//
// ### function create (appName, snapshotName, callback)
// ### function destroy (appName, snapshotName, callback)
// #### @appName {string} Name of the application to destroy a snapshot for.

@@ -64,0 +64,0 @@ // #### @snapshotName {string} Name of the snapshot to destroy.

{
"name": "nodejitsu-api",
"version": "0.2.4",
"version": "0.2.5",
"description": "nodejitsu API client wrapper",

@@ -11,6 +11,13 @@ "homepage": "http://github.com/nodejitsu/nodejitsu-api",

"main": "./lib/client.js",
"scripts": {
"test": "vows --spec ./test/commands/*-test.js"
},
"dependencies": {
"request": "2.2.x"
},
"devDependencies": {
"vows": "0.6.x",
"nock": "0.10.x"
},
"author": "Nodejitsu <info@nodejitsu.com>"
}

@@ -51,3 +51,3 @@ # nodejitsu-api/node.js

* `password`: The password for your Nodejitsu account
* `remoteUri`: The uri of the api host (typically (http://api.nodejitsu.com)[http://api.nodejitsu.com]).
* `remoteUri`: The uri of the api host (typically [http://api.nodejitsu.com](http://api.nodejitsu.com)).

@@ -101,4 +101,12 @@

## Tests
All tests are written with [vows](http://vowsjs.org) and should be run with [npm](http://npmjs.org):
``` bash
$ npm test
```
## License
MIT.
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