lita-slack 1.6.0 → 1.7.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: 263b8f5a62893a0ca957dbbf02925525e6c4aef0
4
- data.tar.gz: 8a8d23b254f44196cb4c332c81b445fbac276df0
3
+ metadata.gz: 5ef23fe9c0c94ca5668f7780c8504e0d695d896e
4
+ data.tar.gz: fe0565d87688f3f175a4f6c50410b4c9e9a65ecf
5
5
  SHA512:
6
- metadata.gz: 09b05e48245ee0966a4a211a6672df6d8042e5a5af27f74c88ea91ad568fe865e0fce44e709e32a5f18afca9198c15826a2c02b3ba60cf423448923e078486ee
7
- data.tar.gz: 8408c30ff79ef6b025e7e94c29178538b84d01f850ef24e6e41f6ee365b59cf6b3e5d1945605f12efa113b0669422c6e3c67fdef105f6d4a69575ed21c2faf8f
6
+ metadata.gz: 2e9243b224e1bb78f731707496200bb34dcebf0bea6cb6ed9ae3a8e208c2ff6781f96cc32e7f955f790df9b00348355cc73038b72e4bfa30d6cd766ae007b19b
7
+ data.tar.gz: be29248c5356c227b17877135dc2fc0e471c057b11eb4868238a09b6b1712a017ab619155e3eeb955d4dc5a7c9cd20a9b23383968083588427032ac8922a4b5c
@@ -11,6 +11,7 @@ branches:
11
11
  except:
12
12
  - /^v[0-9]/
13
13
  notifications:
14
+ email: false
14
15
  webhooks:
15
16
  urls:
16
- - https://lita-freenode.herokuapp.com/travis
17
+ - http://util.perceptes.com:8080/travis
@@ -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 :raw_data
33
+ attr_reader :metadata
32
34
 
33
- def initialize(id, name, real_name, raw_data)
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
- @raw_data = raw_data
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-slack"
3
- spec.version = "1.6.0"
3
+ spec.version = "1.7.0"
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.}
@@ -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', raw_data) }
19
- let(:raw_data) { Hash.new }
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.6.0
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-08-29 00:00:00.000000000 Z
12
+ date: 2015-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine