tesla_api 3.0.5 → 3.0.6

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: 321a3deb2934f51a38bc1f3d427ceb123ebe2b8af3f5c7bba6453d66aedf40ab
4
- data.tar.gz: a751ba87102749678d1ceb57e711050a19556344399c8da01adb06342c421802
3
+ metadata.gz: 3006f2782cd9fae5deaeaeb96bc24316adb52f890ceb7a9222f48cc15e55cf71
4
+ data.tar.gz: 108132c98dbb6c7abe62c7437ebafec58238f447238cc2f71da2b8c6eb387f7a
5
5
  SHA512:
6
- metadata.gz: 134fc9efde3baf7d3d9b07d1bfe94f984a5c74799cd1c391f4df6bef6f718494da715b72a465d8e767dc04d15e5b49f659f4ecbb347bc52bebca69963b29d809
7
- data.tar.gz: 2422bbf4044c8887d89f3d30a79cebf8e01eff9f0c9e544e87ac07bb1f9edd84b69b2f8b0916963347460436db8064a99dfe9299e259856b221b68fde3e100e4
6
+ metadata.gz: 2f4ab21d5dd77265da3d0dd10d89a775b75dfd0807495616012a2e25049f7f046ef898d80c4b8f108d9d9f03b0e90205ce566d80f3d7d4c7284eada298e031b5
7
+ data.tar.gz: 0ec939e1e12db9103fa76fb4f9fadbcd6cf3c84d17dd2a7480d5d9b42ed91e68cad822953cfe2203fe6fca8424143871bde001d59284edae4342f714cd4788bd
@@ -1,8 +1,16 @@
1
1
  module TeslaApi
2
2
  module Stream
3
- def stream(&receiver)
3
+ def self.streaming_endpoint_url
4
+ 'wss://streaming.vn.teslamotors.com/streaming/'
5
+ end
6
+
7
+ def self.streaming_endpoint
8
+ Async::HTTP::Endpoint.parse(streaming_endpoint_url, alpn_protocols: Async::HTTP::Protocol::HTTP11.names)
9
+ end
10
+
11
+ def stream(endpoint: Stream.streaming_endpoint, &receiver)
4
12
  Async do |task|
5
- Async::WebSocket::Client.connect(streaming_endpoint) do |connection|
13
+ Async::WebSocket::Client.connect(endpoint) do |connection|
6
14
  on_timeout = ->(subtask) do
7
15
  subtask.sleep TIMEOUT
8
16
  task.stop
@@ -46,14 +54,6 @@ module TeslaApi
46
54
 
47
55
  TIMEOUT = 30
48
56
 
49
- def streaming_endpoint
50
- Async::HTTP::Endpoint.parse(streaming_endpoint_url)
51
- end
52
-
53
- def streaming_endpoint_url
54
- 'wss://streaming.vn.teslamotors.com/streaming/'
55
- end
56
-
57
57
  def streaming_connect_message
58
58
  {
59
59
  msg_type: 'data:subscribe',
@@ -1,3 +1,3 @@
1
1
  module TeslaApi
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6'
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.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Dorr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-websocket