lita-slack 1.0.3 → 1.0.4

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: edbc8dcdee46b8b2abbe6d6fcbd85e6610598726
4
- data.tar.gz: 6763ecbdf98d5fbdaf0d904d4252702f1c3b236f
3
+ metadata.gz: 94fa7740895d09a183b18621b296e01c0b9bf4ba
4
+ data.tar.gz: 8d092bb60ea02b23c43f53551e6ca691d5654d00
5
5
  SHA512:
6
- metadata.gz: 78c015357fa487c0ff844a8438934b9a9fa729f02c66a04182734007030b449dab63cbb09e5d9fc4cd47c89ee7473258005b4d39e27b675b72b8432b35d30c0d
7
- data.tar.gz: af1dd3ecb8fc8fb3a585a6ba060c8d235d4e3a662d7af77f6c0cd2ece4773237010200dc1dc6b46af61261c81ae18555da1f603ace5c69340dcd5988fd743c95
6
+ metadata.gz: 9478684ba8c9c77579c3224559cff79b49a7fcf2f30c361997d2e1d53ee777269e6da9bcd0b542fac591a1b7ed20ce27a708ad25db19675bd7ca51367c83cb2b
7
+ data.tar.gz: 1746b869ac92e8a99d3cc8bcad47ea21707625b28dbc6607d6b8684d023e118eb8ec6cc06ed89082607ebf428a18de6bc3055da3eb32c1a59d062560d9650a42
data/README.md CHANGED
@@ -18,15 +18,24 @@ gem "lita-slack"
18
18
 
19
19
  **Note**: When using lita-slack, the adapter will overwrite the bot's name and mention name with the values set on the server, so `config.robot.name` and `config.robot.mention_name` will have no effect.
20
20
 
21
+ ### config.robot.admins
22
+
23
+ Each Slack user has a unique ID that never changes even if their real name or username changes. To populate the `config.robot.admins` attribute, you'll need to use these IDs for each user you want to mark as an administrator. If you're using Lita version 4.1 or greater, you can get a user's ID by sending Lita the command `users find NICKNAME_OF_USER`.
24
+
21
25
  ### Example
22
26
 
23
27
  ``` ruby
24
28
  Lita.configure do |config|
25
29
  config.robot.adapter = :slack
30
+ config.robot.admins = ["U012A3BCD"]
26
31
  config.adapters.slack.token = "abcd-1234567890-hWYd21AmMH2UHAkx29vb5c1Y"
27
32
  end
28
33
  ```
29
34
 
35
+ ## Joining rooms
36
+
37
+ Lita will join your default channel after initial setup. To have it join additional channels or private groups, simply invite it to them via your Slack client as you would any normal user.
38
+
30
39
  ## Events
31
40
 
32
41
  * `:connected` - When the robot has connected to Slack. No payload.
@@ -32,10 +32,10 @@ module Lita
32
32
  attr_reader :rtm_connection
33
33
 
34
34
  def channel_for(target)
35
- if target.room
36
- target.room
37
- else
35
+ if target.private_message?
38
36
  rtm_connection.im_for(target.user.id)
37
+ else
38
+ target.room
39
39
  end
40
40
  end
41
41
  end
data/lita-slack.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-slack"
3
- spec.version = "1.0.3"
3
+ spec.version = "1.0.4"
4
4
  spec.authors = ["Ken J.", "Jimmy Cuadra"]
5
5
  spec.email = ["kenjij@gmail.com", "jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{Lita adapter for Slack.}
@@ -40,6 +40,9 @@ describe Lita::Adapters::Slack, lita: true do
40
40
  let(:room_source) { Lita::Source.new(room: 'C024BE91L') }
41
41
  let(:user) { Lita::User.new('U023BECGF') }
42
42
  let(:user_source) { Lita::Source.new(user: user) }
43
+ let(:private_message_source) do
44
+ Lita::Source.new(room: 'C024BE91L', user: user, private_message: true)
45
+ end
43
46
 
44
47
  it "sends messages to rooms" do
45
48
  expect(rtm_connection).to receive(:send_messages).with(room_source.room, ['foo'])
@@ -56,7 +59,17 @@ describe Lita::Adapters::Slack, lita: true do
56
59
 
57
60
  subject.run
58
61
 
59
- subject.send_messages(Lita::Source.new(user: user), ['foo'])
62
+ subject.send_messages(user_source, ['foo'])
63
+ end
64
+
65
+ it "sends messages to users when the source is marked as a private message" do
66
+ allow(rtm_connection).to receive(:im_for).with(user.id).and_return('D024BFF1M')
67
+
68
+ expect(rtm_connection).to receive(:send_messages).with('D024BFF1M', ['foo'])
69
+
70
+ subject.run
71
+
72
+ subject.send_messages(private_message_source, ['foo'])
60
73
  end
61
74
  end
62
75
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-18 00:00:00.000000000 Z
12
+ date: 2015-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.2.2
224
+ rubygems_version: 2.4.5
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Lita adapter for Slack.