tesla_api 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://owner-api.teslamotors.com/api/1/vehicles
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - github.com/timdorr/tesla-api v:3.0.1
12
+ Authorization:
13
+ - Bearer <TESLA_ACCESS_TOKEN>
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Thu, 03 Oct 2019 12:07:05 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '569'
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ X-Xss-Protection:
37
+ - 1; mode=block
38
+ X-Content-Type-Options:
39
+ - nosniff
40
+ X-Txid:
41
+ - 796921f5a214dd0e5ffef9a7c098732e
42
+ Etag:
43
+ - W/"fee0c127f31e354aae63ac0325c6cce4"
44
+ Cache-Control:
45
+ - max-age=0, private, must-revalidate
46
+ X-Request-Id:
47
+ - 6dce7691-3341-49e9-9336-f643b343ba6c
48
+ X-Runtime:
49
+ - '0.024369'
50
+ body:
51
+ encoding: UTF-8
52
+ string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","option_codes":"AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0","color":null,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
53
+ http_version:
54
+ recorded_at: Thu, 03 Oct 2019 12:07:05 GMT
55
+ - request:
56
+ method: post
57
+ uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_volume_down
58
+ body:
59
+ encoding: UTF-8
60
+ string: ''
61
+ headers:
62
+ User-Agent:
63
+ - github.com/timdorr/tesla-api v:3.0.1
64
+ Authorization:
65
+ - Bearer <TESLA_ACCESS_TOKEN>
66
+ Content-Length:
67
+ - '0'
68
+ Accept-Encoding:
69
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
70
+ Accept:
71
+ - "*/*"
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ Server:
78
+ - nginx
79
+ Date:
80
+ - Thu, 03 Oct 2019 12:07:06 GMT
81
+ Content-Type:
82
+ - application/json; charset=utf-8
83
+ Content-Length:
84
+ - '40'
85
+ Connection:
86
+ - keep-alive
87
+ X-Frame-Options:
88
+ - SAMEORIGIN
89
+ - SAMEORIGIN
90
+ X-Xss-Protection:
91
+ - 1; mode=block
92
+ X-Content-Type-Options:
93
+ - nosniff
94
+ X-Txid:
95
+ - 7d39d164b7236420df18cd8f493f3aa9
96
+ Etag:
97
+ - W/"f67eec105dd6522783a1f1bacc52723a"
98
+ Cache-Control:
99
+ - max-age=0, private, must-revalidate
100
+ X-Request-Id:
101
+ - 54ca8542-89ef-491a-b936-a21347a0a69e
102
+ X-Runtime:
103
+ - '0.427457'
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"response":{"reason":"","result":true}}'
107
+ http_version:
108
+ recorded_at: Thu, 03 Oct 2019 12:07:07 GMT
109
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,109 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://owner-api.teslamotors.com/api/1/vehicles
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - github.com/timdorr/tesla-api v:3.0.1
12
+ Authorization:
13
+ - Bearer <TESLA_ACCESS_TOKEN>
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Thu, 03 Oct 2019 12:07:09 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '569'
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ X-Xss-Protection:
37
+ - 1; mode=block
38
+ X-Content-Type-Options:
39
+ - nosniff
40
+ X-Txid:
41
+ - 0bdb6b5922a2eb417845f8cc734b9575
42
+ Etag:
43
+ - W/"fee0c127f31e354aae63ac0325c6cce4"
44
+ Cache-Control:
45
+ - max-age=0, private, must-revalidate
46
+ X-Request-Id:
47
+ - 644429de-81cd-4254-a568-368fa64ac962
48
+ X-Runtime:
49
+ - '0.023907'
50
+ body:
51
+ encoding: UTF-8
52
+ string: '{"response":[{"id":1,"vehicle_id":1,"vin":"1","display_name":"tm3","option_codes":"AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0","color":null,"tokens":["1","1"],"state":"online","in_service":false,"id_s":"1","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
53
+ http_version:
54
+ recorded_at: Thu, 03 Oct 2019 12:07:09 GMT
55
+ - request:
56
+ method: post
57
+ uri: https://owner-api.teslamotors.com/api/1/vehicles/1/command/media_volume_up
58
+ body:
59
+ encoding: UTF-8
60
+ string: ''
61
+ headers:
62
+ User-Agent:
63
+ - github.com/timdorr/tesla-api v:3.0.1
64
+ Authorization:
65
+ - Bearer <TESLA_ACCESS_TOKEN>
66
+ Content-Length:
67
+ - '0'
68
+ Accept-Encoding:
69
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
70
+ Accept:
71
+ - "*/*"
72
+ response:
73
+ status:
74
+ code: 200
75
+ message: OK
76
+ headers:
77
+ Server:
78
+ - nginx
79
+ Date:
80
+ - Thu, 03 Oct 2019 12:07:10 GMT
81
+ Content-Type:
82
+ - application/json; charset=utf-8
83
+ Content-Length:
84
+ - '40'
85
+ Connection:
86
+ - keep-alive
87
+ X-Frame-Options:
88
+ - SAMEORIGIN
89
+ - SAMEORIGIN
90
+ X-Xss-Protection:
91
+ - 1; mode=block
92
+ X-Content-Type-Options:
93
+ - nosniff
94
+ X-Txid:
95
+ - e755be3a3feafe691897ee6a73d76776
96
+ Etag:
97
+ - W/"f67eec105dd6522783a1f1bacc52723a"
98
+ Cache-Control:
99
+ - max-age=0, private, must-revalidate
100
+ X-Request-Id:
101
+ - 1816dbf7-4dec-4914-bc70-2eed155517da
102
+ X-Runtime:
103
+ - '0.339461'
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"response":{"reason":"","result":true}}'
107
+ http_version:
108
+ recorded_at: Thu, 03 Oct 2019 12:07:10 GMT
109
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,108 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://owner-api.teslamotors.com/api/1/vehicles
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - github.com/timdorr/tesla-api v:3.0.1
12
+ Authorization:
13
+ - Bearer <TESLA_ACCESS_TOKEN>
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Fri, 04 Oct 2019 18:43:37 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '569'
31
+ Connection:
32
+ - keep-alive
33
+ X-Frame-Options:
34
+ - SAMEORIGIN
35
+ - SAMEORIGIN
36
+ X-Xss-Protection:
37
+ - 1; mode=block
38
+ X-Content-Type-Options:
39
+ - nosniff
40
+ X-Txid:
41
+ - ee7eb2a310951d5233614c26c511bf48
42
+ Etag:
43
+ - W/"c1c1ac03906b1b753f519905aa9afe41"
44
+ Cache-Control:
45
+ - max-age=0, private, must-revalidate
46
+ X-Request-Id:
47
+ - c0d6ac7d-91a5-426e-b1cb-d9403b888e52
48
+ X-Runtime:
49
+ - '0.030921'
50
+ body:
51
+ encoding: UTF-8
52
+ string: '{"response":[{"id":26640707449551857,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola
53
+ 2.0","option_codes":"AD15,MDL3,PBSB,RENA,BT37,ID3W,RF3G,S3PB,DRLH,DV2W,W39B,APF0,COUS,BC3B,CH07,PC30,FC3P,FG31,GLFR,HL31,HM31,IL31,LTPB,MR31,FM3B,RS3H,SA3P,STCP,SC04,SU3C,T3CA,TW00,TM00,UT3P,WR00,AU3P,APH3,AF00,ZCST,MI00,CDM0","color":null,"tokens":["db33b4d51c05cad8","cb2c4a4304d797fe"],"state":"online","in_service":false,"id_s":"26640707449551857","calendar_enabled":true,"api_version":6,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
54
+ http_version:
55
+ recorded_at: Fri, 04 Oct 2019 18:43:37 GMT
56
+ - request:
57
+ method: get
58
+ uri: https://owner-api.teslamotors.com/api/1/vehicles/26640707449551857/data_request/vehicle_config
59
+ body:
60
+ encoding: US-ASCII
61
+ string: ''
62
+ headers:
63
+ User-Agent:
64
+ - github.com/timdorr/tesla-api v:3.0.1
65
+ Authorization:
66
+ - Bearer <TESLA_ACCESS_TOKEN>
67
+ Accept-Encoding:
68
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
69
+ Accept:
70
+ - "*/*"
71
+ response:
72
+ status:
73
+ code: 200
74
+ message: OK
75
+ headers:
76
+ Server:
77
+ - nginx
78
+ Date:
79
+ - Fri, 04 Oct 2019 18:43:40 GMT
80
+ Content-Type:
81
+ - application/json; charset=utf-8
82
+ Content-Length:
83
+ - '546'
84
+ Connection:
85
+ - keep-alive
86
+ X-Frame-Options:
87
+ - SAMEORIGIN
88
+ - SAMEORIGIN
89
+ X-Xss-Protection:
90
+ - 1; mode=block
91
+ X-Content-Type-Options:
92
+ - nosniff
93
+ X-Txid:
94
+ - 643a147148ac6a15b224e5bcb3fb932c
95
+ Etag:
96
+ - W/"88b28a01a971376d0cf561987d6c8a61"
97
+ Cache-Control:
98
+ - max-age=0, private, must-revalidate
99
+ X-Request-Id:
100
+ - 6ce094c9-81a8-4227-bb4f-8244e8df49ae
101
+ X-Runtime:
102
+ - '1.870441'
103
+ body:
104
+ encoding: UTF-8
105
+ string: '{"response":{"can_accept_navigation_requests":true,"can_actuate_trunks":true,"car_special_type":"base","car_type":"models2","charge_port_type":"US","eu_vehicle":false,"exterior_color":"White","has_air_suspension":true,"has_ludicrous_mode":false,"motorized_charge_port":true,"plg":true,"rear_seat_heaters":0,"rear_seat_type":0,"rhd":false,"roof_color":"None","seat_type":2,"spoiler_type":"None","sun_roof_installed":2,"third_row_seats":"None","timestamp":1570214620099,"trim_badging":"p90d","use_range_badging":false,"wheel_type":"AeroTurbine19"}}'
106
+ http_version:
107
+ recorded_at: Fri, 04 Oct 2019 18:43:40 GMT
108
+ recorded_with: VCR 5.0.0
@@ -28,6 +28,7 @@ RSpec.describe TeslaApi::Vehicle do
28
28
  it { should include('display_name') }
