Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/makevoid/comma_api_rb
Query the Comma and Athena (device) API via Ruby - status: WIP - #api-client #openpilot
https://github.com/makevoid/comma_api_rb
api api-client comma-api openpilot ruby
Last synced: about 10 hours ago
JSON representation
Query the Comma and Athena (device) API via Ruby - status: WIP - #api-client #openpilot
- Host: GitHub
- URL: https://github.com/makevoid/comma_api_rb
- Owner: makevoid
- Created: 2019-08-11T23:59:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-18T18:29:57.000Z (over 1 year ago)
- Last Synced: 2024-09-08T13:40:25.103Z (17 days ago)
- Topics: api, api-client, comma-api, openpilot, ruby
- Language: Ruby
- Homepage:
- Size: 178 KB
- Stars: 0
- Watchers: 3
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# comma-api-rb
Unofficial API Client for the Comma API (api.comma.ai)
### Install Gem // Configure Gem Bundle
Install Gem: `gem i comma-api-rb`
Require it (`require "comma-api-rb"`)
---
Use Bundler:
```rb
gem "comma-api-rb", require: "comma-api-rb"
```suggestion: use `Bundler.require :default #, :production, :dev...` to automatically require the comma api gem
### Configuration
Set the `COMMA_JWT_TOKEN` environment variable with your Comma API JWT token
```
COMMA_JWT_TOKEN=...
```### Usage
#### Comma API
```rb
me = CommaAPI.me()
puts("me:", me) #=> {"email":"[email protected]","id":"12345....","points":2708,"prime":null,"regdate":1563123456,"superuser":false,"upload_video":false,"username":"antani12345"}
```#### Athena API
Your EON needs to be on for these calls to work
```rb
state = AthenaAPI.carState()
puts("carState:", carState) #=> { ... }
## access carState as hash/dict
# carstate = state["carState"]
# wheelSpeedRL = carstate["wheelSpeeds"]["rl"]
# steeringTorque = carstate["steeringTorque"]
# steeringAngle = carstate["steeringAngle"]
# brake = data.carState["brake"]
# # puts wheelSpeedRL# soon: access carstate via methods (getters, call without `()`, optional)
state = AthenaAPI.carState.speed()
state = AthenaAPI.carState.brake()
state = AthenaAPI.carState.steering.angle()
state = AthenaAPI.carState.steering.torque()
#
```See more in the examples contained in the `example` (duh) dir.
enjoy :)
---
Have fun with OP!
@makevoid