API for interacting with Smartcar status and functions
- Ruby version 2.3.4 or higher
- Download project repo:
git clone https://www.github.com/kamillamagna/smartcar
- Install dependencies:
bundle install
- Start server:
ruby app.rb
Install and bundle (steps 1 and 2 above), then run:
ruby tests/test.rb
Returns information about vehicle, including VIN (vehicle identification number), color, number of doors, and drivetrain See vehicles/info.rb module for expected response schema
GET /vehicles/:id
Returns status of doors (locked/unlocked) See vehicles/security.rb module for expected response schema
GET /vehicles/:id/security
Returns percentage of tank remaining or -1 if vehicle is all-electric See vehicles/energy.rb module for expected response schema
GET /vehicles/:id/fuel
Returns percentage of battery remaining or -1 if vehicle is gas-powered See vehicles/energy.rb module for expected response schema
GET /vehicles/:id/battery
Starts/stops engine with START or STOP argument See vehicles/engine.rb module for expected response schema
POST /vehicles/:id/engine
Content-Type: application/json
{
"action": "START|STOP"
}