relax-rb 0.3.0 → 0.4.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 +7 -2
- data/lib/relax/event.rb +2 -1
- 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: 4bc9b713e9e06a5888b8da463889f33358812967
|
4
|
+
data.tar.gz: 9a46aec07087aed617e420fd59f390160ac6a195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55282fee6279ac316d204f08ec5204f4d713d0449390c465931e1c1d60d393d39b56634d3fabe6869d6077619139085429757d13ee7636822efa68fbf9c6482c
|
7
|
+
data.tar.gz: 6d5514397d944454a6c9f2cbfb5ba0e5c1ffb93d87a61f7b837a5ae5efe31218d829dda136ccd65ead2a46ef44a67e71e41e125f098909505f3019e0388923bb
|
data/lib/relax/bot.rb
CHANGED
@@ -5,7 +5,7 @@ module Relax
|
|
5
5
|
class BotsPubsubNotSetError < StandardError; end
|
6
6
|
|
7
7
|
class Bot < Base
|
8
|
-
def self.start!(team_uid, token)
|
8
|
+
def self.start!(team_uid, token, opts = {})
|
9
9
|
if relax_bots_key.nil? || relax_bots_key == ""
|
10
10
|
raise BotsKeyNotSetError, "Environment Variable RELAX_BOTS_KEY is not set"
|
11
11
|
end
|
@@ -14,9 +14,14 @@ module Relax
|
|
14
14
|
raise BotsPubsubNotSetError, "Environment Variable RELAX_BOTS_PUBSUB is not set"
|
15
15
|
end
|
16
16
|
|
17
|
+
namespace = (opts[:namespace] || opts['namespace']).to_s.strip
|
18
|
+
hset_payload = {team_id: team_uid, token: token}
|
19
|
+
hset_payload.merge!(namespace: namespace) if namespace != ""
|
20
|
+
key = namespace == "" ? team_uid : "#{namespace}-#{team_uid}"
|
21
|
+
|
17
22
|
redis.with do |conn|
|
18
23
|
conn.multi do
|
19
|
-
conn.hset(relax_bots_key,
|
24
|
+
conn.hset(relax_bots_key, key, hset_payload.to_json)
|
20
25
|
conn.publish(relax_bots_pubsub, {type: 'team_added', team_id: team_uid}.to_json)
|
21
26
|
end
|
22
27
|
end
|
data/lib/relax/event.rb
CHANGED
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.4.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-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|