tesla_api 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tesla_api/autopark.rb +6 -6
- data/lib/tesla_api/stream.rb +6 -6
- data/lib/tesla_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc39a9565be19773d6cb2e07f625fc6f6d1a7472ba4dbc7d77da49b01d8daff7
|
4
|
+
data.tar.gz: 2cb34e0686652e67aa6ed566714723206c184f330be632dd484300b618d51e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4c6fe5947a94979fba783e275870fe8fe4e55aa8525f4d8b1e8cd841bc7c4012be098b3bef66152103122fcb1c11ef7556ad0409e5183fa7dd5a07854647b3
|
7
|
+
data.tar.gz: ab9903e449f7bcdfc8afca85fa6bfba69fccdb5b27e3a10c16ceae08633ed5c799df8ab04af7b4b99f0969ba81d2d7cd1e67a81787d3f9bb0c3244fda1c0e70c
|
data/lib/tesla_api/autopark.rb
CHANGED
@@ -2,7 +2,7 @@ module TeslaApi
|
|
2
2
|
module Autopark
|
3
3
|
def start_autopark(&handler)
|
4
4
|
Async do |task|
|
5
|
-
Async::WebSocket::Client.connect(
|
5
|
+
Async::WebSocket::Client.connect(autopark_endpoint, headers: headers) do |connection|
|
6
6
|
while message = connection.read
|
7
7
|
case message[:msg_type]
|
8
8
|
when 'control:hello'
|
@@ -21,21 +21,21 @@ module TeslaApi
|
|
21
21
|
|
22
22
|
private
|
23
23
|
|
24
|
-
def
|
25
|
-
Async::HTTP::Endpoint.parse(
|
24
|
+
def autopark_endpoint
|
25
|
+
Async::HTTP::Endpoint.parse(autopark_endpoint_url)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def autopark_endpoint_url
|
29
29
|
"wss://streaming.vn.teslamotors.com/connect/#{self['vehicle_id']}"
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def autopark_headers
|
33
33
|
{
|
34
34
|
'Authorization' => "Basic #{socket_auth}"
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def autopark_socket_auth
|
39
39
|
Base64.strict_encode64("#{email}:#{self['tokens'].first}")
|
40
40
|
end
|
41
41
|
end
|
data/lib/tesla_api/stream.rb
CHANGED
@@ -2,13 +2,13 @@ module TeslaApi
|
|
2
2
|
module Stream
|
3
3
|
def stream(&receiver)
|
4
4
|
Async do |task|
|
5
|
-
Async::WebSocket::Client.connect(
|
5
|
+
Async::WebSocket::Client.connect(streaming_endpoint) do |connection|
|
6
6
|
on_timeout = ->(subtask) do
|
7
7
|
subtask.sleep TIMEOUT
|
8
8
|
task.stop
|
9
9
|
end
|
10
10
|
|
11
|
-
connection.write(
|
11
|
+
connection.write(streaming_connect_message)
|
12
12
|
timeout = task.async(&on_timeout)
|
13
13
|
|
14
14
|
while message = connection.read
|
@@ -46,15 +46,15 @@ module TeslaApi
|
|
46
46
|
|
47
47
|
TIMEOUT = 30
|
48
48
|
|
49
|
-
def
|
50
|
-
Async::HTTP::Endpoint.parse(
|
49
|
+
def streaming_endpoint
|
50
|
+
Async::HTTP::Endpoint.parse(streaming_endpoint_url)
|
51
51
|
end
|
52
52
|
|
53
|
-
def
|
53
|
+
def streaming_endpoint_url
|
54
54
|
'wss://streaming.vn.teslamotors.com/streaming/'
|
55
55
|
end
|
56
56
|
|
57
|
-
def
|
57
|
+
def streaming_connect_message
|
58
58
|
{
|
59
59
|
msg_type: 'data:subscribe',
|
60
60
|
token: Base64.strict_encode64("#{email}:#{self['tokens'].first}"),
|
data/lib/tesla_api/version.rb
CHANGED
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.
|
4
|
+
version: 3.0.4
|
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-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-websocket
|