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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff47f4362c674afc22b14b7e13481edca67aa4a4
4
- data.tar.gz: d5edac2197381f64d121189fcfcab8ccacd45221
3
+ metadata.gz: 4bc9b713e9e06a5888b8da463889f33358812967
4
+ data.tar.gz: 9a46aec07087aed617e420fd59f390160ac6a195
5
5
  SHA512:
6
- metadata.gz: eaedfbe980d52309972e7da5579820bab1f5d0cab33cea78c8afa6dd766ad23639de3788487ed6783781708768b27d4d8fd5f38a6e50dcf82dac5377fe80423c
7
- data.tar.gz: 1ce477fb55b0de05e454a231d7d557de84c35c1e28bd9e94db92fb26f9e8a799051801ef7467e941c9c9a776c532dc4e94a117524c1856a1ed7e293fd10e8588
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, team_uid, {team_id: team_uid, token: token}.to_json)
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
@@ -1,7 +1,8 @@
1
1
  module Relax
2
2
  class Event
3
3
  ATTRIBUTES = [:type, :user_uid, :channel_uid, :team_uid, :im, :text,
4
- :relax_bot_uid, :timestamp, :provider, :event_timestamp]
4
+ :relax_bot_uid, :timestamp, :provider, :event_timestamp,
5
+ :namespace]
5
6
 
6
7
  attr_accessor *ATTRIBUTES
7
8
 
data/lib/relax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Relax
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-03-01 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis