Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/riywo/irkit-api-server
Your own API server for your IRKit
https://github.com/riywo/irkit-api-server
Last synced: 3 months ago
JSON representation
Your own API server for your IRKit
- Host: GitHub
- URL: https://github.com/riywo/irkit-api-server
- Owner: riywo
- Created: 2015-01-03T23:11:03.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-07T13:56:29.000Z (over 7 years ago)
- Last Synced: 2024-04-14T15:22:47.843Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 148 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IRKit API Server
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
## Usage
### Create irkit.json
Before deploy to heroku, you must finish creating your `irkit.json` using `ruby-irkit` CLI. For example:````
$ gem install irkit
$ irkit --get tv_on
$ irkit --get tv_off
$ irkit --get airconditioner_off
$ irkit --device:add living
$ ls ~/.irkit.json
/Users/riywo/.irkit.json
````See also: https://github.com/shokai/ruby-irkit
### Upload irkit.json somewhere else
Then, upload the `.irkit.json` content to a web server publicly accessible. This contains some private infomation such as clientkey or deviceid, so private gist is a nice place to put it on. You will get a URL of raw file like `https://gist.githubusercontent.com/riywo/.../raw/.../irkit.json`. Or you can use Dropbox shared link.### Deploy and enjoy it!
Now you can deploy via Heroku deploy button. You have to set `IRKIT_DATA_FILE` as the URL you got above.After deployed, check `SECRET_TOKEN` in the configuration variables.
OK, let's play the api for you!
````
$ curl -X POST https://your-app-name.herokuapp.com/SECRET_TOKEN/api/living/tv_on
$ curl -X POST https://your-app-name.herokuapp.com/SECRET_TOKEN/api/living/tv_off,airconditioner_off
````