29
29
  it { should include('drive_state') }
30
30
  it { should include('vehicle_state') }
31
+ it { should include('vehicle_config') }
31
32
  it { should include('charge_state') }
32
33
  end
33
34
  end
@@ -104,6 +105,18 @@ RSpec.describe TeslaApi::Vehicle do
104
105
  end
105
106
  end
106
107
 
108
+ describe '#vehicle_config', vcr: {cassette_name: 'vehicle-vehicle_config'} do
109
+ context 'data about the vehicle\'s overall state' do
110
+ subject { vehicle.vehicle_config }
111
+
112
+ it { should include('exterior_color') }
113
+ it { should include('wheel_type') }
114
+ it { should include('has_air_suspension') }
115
+ it { should include('car_type') }
116
+ it { should include('timestamp') }
117
+ end
118
+ end
119
+
107
120
  describe '#wake_up', vcr: {cassette_name: 'vehicle-wake_up'} do
108
121
  it 'wakes up the car from sleep mode' do
109
122
  vehicle.wake_up
@@ -331,4 +344,48 @@ RSpec.describe TeslaApi::Vehicle do
331
344
  expect(vehicle.set_sentry_mode(false)['result']).to eq(true)
332
345
  end
333
346
  end
347
+
348
+ context '#media' do
349
+ describe '#media_toggle_playback', vcr: {cassette_name: 'vehicle-media_toggle_playback'} do
350
+ it 'toggles media from playing and paused' do
351
+ expect(vehicle.media_toggle_playback['result']).to eq(true)
352
+ end
353
+ end
354
+
355
+ describe '#media_next_track', vcr: {cassette_name: 'vehicle-media_next_track'} do
356
+ it 'plays the next track in playlist' do
357
+ expect(vehicle.media_next_track['result']).to eq(true)
358
+ end
359
+ end
360
+
361
+ describe '#media_prev_track', vcr: {cassette_name: 'vehicle-media_prev_track'} do
362
+ it 'plays the previous track in playlist' do
363
+ expect(vehicle.media_prev_track['result']).to eq(true)
364
+ end
365
+ end
366
+
367
+ describe '#media_next_fav', vcr: {cassette_name: 'vehicle-media_next_fav'} do
368
+ it 'plays the next favourite track' do
369
+ expect(vehicle.media_next_fav['result']).to eq(true)
370
+ end
371
+ end
372
+
373
+ describe '#media_prev_fav', vcr: {cassette_name: 'vehicle-media_prev_fav'} do
374
+ it 'plays the previous favourite track' do
375
+ expect(vehicle.media_prev_fav['result']).to eq(true)
376
+ end
377
+ end
378
+
379
+ describe '#media_volume_up', vcr: {cassette_name: 'vehicle-media_volume_up'} do
380
+ it 'increases volume of media' do
381
+ expect(vehicle.media_volume_up['result']).to eq(true)
382
+ end
383
+ end
384
+
385
+ describe '#media_volume_down', vcr: {cassette_name: 'vehicle-media_volume_down'} do
386
+ it 'decreases volume of media' do
387
+ expect(vehicle.media_volume_down['result']).to eq(true)
388
+ end
389
+ end
390
+ end
334
391
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tesla_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Dorr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-25 00:00:00.000000000 Z
11
+ date: 2019-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -167,16 +167,18 @@ files:
167
167
  - docs/vehicle/commands/charging.md
