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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36800b87fde594b317de4423717ddddde20b02a89a29dcc3030da421c857961d
4
- data.tar.gz: a7578ddecc3e79faaf4b91eec431196fdd42cc6b2697d8a47c115a9839beb13d
3
+ metadata.gz: dc39a9565be19773d6cb2e07f625fc6f6d1a7472ba4dbc7d77da49b01d8daff7
4
+ data.tar.gz: 2cb34e0686652e67aa6ed566714723206c184f330be632dd484300b618d51e52
5
5
  SHA512:
6
- metadata.gz: 4cefac51f88134ddb5cf93567046c63249c48aac76c19ea95006f7a8f98e97ad2258c1d4969be3cedc3dd8e3ec8ad21513cc1b29913982f11b2263ca44e2bc2e
7
- data.tar.gz: 3724b8215a83bd514ab27ddc02165793052f54dfb1bfc45cfe3f90c18fd50395dcedadd4e7070c3469d2f5557fb3354c02e97a3850e33c2d1ed8c397b4e8cef9
6
+ metadata.gz: ff4c6fe5947a94979fba783e275870fe8fe4e55aa8525f4d8b1e8cd841bc7c4012be098b3bef66152103122fcb1c11ef7556ad0409e5183fa7dd5a07854647b3
7
+ data.tar.gz: ab9903e449f7bcdfc8afca85fa6bfba69fccdb5b27e3a10c16ceae08633ed5c799df8ab04af7b4b99f0969ba81d2d7cd1e67a81787d3f9bb0c3244fda1c0e70c
@@ -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(endpoint, headers: headers) do |connection|
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 endpoint
25
- Async::HTTP::Endpoint.parse(autopark_socket_endpoint)
24
+ def autopark_endpoint
25
+ Async::HTTP::Endpoint.parse(autopark_endpoint_url)
26
26
  end
27
27
 
28
- def autopark_socket_endpoint
28
+ def autopark_endpoint_url
29
29
  "wss://streaming.vn.teslamotors.com/connect/#{self['vehicle_id']}"
30
30
  end
31
31
 
32
- def headers
32
+ def autopark_headers
33
33
  {
34
34
  'Authorization' => "Basic #{socket_auth}"
35
35
  }
36
36
  end
37
37
 
38
- def socket_auth
38
+ def autopark_socket_auth
39
39
  Base64.strict_encode64("#{email}:#{self['tokens'].first}")
40
40
  end
41
41
  end
@@ -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(endpoint) do |connection|
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(stream_connect_message)
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 endpoint
50
- Async::HTTP::Endpoint.parse(streaming_endpoint)
49
+ def streaming_endpoint
50
+ Async::HTTP::Endpoint.parse(streaming_endpoint_url)
51
51
  end
52
52
 
53
- def streaming_endpoint
53
+ def streaming_endpoint_url
54
54
  'wss://streaming.vn.teslamotors.com/streaming/'
55
55
  end
56
56
 
57
- def stream_connect_message
57
+ def streaming_connect_message
58
58
  {
59
59
  msg_type: 'data:subscribe',
60
60
  token: Base64.strict_encode64("#{email}:#{self['tokens'].first}"),
@@ -1,3 +1,3 @@
1
1
  module TeslaApi
2
- VERSION = '3.0.3'
2
+ VERSION = '3.0.4'
3
3
  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.3
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 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-websocket