ha

heroku-addons

[DEPRECATED] A convenience library for fetching metadata about Heroku Addons

Showing:

Popularity

Downloads/wk

0

GitHub Stars

0

Maintenance

Last Commit

8yrs ago

Contributors

0

Package

Dependencies

2

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Heroku Addons [DEPRECATED]

Good news!: The Heroku Platform API now allows unauthenticated requests for Add-on metadata! That means this module no longer needs to exist. More info at https://devcenter.heroku.com/changelog-items/457

A convenience library for querying Heroku's addons API.

Installation

npm install heroku-addons --save

Usage

The library requires a HEROKU_API_TOKEN environment variable to authenticate with the Heroku Platform API. Create a .env file with your token:

echo "HEROKU_API_TOKEN=$(heroku auth:token)" >> .env

Here's a sample script. Let's say it's named demo.js:

var addons = require('heroku-addons')

var slugs = [
  'redistogo',
  'mongohq:sandbox',
  'runscope:starter',
  'bonsai:staging'
]

addons.mix(slugs, function(err, mix) {
  console.log(mix)
})

Run it using foreman, which will make the variables in your .env file available in the script's env:

foreman run node demo.js

The output will look something like this:

{
  totalPrice: "$59/mo",
  totalPriceInCents: 5900,
  plans: [{
    created_at: '2013-08-05T20:50:21Z',
    default: true,
    description: 'Redis To Go Nano',
    id: '0e4db8d1-973a-40a6-8af2-06954105565c',
    name: 'redistogo:nano',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:39Z'
  }, {
    created_at: '2013-08-05T20:50:22Z',
    default: true,
    description: 'MongoHQ MongoHQ Sandbox',
    id: 'c7a19cde-5ba0-4e85-a579-1022abdd344a',
    name: 'mongohq:sandbox',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:40Z'
  }, {
    created_at: '2013-09-13T17:46:32Z',
    default: false,
    description: 'Runscope Starter',
    id: '85e601e0-1b99-483b-8a55-a8abbf36d9c4',
    name: 'runscope:starter',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:20:02Z'
  }, {
    created_at: '2013-08-05T20:50:35Z',
    default: false,
    description: 'Bonsai Elasticsearch Staging',
    id: '0ee349b5-6088-4694-9777-b81088f6072e',
    name: 'bonsai:staging',
    price: [Object],
    state: 'public',
    updated_at: '2013-12-16T22:19:49Z'
  }]
}

See test/index.js for more details.

Tests

The tests are not mocked: they hit the real API. The test suite expects a HEROKU_API_TOKEN in your .env file:

echo "HEROKU_API_TOKEN=$(heroku auth:token)" >> .env
npm test

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial