# gekoq

> Thin wrapper for pushing to Geckoboard's custom widgets

Latest version **1.7.0** (published 2016-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install gekoq
pnpm add gekoq
yarn add gekoq
bun add gekoq
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.7.0 |
| Published | 2016-07-27 |
| First published | 2015-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Mendes |
| Maintainers | jasonmendes |

## Links

- npm: https://www.npmjs.com/package/gekoq
- Repository: https://github.com/jasonmendes/gekoq
- Issues: https://github.com/jasonmendes/gekoq/issues
- npm.io page: https://npm.io/package/gekoq

## Recent versions

- 1.7.0 (latest) — 2016-07-27
- 1.6.1 — 2016-06-02
- 1.6.0 — 2016-06-02
- 1.5.2 — 2016-06-01
- 1.5.1 — 2016-06-01
- 1.5.0 — 2016-06-01
- 1.0.3 — 2015-12-03
- 1.0.2 — 2015-12-03
- 1.0.1 — 2015-12-03
- 1.0.0 — 2015-12-03
- 0.2.0 — 2015-12-03
- 0.1.1 — 2015-11-14
- 0.1.0 — 2015-11-14
- 0.0.8 — 2015-09-25
- 0.0.7 — 2015-08-04
- … 4 more at https://npm.io/package/gekoq/versions

## README

# gekoq
A thin wrapper for pushing to Geckoboard's custom widgets using Node.js. Requires Node >=4.0.0

*gekoq comes from the [Malay word for gecko](http://etymonline.com/index.php?term=gecko), said to be imitative of its sound.*

See [Change Log](#change-log) below.

### Install & Usage

```
$ npm install gekoq
```

The default exported value is a *Function* that accepts the Geckoboard API key. This then returns a *Function* that accepts an *Object* with the properties `key` and `data` and when evaluated pushes to the widget. This returns a *Promise*.

E.g.

```
const gekoq = require('gekoq');

const push = gekoq('a094dabc561c521f81782627f1c2by73');

push({
  key: '147539-72d8b6cf-8766-4ead-bd1e-b671e8a5ab86',
  data: { item: [{ value: 1200 }] }
})
.then(response => console.log(response));
```

A good strategy is to store keys as environment variables. In the terminal (or add to your `.{bash,zsh}rc`): 

```
$ export GECKOBOARD_API_KEY=a094dabc561c521f81782627f1c2by73
```

then

```
const push = gekoq(process.env.GECKOBOARD_API_KEY);
```

Use Promises to push an array of widgets

```
const dashboard = [
  {
    key: '119097-1c74815e-8658-48a0-80f3-cdb79a07754c',
    data: { item: [ { value: 100 } ] }
  },
  {
    key: '145647-f084514b-27dc-4552-a267-e6e3cc069baf',
    data: { item: [ { value: 200 } ] }
  }
]

Promise.all(dashboard.map(push)).then(...);
```

### Change Log

#### 1.6.0
Fixed the `'Content-Length'` header which used previously the value returned from `String.prototype.length`. This causes problems when a character has two code points. Now using `Buffer.byteLength`.

#### 1.5.x
Node 5 build. The default export now returns a *Function* which expects the Geckoboard API key and returns a *Function* that expects an *Object* with the properties `key` and `data`. The returned *Function* is `then`able (i.e. it returns a *Promise*).

#### 1.0.x
Introduced the breaking change whereby `gekoq.push` now accepts an *Object* with the required properties `key` and `data` (where previously it expected `id` instead of `key`). This was done to match the name that Geckoboard refers to this property in the widget configuration.

---
_Source: https://npm.io/package/gekoq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
