ruboty-slack_rtm 2.4.4 → 2.5.0

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
  SHA1:
3
- metadata.gz: f96f7f5edbd5031bd5861a1b67c3d54e8584e226
4
- data.tar.gz: b03a847402ff5d16362f25b6cde275c579ec8ca6
3
+ metadata.gz: ea4fa52fb8d644e498497a86b3f1775867348d72
4
+ data.tar.gz: aaae2b0b5086cb1be0154bc42945a1937d3859e6
5
5
  SHA512:
6
- metadata.gz: ce4dbf465479ca74a61010df7ad4b39380c68d460b7af076b4055942acfe3481e840b80a312e2318fc2afaf11392b904d42e4fab6a08153d924be7b9316fca51
7
- data.tar.gz: b3bc1e21d9312b8998d44034c9b3f7ad0cff865fd96ce9039190a7edd50ffaf3f8e49018dd3fc9c5bd4bbcf6fb90b03974b024d582d09b6d2cd17b87ea7bbe33
6
+ metadata.gz: d6894ffc5c32050fd0873c973e621cfbc07accb99c1e2f3e8f72b9824988a3e87ae3591a1f97894411461eaf541d12301be1b64131d4f26eabcf8dbc5d00d151
7
+ data.tar.gz: 94cd6b7d5f37525ef536db06cd93208198f47b74ef1e661a6b760de0eebc9c1d0f1b0bf457ff6812cb82b1a218dacc97360b87017e46bf665664919c37d9c4aa
@@ -16,6 +16,7 @@ module Ruboty
16
16
  init
17
17
  bind
18
18
  connect
19
+ # TODO: reconnect
19
20
  end
20
21
 
21
22
  def say(message)
@@ -4,6 +4,8 @@ require 'websocket-client-simple'
4
4
  module Ruboty
5
5
  module SlackRTM
6
6
  class Client
7
+ CONNECTION_CLOSED = Object.new
8
+
7
9
  def initialize(websocket_url:)
8
10
  @client = create_client(websocket_url.to_s)
9
11
 
@@ -36,6 +38,9 @@ module Ruboty
36
38
 
37
39
  loop do
38
40
  message = @queue.deq
41
+ if message.equal?(CONNECTION_CLOSED)
42
+ break
43
+ end
39
44
  @client.send(message)
40
45
  end
41
46
  end
@@ -47,6 +52,10 @@ module Ruboty
47
52
  client.on(:error) do |err|
48
53
  Ruboty.logger.error("#{err.class}: #{err.message}\n#{err.backtrace.join("\n")}")
49
54
  end
55
+ client.on(:close) do
56
+ Ruboty.logger.info('Disconnected')
57
+ @queue.enq(CONNECTION_CLOSED)
58
+ end
50
59
  end
51
60
  end
52
61
 
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackRTM
3
- VERSION = '2.4.4'
3
+ VERSION = '2.5.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-slack_rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,4 +137,3 @@ signing_key:
137
137
  specification_version: 4
138
138
  summary: Slack real time messaging adapter for Ruboty
139
139
  test_files: []
140
- has_rdoc: