heroku-client
Advanced tools
Comparing version 0.9.0 to 0.9.1
{ | ||
"name": "heroku-client", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "A wrapper for the Heroku v3 API", | ||
@@ -5,0 +5,0 @@ "main": "./lib/heroku.js", |
@@ -70,2 +70,37 @@ # heroku-client [![Build Status](https://travis-ci.org/heroku/node-heroku-client.png?branch=master)](https://travis-ci.org/heroku/node-heroku-client) | ||
### Generic Requests | ||
heroku-client has `get`, `post`, `patch`, and `delete` functions which can make requests with the specified HTTP method to any endpoint: | ||
```javascript | ||
heroku.get('/apps', function (err, apps) { | ||
}); | ||
// Request body is optional on both `post` and `patch` | ||
heroku.post('/apps', function (err, app) { | ||
}); | ||
heroku.post('/apps', { name: 'my-new-app' }, function (err, app) { | ||
}); | ||
heroku.patch('/apps/my-app', { name: 'my-renamed-app' }, function (err, app) { | ||
}); | ||
heroku.delete('/apps/my-old-app', function (err, app) { | ||
}); | ||
``` | ||
There is also an even more generic `request` function that can accept many more options: | ||
```javascript | ||
heroku.request({ | ||
method: 'GET', | ||
path: '/apps', | ||
headers: { | ||
'Foo': 'Bar' | ||
} | ||
}, function (err, responseBody) { | ||
}); | ||
``` | ||
### Promises | ||
@@ -96,2 +131,4 @@ | ||
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. | ||
To tell heroku-client to perform caching, call the `configure` function: | ||
@@ -105,2 +142,6 @@ | ||
`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. | ||
## Contributing | ||
@@ -134,2 +175,4 @@ | ||
[memjs]: https://github.com/alevy/memjs | ||
[bin_secret]: https://github.com/heroku/node-heroku-client/blob/development/bin/secret | ||
[memcachier]: https://www.memcachier.com | ||
[jasmine-node]: https://github.com/mhevery/jasmine-node |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160046
175