168
168
  - docs/vehicle/commands/climate.md
169
169
  - docs/vehicle/commands/doors.md
170
+ - docs/vehicle/commands/homelink.md
170
171
  - docs/vehicle/commands/media.md
171
- - docs/vehicle/commands/navigation.md
172
172
  - docs/vehicle/commands/remotestart.md
173
173
  - docs/vehicle/commands/sentrymode.md
174
+ - docs/vehicle/commands/sharing.md
174
175
  - docs/vehicle/commands/softwareupdate.md
175
176
  - docs/vehicle/commands/speedlimit.md
176
177
  - docs/vehicle/commands/sunroof.md
177
178
  - docs/vehicle/commands/trunk.md
178
179
  - docs/vehicle/commands/valet.md
179
180
  - docs/vehicle/commands/wake.md
181
+ - docs/vehicle/commands/windows.md
180
182
  - docs/vehicle/optioncodes.md
181
183
  - docs/vehicle/state/README.md
182
184
  - docs/vehicle/state/chargestate.md
@@ -221,6 +223,13 @@ files:
221
223
  - spec/cassettes/vehicle-flash_lights.yml
222
224
  - spec/cassettes/vehicle-gui_settings.yml
223
225
  - spec/cassettes/vehicle-honk_horn.yml
226
+ - spec/cassettes/vehicle-media_next_fav.yml
227
+ - spec/cassettes/vehicle-media_next_track.yml
228
+ - spec/cassettes/vehicle-media_prev_fav.yml
229
+ - spec/cassettes/vehicle-media_prev_track.yml
230
+ - spec/cassettes/vehicle-media_toggle_playback.yml
231
+ - spec/cassettes/vehicle-media_volume_down.yml
232
+ - spec/cassettes/vehicle-media_volume_up.yml
224
233
  - spec/cassettes/vehicle-mobile_enabled.yml
