Skip to content

Commit

Permalink
Add a vehicle_config method
Browse files Browse the repository at this point in the history
  • Loading branch information
timdorr committed Oct 4, 2019
1 parent c78212b commit ae9d329
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/tesla_api/vehicle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def vehicle_state
data_request('vehicle_state')['response']
end

def vehicle_config
data_request('vehicle_config')['response']
end

# Commands

def wake_up
Expand Down
108 changes: 108 additions & 0 deletions spec/cassettes/vehicle-vehicle_config.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions spec/lib/tesla_api/vehicle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
it { should include('display_name') }
it { should include('drive_state') }
it { should include('vehicle_state') }
it { should include('vehicle_config') }
it { should include('charge_state') }
end
end
Expand Down Expand Up @@ -104,6 +105,18 @@
end
end

describe '#vehicle_config', vcr: {cassette_name: 'vehicle-vehicle_config'} do
context 'data about the vehicle\'s overall state' do
subject { vehicle.vehicle_config }

it { should include('exterior_color') }
it { should include('wheel_type') }
it { should include('has_air_suspension') }
it { should include('car_type') }
it { should include('timestamp') }
end
end

describe '#wake_up', vcr: {cassette_name: 'vehicle-wake_up'} do
it 'wakes up the car from sleep mode' do
vehicle.wake_up
Expand Down

0 comments on commit ae9d329

Please sign in to comment.