https://github.com/riywo/irkit-api-server
Your own API server for your IRKit
https://github.com/riywo/irkit-api-server
Last synced: over 1 year 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 (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-10-07T13:56:29.000Z (almost 9 years ago)
- Last Synced: 2025-03-30T09:11:36.820Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 148 KB
- Stars: 16
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# IRKit API Server
[](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
````