225
234
  - spec/cassettes/vehicle-navigation_request.yml
226
235
  - spec/cassettes/vehicle-nearby_charging_sites.yml
@@ -242,6 +251,7 @@ files:
242
251
  - spec/cassettes/vehicle-steering_wheel_heater_request.yml
243
252
  - spec/cassettes/vehicle-sun_roof_control-close.yml
244
253
  - spec/cassettes/vehicle-sun_roof_control-vent.yml
254
+ - spec/cassettes/vehicle-vehicle_config.yml
245
255
  - spec/cassettes/vehicle-vehicle_state.yml
246
256
  - spec/cassettes/vehicle-wake_up.yml
247
257
  - spec/cassettes/vehicle.yml
@@ -299,6 +309,13 @@ test_files:
299
309
  - spec/cassettes/vehicle-flash_lights.yml
300
310
  - spec/cassettes/vehicle-gui_settings.yml
301
311
  - spec/cassettes/vehicle-honk_horn.yml
312
+ - spec/cassettes/vehicle-media_next_fav.yml
313
+ - spec/cassettes/vehicle-media_next_track.yml
314
+ - spec/cassettes/vehicle-media_prev_fav.yml
315
+ - spec/cassettes/vehicle-media_prev_track.yml
316
+ - spec/cassettes/vehicle-media_toggle_playback.yml
317
+ - spec/cassettes/vehicle-media_volume_down.yml
318
+ - spec/cassettes/vehicle-media_volume_up.yml
302
319
  - spec/cassettes/vehicle-mobile_enabled.yml
303
320
  - spec/cassettes/vehicle-navigation_request.yml
304
321
  - spec/cassettes/vehicle-nearby_charging_sites.yml
@@ -320,6 +337,7 @@ test_files:
320
337
  - spec/cassettes/vehicle-steering_wheel_heater_request.yml
321
338
  - spec/cassettes/vehicle-sun_roof_control-close.yml
322
339
  - spec/cassettes/vehicle-sun_roof_control-vent.yml
340
+ - spec/cassettes/vehicle-vehicle_config.yml
323
341
  - spec/cassettes/vehicle-vehicle_state.yml
324
342
  - spec/cassettes/vehicle-wake_up.yml
325
343
  - spec/cassettes/vehicle.yml