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 +4 -4
- data/lib/ruboty/adapters/slack_rtm.rb +1 -0
- data/lib/ruboty/slack_rtm/client.rb +9 -0
- data/lib/ruboty/slack_rtm/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea4fa52fb8d644e498497a86b3f1775867348d72
|
4
|
+
data.tar.gz: aaae2b0b5086cb1be0154bc42945a1937d3859e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6894ffc5c32050fd0873c973e621cfbc07accb99c1e2f3e8f72b9824988a3e87ae3591a1f97894411461eaf541d12301be1b64131d4f26eabcf8dbc5d00d151
|
7
|
+
data.tar.gz: 94cd6b7d5f37525ef536db06cd93208198f47b74ef1e661a6b760de0eebc9c1d0f1b0bf457ff6812cb82b1a218dacc97360b87017e46bf665664919c37d9c4aa
|
@@ -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
|
|
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
|
+
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-
|
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:
|