heroku.js

0.12.2 • Public • Published

Heroku.js

The Node.js implementation of the Heroku API. Initially a port of Heroku.rb, Heroku.jar and Heroku.py, but with some Javascript-isms and some aliases added for convention and convenience.

Installation

1 Install via npm

npm install heroku.js

Usage

Begin by instantiating with credentials. You can use an application API Key, a user email address and API Token, or a username and password. The latter will fetch an API Key first, so it is an asynchronous request. It will require a callback. If you pass nothing, it will attempt to read process.env['HEROKU_API_KEY']

// Instantiate with the API Key in the environment
var api = new HerokuAPI();
 
// Instantiate with API Key
var api = new HerokuAPI({"apiKey" : apiKey});
 
// Instantiate with email and API Token
var api = new HerokuAPI({"email" : email, "apiToken" : apiToken});
 
// Instantiate with username and password **Async reminder**
new HerokuAPI({ "username" : username, "password" : password }, function(api) {
  // Use the `api` here
});

Create an application on the cedar stack

var api = new HerokuAPI(apiKey);
var app = api.postApp({
  "stack" : "Cedar",
  "name" : "MyApp"
});

List applications

var api = new HerokuAPI(apiKey);
var apps = api.getApps();
for (var i=0; l=apps.length; i < l; i++) {
  console.log(app.name);
}

Add Config

var api = new HerokuAPI(apiKey);
api.putConfigVars("myExistingApp", { "SOME_KEY" : "SOMEVALUE" });

Get Config

var api = new HerokuAPI(apiKey);
var config = api.getConfigVars("myExistingApp");
console.log(config);

Remove Config

var api = new HerokuAPI(apiKey);
api.deleteConfigVar("myExistingApp", "SOME_KEY");

Building Locally

1 Clone the repository

git clone https://github.com/dncrews/heroku.js.git

2 Run the testing suite (eventual - This is currently non-functional).

npm test
  • Todo
    • Different Error Handling
      • Unauthorized
      • Verification Required
      • Forbidden
      • Not Found
      • Timeout
      • Locked
      • Rate Limit Exceeded
      • Request Failed
      • Nil App
    • Mock API
      • This one is HUGE. It's to make my tests actually work

Readme

Keywords

none

Package Sidebar

Install

npm i heroku.js

Weekly Downloads

10

Version

0.12.2

License

none

Last publish

Collaborators

  • dncrews