Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

heroku-client

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-client - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

26

lib/heroku.js

@@ -38,2 +38,28 @@ var Request = require('./request'),

Heroku.prototype.get = function get (path, callback) {
return this.request({ method: 'GET', path: path }, callback);
};
Heroku.prototype.post = function post (path, body, callback) {
if (typeof body === 'function') {
callback = body;
body = {};
}
return this.request({ method: 'POST', path: path, body: body }, callback);
};
Heroku.prototype.patch = function patch (path, body, callback) {
if (typeof body === 'function') {
callback = body;
body = {};
}
return this.request({ method: 'PATCH', path: path, body: body }, callback);
};
Heroku.prototype.delete = function _delete (path, callback) {
return this.request({ method: 'DELETE', path: path }, callback);
};
require('./resourceBuilder').build();

2

package.json
{
"name": "heroku-client",
"version": "0.8.0",
"version": "0.9.0",
"description": "A wrapper for the Heroku v3 API",

@@ -5,0 +5,0 @@ "main": "./lib/heroku.js",

@@ -12,6 +12,5 @@ var Heroku = require('../../lib/heroku'),

it('passes its method into the request', function(done) {
it('passes its method into the request', function() {
heroku.apps().create({}, function() {
expect(Request.request.mostRecentCall.args[0].method).toEqual('POST');
done();
});

@@ -29,20 +28,17 @@ });

describe('requests with no body', function() {
it('can perform a request with no parameters', function(done) {
it('can perform a request with no parameters', function() {
heroku.apps().list(function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps');
done();
});
});
it('can perform a request with one parameter', function(done) {
it('can perform a request with one parameter', function() {
heroku.apps('my-app').info(function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps/my-app');
done();
});
});
it('can perform a request with multiple parameters', function(done) {
it('can perform a request with multiple parameters', function() {
heroku.apps('my-app').collaborators('jonathan@heroku.com').info(function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps/my-app/collaborators/jonathan@heroku.com');
done();
});

@@ -53,13 +49,11 @@ });

describe('requests with a body and no parameters', function() {
it('requests the correct path', function(done) {
it('requests the correct path', function() {
heroku.apps().create({ name: 'my-app' }, function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps');
done();
});
});
it('sends the request body', function(done) {
it('sends the request body', function() {
heroku.apps().create({ name: 'my-new-app' }, function() {
expect(Request.request.mostRecentCall.args[0].body).toEqual({ name: 'my-new-app' });
done();
});

@@ -70,13 +64,11 @@ });

describe('requests with a body and one parameter', function() {
it('requests the correct path', function(done) {
it('requests the correct path', function() {
heroku.apps('my-app').addons().create({ name: 'papertrail:choklad' }, function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps/my-app/addons');
done();
});
});
it('sends the request body', function(done) {
it('sends the request body', function() {
heroku.apps('my-app').addons().create({ name: 'papertrail:choklad' }, function() {
expect(Request.request.mostRecentCall.args[0].body).toEqual({ name: 'papertrail:choklad' });
done();
});

@@ -87,16 +79,86 @@ });

describe('requests with a body and multiple parameters', function() {
it('requests the correct path', function(done) {
it('requests the correct path', function() {
heroku.apps('my-app').addons('papertrail:choklad').update({ name: 'papertrail:fixa' }, function() {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps/my-app/addons/papertrail:choklad');
done();
});
});
it('sends the request body', function(done) {
it('sends the request body', function() {
heroku.apps('my-app').addons('papertrail:choklad').update({ name: 'papertrail:fixa' }, function() {
expect(Request.request.mostRecentCall.args[0].body).toEqual({ name: 'papertrail:fixa' });
done();
});
});
});
describe('#get', function() {
it('does a GET request', function() {
heroku.get('/apps', function () {
expect(Request.request.mostRecentCall.args[0].method).toEqual('GET');
});
});
it('requests the specified path', function() {
heroku.get('/apps', function () {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps');
});
});
});
describe('#post', function() {
it('does a POST request', function() {
heroku.post('/apps', function () {
expect(Request.request.mostRecentCall.args[0].method).toEqual('POST');
});
});
it('requests the specified path', function() {
heroku.post('/apps', function () {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps');
});
});
describe('when a body is supplied', function() {
it('sends the request body', function() {
heroku.post('/apps', { name: 'my-app' }, function () {
expect(Request.request.mostRecentCall.args[0].body).toEqual({ name: 'my-app' });
});
});
});
});
describe('#patch', function() {
it('does a PATCH request', function() {
heroku.patch('/apps', function () {
expect(Request.request.mostRecentCall.args[0].method).toEqual('PATCH');
});
});
it('requests the specified path', function() {
heroku.patch('/apps', function () {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps');
});
});
describe('when a body is supplied', function() {
it('sends the request body', function() {
heroku.patch('/apps', { name: 'my-app' }, function () {
expect(Request.request.mostRecentCall.args[0].body).toEqual({ name: 'my-app' });
});
});
});
});
describe('#delete', function() {
it('does a DELETE request', function() {
heroku.delete('/apps/my-app', function () {
expect(Request.request.mostRecentCall.args[0].method).toEqual('DELETE');
});
});
it('requests the specified path', function() {
heroku.delete('/apps/my-app', function () {
expect(Request.request.mostRecentCall.args[0].path).toEqual('/apps/my-app');
});
});
});
});
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