relax-rb 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/relax/bot.rb +19 -0
- data/lib/relax/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff47f4362c674afc22b14b7e13481edca67aa4a4
|
4
|
+
data.tar.gz: d5edac2197381f64d121189fcfcab8ccacd45221
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaedfbe980d52309972e7da5579820bab1f5d0cab33cea78c8afa6dd766ad23639de3788487ed6783781708768b27d4d8fd5f38a6e50dcf82dac5377fe80423c
|
7
|
+
data.tar.gz: 1ce477fb55b0de05e454a231d7d557de84c35c1e28bd9e94db92fb26f9e8a799051801ef7467e941c9c9a776c532dc4e94a117524c1856a1ed7e293fd10e8588
|
data/lib/relax/bot.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'securerandom'
|
2
|
+
|
1
3
|
module Relax
|
2
4
|
class BotsKeyNotSetError < StandardError; end
|
3
5
|
class BotsPubsubNotSetError < StandardError; end
|
@@ -20,6 +22,23 @@ module Relax
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
25
|
+
def self.start_typing!(team_uid, channel_uid)
|
26
|
+
if relax_bots_key.nil? || relax_bots_key == ""
|
27
|
+
raise BotsKeyNotSetError, "Environment Variable RELAX_BOTS_KEY is not set"
|
28
|
+
end
|
29
|
+
|
30
|
+
if relax_bots_pubsub.nil? || relax_bots_pubsub == ""
|
31
|
+
raise BotsPubsubNotSetError, "Environment Variable RELAX_BOTS_PUBSUB is not set"
|
32
|
+
end
|
33
|
+
|
34
|
+
message_id = SecureRandom.uuid
|
35
|
+
payload = { id: message_id, type: 'typing', channel: channel_uid }.to_json
|
36
|
+
|
37
|
+
redis.with do |conn|
|
38
|
+
conn.publish(relax_bots_pubsub, {type: 'message', team_id: team_uid, id: message_id, payload: payload}.to_json)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
23
42
|
def self.relax_bots_pubsub
|
24
43
|
ENV['RELAX_BOTS_PUBSUB']
|
25
44
|
end
|
data/lib/relax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relax-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arunthampi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|