# vudash-transports

> Various transports for vudash widgets

Latest version **5.2.2** (published 2017-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install vudash-transports
pnpm add vudash-transports
yarn add vudash-transports
bun add vudash-transports
```

## 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 | 5.2.2 |
| Published | 2017-02-07 |
| First published | 2016-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+3 in 3 direct dependencies) |
| Install scripts | no |
| Maintainers | antony |

## Links

- npm: https://www.npmjs.com/package/vudash-transports
- npm.io page: https://npm.io/package/vudash-transports

## Dependencies (6)

- [joi](https://npm.io/package/joi.md) ^9.0.4
- [hoek](https://npm.io/package/hoek.md) ^4.1.0
- [chance](https://npm.io/package/chance.md) ^1.0.4
- [request](https://npm.io/package/request.md) ^2.75.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.1.1
- [spreadsheet-to-json](https://npm.io/package/spreadsheet-to-json.md) ^1.0.5

## Recent versions

- 5.2.2 (latest) — 2017-02-07
- 5.2.1 — 2017-02-03
- 5.1.1 — 2017-01-22
- 5.0.0 — 2017-01-14
- 1.3.0 — 2016-11-27
- 1.2.0 — 2016-11-27
- 1.1.0 — 2016-10-24
- 1.0.2 — 2016-10-15
- 1.0.1 — 2016-10-10
- 1.0.0 — 2016-09-25

## README

## Vudash transports

A data source abstraction for Vudash widgets.

### Overview

Vudash transports can be installed as a dependency of any widget to allow a user to pick from a number of sources of data.

This saves time for a widget developer, and means that any widget can easily fetch data from a number of different sources.

### Supported sources

| Transport name | Transport Data Source | Documentation |
|----------------|-----------------------|---------------|
|  value          | config ```{ value: <value> }``` | [docs/value]()
|  random         | [chance.natural({ min: 0, max: 999})](http://chancejs.org) | [docs/random]()
|  rest           | http(s) using [request](http://requestjs.org) | [docs/rest]()
|  google-sheets  | [Google Sheets](http://drive.google.com) | [docs/google-sheets]()

### Usage (For developers)

1. In order to use in a widget, install the module:
  ```npm i -s vudash-transports```
2. Then simply read the `data-source` value from the widget's options, and pass it into `Transport.configure` in your widget's constructor.
  ```
  const Transport = require('vudash-transports')

  constructor (options) {
    this.transport = Transport.configure(options['data-source'])
  }
  ```
3. To fetch data, just ask the transport for it.
  ```
    this.transport.fetch()
    .then((data) => {
      // do something with data
    })
  ```

### Usage (For widget consumers)

When using a widget which uses `vudash-transports`, the consumer simply passes in the transport config:

```
  // my-dashboard.json
  {
    position: [...],
    widget: 'some-widget',
    options: {
      ...
      "data-source": {
        source: 'rest',
        config: {
          url: 'http://example.com/some/api',
          method: 'get',
          graph: 'some.nested.value'
        }
      }
    }
  }
```

where `data-source.source` is one of the supported transports listed at the top of this readme, and `data-source.config` is
the transport specific config, such as credentials for third party services, or URLs for web services, etc.

All configuration is validated by a transport method, using Joi.

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