Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mileszim/ember-particle
Ember service for the Particle API
https://github.com/mileszim/ember-particle
api ember ember-addon ember-cli-addon iot particle particle-io spark
Last synced: 23 days ago
JSON representation
Ember service for the Particle API
- Host: GitHub
- URL: https://github.com/mileszim/ember-particle
- Owner: mileszim
- License: mit
- Created: 2017-11-29T01:19:36.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-18T08:08:03.000Z (about 6 years ago)
- Last Synced: 2024-04-25T16:42:45.248Z (6 months ago)
- Topics: api, ember, ember-addon, ember-cli-addon, iot, particle, particle-io, spark
- Language: JavaScript
- Size: 233 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-particle #
[![Build Status](https://travis-ci.org/mileszim/ember-particle.svg?branch=master)](https://travis-ci.org/mileszim/ember-particle) [![npm version](https://badge.fury.io/js/ember-particle.svg)](https://badge.fury.io/js/ember-particle) [![Ember Observer Score](https://emberobserver.com/badges/ember-particle.svg)](https://emberobserver.com/addons/ember-particle)`ember-particle` is an addon for Ember.js providing an injectable service that acts as a wrapper around the [Particle](https://particle.io/) API.
Installation
------------------------------------------------------------------------------```
ember install ember-particle
```Usage
------------------------------------------------------------------------------`ember-particle` enables all functions identical to their API as it is just a wrapper.
#### API Documentation ####
Complete API docs for all Particle.io methods are available at the JS SDK doc site https://docs.particle.io/reference/javascript/### Examples ###
##### *login(username, password)* ####
Login a user with a username and password:
```javascript
//...
import { inject as service } from '@ember/service';export default Controller.extend({
particle: service('particle'),actions: {
loginToParticle(username, password) {
this.get('particle')
.login(username, password)
.then((success) => {
alert('you logged into particle! huzzah!');
})
.catch((error) => {
alert('Something went terribly wrong', error);
});
}
}
});
```#### Device Info ####
##### *listDevices()* ####
List devices for a user
```javascript
//...
import { inject as service } from '@ember/service';export default Controller.extend({
particle: service('particle'),
devices: this.get('particle').listDevices()
});
```##### *getDevice(deviceId)* ####
Gets all attributes for a device
```javascript
//...
import { inject as service } from '@ember/service';export default Controller.extend({
particle: service('particle'),
device: this.get('particle').getDevice('asdf1234')
});
```Contributing
------------------------------------------------------------------------------I'm always happy to take on PRs. Here is how to get up and running:
## Installation ##
* `git clone https://github.com/mileszim/ember-particle` this repository
* `cd ember-particle`
* `yarn install`## Running ##
* `npm run lint:hbs`
* `npm run lint:js`
* `npm run lint:js -- --fix`### Running tests
* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions### Running the dummy application
* `ember serve`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/).
License
------------------------------------------------------------------------------This project is licensed under the [MIT License](LICENSE.md).