lita-slack 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lib/lita/adapters/slack/slack_user.rb +9 -3
- data/lita-slack.gemspec +1 -1
- data/spec/lita/adapters/slack/rtm_connection_spec.rb +2 -2
- data/spec/lita/adapters/slack/slack_user_spec.rb +8 -1
- data/spec/lita/adapters/slack/user_creator_spec.rb +3 -2
- 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: 5ef23fe9c0c94ca5668f7780c8504e0d695d896e
|
4
|
+
data.tar.gz: fe0565d87688f3f175a4f6c50410b4c9e9a65ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e9243b224e1bb78f731707496200bb34dcebf0bea6cb6ed9ae3a8e208c2ff6781f96cc32e7f955f790df9b00348355cc73038b72e4bfa30d6cd766ae007b19b
|
7
|
+
data.tar.gz: be29248c5356c227b17877135dc2fc0e471c057b11eb4868238a09b6b1712a017ab619155e3eeb955d4dc5a7c9cd20a9b23383968083588427032ac8922a4b5c
|
data/.travis.yml
CHANGED
@@ -27,15 +27,21 @@ module Lita
|
|
27
27
|
attr_reader :name
|
28
28
|
# @return [String] The user's display name, e.g. Alice Bobhart
|
29
29
|
attr_reader :real_name
|
30
|
+
# @return [String] The user's email address, e.g. alice@example.com
|
31
|
+
attr_reader :email
|
30
32
|
# @return [Hash] The raw user data received from Slack, including many more fields.
|
31
|
-
attr_reader :
|
33
|
+
attr_reader :metadata
|
32
34
|
|
33
|
-
def initialize(id, name, real_name,
|
35
|
+
def initialize(id, name, real_name, metadata)
|
34
36
|
@id = id
|
35
37
|
@name = name
|
36
38
|
@real_name = real_name.to_s
|
37
|
-
@
|
39
|
+
@email = metadata['email'].to_s
|
40
|
+
@metadata = metadata
|
38
41
|
end
|
42
|
+
|
43
|
+
# nodoc: backward compatability
|
44
|
+
alias_method :raw_data, :metadata
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
data/lita-slack.gemspec
CHANGED
@@ -15,8 +15,8 @@ describe Lita::Adapters::Slack::RTMConnection, lita: true do
|
|
15
15
|
let(:registry) { Lita::Registry.new }
|
16
16
|
let(:robot) { Lita::Robot.new(registry) }
|
17
17
|
let(:raw_user_data) { Hash.new }
|
18
|
-
let(:channel) { Lita::Adapters::Slack::SlackChannel.new('C2147483705', 'general', 1360782804, 'U023BECGF',
|
19
|
-
let(:
|
18
|
+
let(:channel) { Lita::Adapters::Slack::SlackChannel.new('C2147483705', 'general', 1360782804, 'U023BECGF', metadata) }
|
19
|
+
let(:metadata) { Hash.new }
|
20
20
|
|
21
21
|
let(:rtm_start_response) do
|
22
22
|
Lita::Adapters::Slack::TeamData.new(
|
@@ -5,7 +5,8 @@ describe Lita::Adapters::Slack::SlackUser do
|
|
5
5
|
{
|
6
6
|
"id" => "U023BECGF",
|
7
7
|
"name" => "bobby",
|
8
|
-
"real_name" => "Bobby Tables"
|
8
|
+
"real_name" => "Bobby Tables",
|
9
|
+
"email" => "btables@example.com"
|
9
10
|
}
|
10
11
|
end
|
11
12
|
let(:user_data_2) do
|
@@ -27,9 +28,15 @@ describe Lita::Adapters::Slack::SlackUser do
|
|
27
28
|
expect(subject[0].id).to eq('U023BECGF')
|
28
29
|
expect(subject[0].name).to eq('bobby')
|
29
30
|
expect(subject[0].real_name).to eq('Bobby Tables')
|
31
|
+
expect(subject[0].email).to eq('btables@example.com')
|
30
32
|
expect(subject[1].id).to eq('U024BE7LH')
|
31
33
|
expect(subject[1].name).to eq('carl')
|
32
34
|
expect(subject[1].real_name).to eq('')
|
35
|
+
expect(subject[1].email).to eq('')
|
36
|
+
end
|
37
|
+
|
38
|
+
it "raw_data matches the metadata" do
|
39
|
+
expect(subject[0].metadata['email']).to eq(subject[0].raw_data['email'])
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
@@ -13,9 +13,10 @@ describe Lita::Adapters::Slack::UserCreator do
|
|
13
13
|
|
14
14
|
describe ".create_users" do
|
15
15
|
let(:real_name) { 'Bobby Tables' }
|
16
|
+
let(:email) { 'bobby@example.com' }
|
16
17
|
let(:bobby) { Lita::Adapters::Slack::SlackUser.new('U023BECGF', 'bobby', real_name, slack_data) }
|
17
18
|
let(:robot_id) { 'U12345678' }
|
18
|
-
let(:slack_data) { { 'id' => 'U023BECGF', 'name' => 'bobby', 'real_name' => real_name } }
|
19
|
+
let(:slack_data) { { 'id' => 'U023BECGF', 'name' => 'bobby', 'real_name' => real_name, 'email' => email } }
|
19
20
|
|
20
21
|
it "creates Lita users for each user in the provided data" do
|
21
22
|
expect(Lita::User).to receive(:create).with(
|
@@ -48,7 +49,7 @@ describe Lita::Adapters::Slack::UserCreator do
|
|
48
49
|
|
49
50
|
describe ".create_user" do
|
50
51
|
let(:robot_id) { 'U12345678' }
|
51
|
-
let(:slack_data) { { 'id' => robot_id, 'name' => 'litabot', 'real_name' => 'Lita Bot' } }
|
52
|
+
let(:slack_data) { { 'id' => robot_id, 'name' => 'litabot', 'real_name' => 'Lita Bot', 'email' => 'litabot@example.com' } }
|
52
53
|
let(:slack_user) { Lita::Adapters::Slack::SlackUser.new(robot_id, 'litabot', 'Lita Bot', slack_data) }
|
53
54
|
|
54
55
|
it "updates the robot's name and mention name if it applicable" do
|
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.
|
4
|
+
version: 1.7.0
|
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: 2015-
|
12
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|