Socket
Socket
Sign inDemoInstall

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 1.2.0 to 1.4.0

docs/appSetup.md

8

docs/appFeature.md

@@ -9,7 +9,7 @@ # app-feature

`heroku.apps({app_id_or_name}).features({app_id_or_name}).info({callback});`
`heroku.apps({app_id_or_name}).features({app-feature_id_or_name}).info({callback});`
Method | Path
--- | ---
GET | /apps/{app_id_or_name}/features/{app_id_or_name}
GET | /apps/{app_id_or_name}/features/{app-feature_id_or_name}

@@ -26,7 +26,7 @@ ### `list`

`heroku.apps({app_id_or_name}).features({app_id_or_name}).update({attributes}, {callback});`
`heroku.apps({app_id_or_name}).features({app-feature_id_or_name}).update({attributes}, {callback});`
Method | Path
--- | ---
PATCH | /apps/{app_id_or_name}/features/{app_id_or_name}
PATCH | /apps/{app_id_or_name}/features/{app-feature_id_or_name}
{
"name": "heroku-client",
"version": "1.2.0",
"version": "1.4.0",
"description": "A wrapper for the Heroku v3 API",

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

@@ -5,2 +5,15 @@ # heroku-client [![Build Status](https://travis-ci.org/jclem/node-heroku-client.png?branch=master)](https://travis-ci.org/jclem/node-heroku-client)

- [Install](#install)
- [Documentation](#documentation)
- [Usage](#usage)
- [Generic Requests](#generic-requests)
- [Promises](#promises)
- [Generators](#generators)
- [HTTP Proxies](#http-proxies)
- [Caching](#caching)
- [Contributing](#contributing)
- [Updating resources](#updating-resources)
- [Generating documentation](#generating-documentation)
- [Running tests](#running-tests)
## Install

@@ -14,3 +27,4 @@

Docs are auto-generated and live in the [docs directory](https://github.com/heroku/node-heroku-client/tree/development/docs).
Docs are auto-generated and live in the
[docs directory](https://github.com/heroku/node-heroku-client/tree/development/docs).

@@ -74,3 +88,4 @@ ## Usage

heroku-client has `get`, `post`, `patch`, and `delete` functions which can make requests with the specified HTTP method to any endpoint:
heroku-client has `get`, `post`, `patch`, and `delete` functions which can make
requests with the specified HTTP method to any endpoint:

@@ -95,3 +110,4 @@ ```javascript

There is also an even more generic `request` function that can accept many more options:
There is also an even more generic `request` function that can accept many more
options:

@@ -111,3 +127,4 @@ ```javascript

heroku-client works with Node-style callbacks, but also implements promises with the [Q][q] library.
heroku-client works with Node-style callbacks, but also implements promises with
the [Q][q] library.

@@ -131,11 +148,57 @@ ```javascript

### Generators
It's easy to get heroku-client working with [generators][generators]. In this
example, I'll use the [co][co] library to wrap a function that will get the list
of all of my apps, and then get the dynos for each of those apps:
```javascript
let co = require('co');
let heroku = require('heroku-client');
let hk = heroku.createClient({ token: process.env.HEROKU_API_KEY });
let main = function* () {
let apps = yield hk.apps().list();
let dynos = yield apps.map(getDynos);
console.log(dynos);
function getDynos(app) {
return hk.apps(app.name).dynos().list();
}
};
co(main)();
```
As long as you're using Node >= 0.11, you can run this script with:
```sh
$ node --harmony --use-strict file.js
```
Hooray, no callbacks or promises in sight!
### HTTP Proxies
If you'd like to make requests through an HTTP proxy, set the `HEROKU_HTTP_PROXY_HOST` environment variable with your proxy host, and `HEROKU_HTTP_PROXY_PORT` with the desired port (defaults to 8080). heroku-client will then make requests through this proxy instead of directly to api.heroku.com.
If you'd like to make requests through an HTTP proxy, set the
`HEROKU_HTTP_PROXY_HOST` environment variable with your proxy host, and
`HEROKU_HTTP_PROXY_PORT` with the desired port (defaults to 8080). heroku-client
will then make requests through this proxy instead of directly to
api.heroku.com.
## Caching
heroku-client performs caching by creating a memcached client using [memjs][memjs]. See the memjs repo for environment-specific configuration instructions and details.
heroku-client performs caching by creating a memcached client using
[memjs][memjs]. See the memjs repo for environment-specific configuration
instructions and details.
heroku-client will cache any response from the Heroku API that comes with an `ETag` header, and each response is cached individually (i.e. even though the client might make multiple calls for a user's apps and then aggregate them into a single JSON array, each required API call is individually cached). For each API request it performs, heroku-client sends an `If-None-Match` header if there is a cached response for the API request. If API returns a 304 response code, heroku-client returns the cached response. Otherwise, it writes the new API response to the cache and returns that.
heroku-client will cache any response from the Heroku API that comes with an
`ETag` header, and each response is cached individually (i.e. even though the
client might make multiple calls for a user's apps and then aggregate them into
a single JSON array, each required API call is individually cached). For each
API request it performs, heroku-client sends an `If-None-Match` header if there
is a cached response for the API request. If API returns a 304 response code,
heroku-client returns the cached response. Otherwise, it writes the new API
response to the cache and returns that.

@@ -148,7 +211,18 @@ To tell heroku-client to perform caching, call the `configure` function:

This requires a `MEMCACHIER_SERVERS` environment variable, as well as a `HEROKU_CLIENT_ENCRYPTION_SECRET` environment variable that heroku-client uses to build cache keys and encrypt cache contents.
This requires a `MEMCACHIER_SERVERS` environment variable, as well as a
`HEROKU_CLIENT_ENCRYPTION_SECRET` environment variable that heroku-client uses
to build cache keys and encrypt cache contents.
`HEROKU_CLIENT_ENCRYPTION_SECRET` should be a long, random string of characters. heroku-client includes [`bin/secret`][bin_secret] as one way of generating values for this variable. **Do not publish this secret or commit it to source control. If it's compromised, flush your memcache and generate a new encryption secret.**
`HEROKU_CLIENT_ENCRYPTION_SECRET` should be a long, random string of characters.
heroku-client includes [`bin/secret`][bin_secret] as one way of generating
values for this variable. **Do not publish this secret or commit it to source
control. If it's compromised, flush your memcache and generate a new encryption
secret.**
`MEMCACHIER_SERVERS` can be a single `hostname:port` memache address, or a comma-separated list of memcache addresses, e.g. `example.com:11211,example.net:11211`. Note that while the environment variable that memjs looks for is [named for the MemCachier service it was originally built for][memcachier], it will work with any memcache server that speaks the binary protocol.
`MEMCACHIER_SERVERS` can be a single `hostname:port` memache address, or a
comma-separated list of memcache addresses, e.g.
`example.com:11211,example.net:11211`. Note that while the environment variable
that memjs looks for is
[named for the MemCachier service it was originally built for][memcachier], it
will work with any memcache server that speaks the binary protocol.

@@ -165,7 +239,11 @@ ## Contributing

Inspect your changes, and [bump the version number accordingly](http://semver.org/) when cutting a release.
Inspect your changes, and
[bump the version number accordingly](http://semver.org/) when cutting a
release.
### Generating documentation
Documentation for heroku-client is auto-generated from [the API schema](https://github.com/jclem/node-heroku-client/blob/development/lib/schema.js).
Documentation for heroku-client is auto-generated from
[the API schema](https://github.com/jclem/node-heroku-client/blob/development/lib/schema.js).
Docs are generated like so:

@@ -177,3 +255,4 @@

Generating docs also runs a cursory test, ensuring that every documented function *is* a function that can be called.
Generating docs also runs a cursory test, ensuring that every documented
function *is* a function that can be called.

@@ -194,1 +273,3 @@ ### Running tests

[jasmine-node]: https://github.com/mhevery/jasmine-node
[generators]: https://github.com/JustinDrake/node-es6-examples#generators
[co]: https://github.com/visionmedia/co

Sorry, the diff of this file is too big to display

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