NYTimes/elemental-live-client

Name: elemental-live-client

Owner: The New York Times

Description: JS library to communicate with Elemental live API.

Created: 2017-02-02 17:20:19.0

Updated: 2018-05-17 18:18:30.0

Pushed: 2018-03-02 20:04:58.0

Homepage:

Size: 156

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

elemental-live-client

Build Status codecov

JS library to communicate with Elemental live API.

Usage

The client provides standard methods for resources, so calls will use be structured in the format <client-instance>.<resource>().<operation>().

API operations always return promises that resolve with the response data and fail with details about the failure. An example, listing presets:

t client = new ElementalClient('https://elemental-server.example.com');

nt.presets().list()
hen((data) => console.log(`Got presets: ${data}`))
atch((err) => console.log(`Something went wrong: ${err}`));
Available resources

The following resources are currently available:

Available operations

Common operations are:

Some resources might include more specific operations (for example, resetting a live event).

Contributing

Contributions are welcome! In order to run this project locally, you have to have node.js 6+ installed locally. We also recommend using yarn for managing dependencies, but plain-old npm should work just fine.

Just make sure your contributions pass the test suite and eslint validation. Travis CI will help you in ensuring that :)

Setting up local environment

Setting up the local environment is a simple task: just ensure that you have node.js and yarn installed, clone this repo and then run:

rn

This will install all dependencies.

Running tests and eslint

After installing all dependencies, you can run the tests with the command:

rn test

linting is also available, provided by eslint. The command to lint the source is very intuitive:

rn lint
Integration tests/Examples

You can integration tests in the file test/integration-test.js file. It contains integration tests that can also serve as examples on how to use the client.

To run integration tests locally, you need to provide the address of an actual Elemental server through the environment variable ELEMENTAL_CLIENT_INTEGRATION_TESTS_HOST and run yarn test. For example:

EMENTAL_CLIENT_INTEGRATION_TESTS_HOST=http://elemental-live.example.com yarn test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.