slack-ruby-client 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_todo.yml +30 -34
- data/.travis.yml +0 -1
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +3 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/bin/commands/channels.rb +18 -9
- data/bin/commands/chat.rb +24 -3
- data/bin/commands/dialog.rb +14 -0
- data/bin/commands/files.rb +21 -0
- data/bin/commands/groups.rb +10 -10
- data/bin/commands/migration.rb +14 -0
- data/bin/commands/rtm.rb +2 -4
- data/bin/commands/users.rb +18 -18
- data/bin/commands/users_admin.rb +28 -0
- data/bin/commands/users_prefs.rb +12 -0
- data/bin/commands.rb +5 -1
- data/bin/slack +1 -1
- data/examples/hi_real_time/hi.rb +1 -1
- data/examples/hi_real_time_and_web/hi.rb +1 -1
- data/examples/hi_real_time_async_celluloid/hi.rb +1 -1
- data/examples/hi_real_time_async_eventmachine/hi.rb +1 -1
- data/examples/hi_web/hi.rb +1 -1
- data/examples/new_ticket/new_ticket.rb +1 -1
- data/lib/slack/messages/formatting.rb +4 -4
- data/lib/slack/messages/message.rb +1 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +1 -1
- data/lib/slack/real_time/client.rb +10 -9
- data/lib/slack/real_time/concurrency/celluloid.rb +5 -1
- data/lib/slack/real_time/config.rb +11 -11
- data/lib/slack/real_time/models/base.rb +1 -2
- data/lib/slack/real_time/socket.rb +2 -2
- data/lib/slack/real_time/stores/base.rb +1 -2
- data/lib/slack/real_time/stores/starter.rb +76 -76
- data/lib/slack/real_time/stores/store.rb +104 -94
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/api.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_permissions.rb +2 -2
- data/lib/slack/web/api/endpoints/auth.rb +2 -2
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +27 -15
- data/lib/slack/web/api/endpoints/chat.rb +42 -9
- data/lib/slack/web/api/endpoints/conversations.rb +17 -17
- data/lib/slack/web/api/endpoints/dialog.rb +32 -0
- data/lib/slack/web/api/endpoints/dnd.rb +5 -5
- data/lib/slack/web/api/endpoints/emoji.rb +1 -1
- data/lib/slack/web/api/endpoints/files.rb +37 -6
- data/lib/slack/web/api/endpoints/files_comments.rb +3 -3
- data/lib/slack/web/api/endpoints/groups.rb +17 -17
- data/lib/slack/web/api/endpoints/im.rb +6 -6
- data/lib/slack/web/api/endpoints/migration.rb +25 -0
- data/lib/slack/web/api/endpoints/mpim.rb +6 -6
- data/lib/slack/web/api/endpoints/oauth.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +3 -3
- data/lib/slack/web/api/endpoints/presence.rb +1 -1
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +3 -7
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/stars.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +4 -4
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +2 -2
- data/lib/slack/web/api/endpoints/users.rb +8 -8
- data/lib/slack/web/api/endpoints/users_admin.rb +46 -0
- data/lib/slack/web/api/endpoints/users_prefs.rb +19 -0
- data/lib/slack/web/api/endpoints/users_profile.rb +2 -2
- data/lib/slack/web/api/endpoints.rb +10 -2
- data/lib/slack/web/api/mixins/ids.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +38 -36
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +1 -1
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +1 -1
- data/lib/slack/web/api/patches/dialog.1.open-json-support.patch +17 -0
- data/lib/slack/web/api/templates/command.erb +2 -1
- data/lib/slack/web/api/templates/commands.erb +1 -1
- data/lib/slack/web/api/templates/endpoints.erb +2 -2
- data/lib/slack/web/api/templates/method.erb +8 -3
- data/lib/slack/web/api/templates/method_spec.erb +1 -1
- data/lib/slack/web/config.rb +12 -12
- data/lib/slack/web/faraday/response/raise_error.rb +3 -3
- data/lib/tasks/git.rake +1 -1
- data/lib/tasks/real_time.rake +1 -1
- data/lib/tasks/web.rake +4 -1
- data/slack-ruby-client.gemspec +2 -3
- data/spec/slack/messages/formatting_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +3 -2
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +1 -1
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +1 -1
- data/spec/slack/real_time/event_handlers/bot_spec.rb +4 -2
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/user_spec.rb +4 -2
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +28 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +8 -6
- data/spec/slack/web/api/endpoints/files_spec.rb +16 -0
- data/spec/slack/web/api/endpoints/migration_spec.rb +12 -0
- data/spec/slack/web/api/endpoints/users_admin_spec.rb +17 -0
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +7 -0
- data/spec/slack/web/api/error_spec.rb +1 -1
- data/spec/slack/web/api/errors/slack_error_spec.rb +1 -1
- data/spec/slack/web/api/mixins/users_spec.rb +6 -4
- data/spec/support/queue_with_timeout.rb +1 -1
- data/spec/support/real_time/concurrency/mock.rb +1 -2
- metadata +34 -31
data/bin/commands/users.rb
CHANGED
@@ -19,6 +19,15 @@ command 'users' do |g|
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
g.desc 'This method returns the ID of a team user.'
|
23
|
+
g.long_desc %( This method returns the ID of a team user. )
|
24
|
+
g.command 'id' do |c|
|
25
|
+
c.flag 'user', desc: 'User to get ID for, prefixed with @.'
|
26
|
+
c.action do |_global_options, options, _args|
|
27
|
+
puts JSON.dump($client.users_id(options))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
g.desc "Get a user's identity."
|
23
32
|
g.long_desc %( Get a user's identity. )
|
24
33
|
g.command 'identity' do |c|
|
@@ -49,6 +58,15 @@ command 'users' do |g|
|
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
61
|
+
g.desc 'This method searches for users.'
|
62
|
+
g.long_desc %( This method searches for users. )
|
63
|
+
g.command 'search' do |c|
|
64
|
+
c.flag 'user', desc: 'User to search for.'
|
65
|
+
c.action do |_global_options, options, _args|
|
66
|
+
puts JSON.dump($client.users_search(options))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
52
70
|
g.desc 'Marks a user as active.'
|
53
71
|
g.long_desc %( Marks a user as active. )
|
54
72
|
g.command 'setActive' do |c|
|
@@ -77,22 +95,4 @@ command 'users' do |g|
|
|
77
95
|
puts JSON.dump($client.users_setPresence(options))
|
78
96
|
end
|
79
97
|
end
|
80
|
-
|
81
|
-
g.desc 'This method returns the ID of a team user.'
|
82
|
-
g.long_desc %( This method returns the ID of a team user. )
|
83
|
-
g.command 'id' do |c|
|
84
|
-
c.flag 'user', desc: 'User to get ID for, prefixed with @.'
|
85
|
-
c.action do |_global_options, options, _args|
|
86
|
-
puts JSON.dump($client.users_id(options))
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
g.desc 'This method searches for users.'
|
91
|
-
g.long_desc %( This method searches for users. )
|
92
|
-
g.command 'search' do |c|
|
93
|
-
c.flag 'user', desc: 'User to search for.'
|
94
|
-
c.action do |_global_options, options, _args|
|
95
|
-
puts JSON.dump($client.users_search(options))
|
96
|
-
end
|
97
|
-
end
|
98
98
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'UsersAdmin methods.'
|
4
|
+
command 'users_admin' do |g|
|
5
|
+
g.desc 'Send an invitation to a new user by email (undocumented)'
|
6
|
+
g.long_desc %( Send an invitation to a new user by email )
|
7
|
+
g.command 'invite' do |c|
|
8
|
+
c.flag 'email', desc: 'Email address of the new user'
|
9
|
+
c.flag 'channels', desc: 'Comma-separated list of IDs (not names!) for channels, which the new user will auto-join. Both channel IDs for public channels and group IDs for private chanels work.'
|
10
|
+
c.flag 'first_name', desc: 'Prefilled input for the "First name" field on the "new user registration" page.'
|
11
|
+
c.flag 'last_name', desc: 'Prefilled input for the "Last name" field on the "new user registration" page.'
|
12
|
+
c.flag 'resend', desc: 'Resend the invitation email if the user has already been invited and the email was sent some time ago.'
|
13
|
+
c.flag 'restricted', desc: 'Invite a guest that can use multiple channels'
|
14
|
+
c.flag 'ultra_restricted', desc: 'Invite a guest that can use one channel only'
|
15
|
+
c.action do |_global_options, options, _args|
|
16
|
+
puts JSON.dump($client.users_admin_invite(options))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
g.desc 'Disable a user (undocumented)'
|
21
|
+
g.long_desc %( Disable a user )
|
22
|
+
g.command 'setInactive' do |c|
|
23
|
+
c.flag 'user', desc: 'User to disable'
|
24
|
+
c.action do |_global_options, options, _args|
|
25
|
+
puts JSON.dump($client.users_admin_setInactive(options))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file was auto-generated by lib/tasks/web.rake
|
2
|
+
|
3
|
+
desc 'UsersPrefs methods.'
|
4
|
+
command 'users_prefs' do |g|
|
5
|
+
g.desc "Returns the user's preferences (undocumented)"
|
6
|
+
g.long_desc %( Returns the user's preferences )
|
7
|
+
g.command 'get' do |c|
|
8
|
+
c.action do |_global_options, options, _args|
|
9
|
+
puts JSON.dump($client.users_prefs_get(options))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/bin/commands.rb
CHANGED
@@ -7,12 +7,14 @@ require 'commands/bots'
|
|
7
7
|
require 'commands/channels'
|
8
8
|
require 'commands/chat'
|
9
9
|
require 'commands/conversations'
|
10
|
+
require 'commands/dialog'
|
10
11
|
require 'commands/dnd'
|
11
12
|
require 'commands/emoji'
|
12
|
-
require 'commands/files_comments'
|
13
13
|
require 'commands/files'
|
14
|
+
require 'commands/files_comments'
|
14
15
|
require 'commands/groups'
|
15
16
|
require 'commands/im'
|
17
|
+
require 'commands/migration'
|
16
18
|
require 'commands/mpim'
|
17
19
|
require 'commands/oauth'
|
18
20
|
require 'commands/pins'
|
@@ -26,4 +28,6 @@ require 'commands/team_profile'
|
|
26
28
|
require 'commands/usergroups'
|
27
29
|
require 'commands/usergroups_users'
|
28
30
|
require 'commands/users'
|
31
|
+
require 'commands/users_admin'
|
32
|
+
require 'commands/users_prefs'
|
29
33
|
require 'commands/users_profile'
|
data/bin/slack
CHANGED
@@ -9,7 +9,7 @@ program_desc 'Slack client.'
|
|
9
9
|
|
10
10
|
default_command :help
|
11
11
|
|
12
|
-
switch [
|
12
|
+
switch %i[d debug], desc: 'Enable debug-level logging.', default_value: false
|
13
13
|
flag [:t, 'slack-api-token'], desc: 'Slack API token.', default_value: ENV['SLACK_API_TOKEN']
|
14
14
|
flag ['vcr-cassette-name'], desc: 'Offline VCR cassette.'
|
15
15
|
|
data/examples/hi_real_time/hi.rb
CHANGED
@@ -4,7 +4,7 @@ Slack.configure do |config|
|
|
4
4
|
config.token = ENV['SLACK_API_TOKEN']
|
5
5
|
config.logger = Logger.new(STDOUT)
|
6
6
|
config.logger.level = Logger::INFO
|
7
|
-
|
7
|
+
raise 'Missing ENV[SLACK_API_TOKEN]!' unless config.token
|
8
8
|
end
|
9
9
|
|
10
10
|
client = Slack::RealTime::Client.new
|
data/examples/hi_web/hi.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
module Slack
|
3
3
|
module Messages
|
4
4
|
module Formatting
|
@@ -10,9 +10,9 @@ module Slack
|
|
10
10
|
def unescape(message)
|
11
11
|
CGI.unescapeHTML(message.gsub(/[“”]/, '"')
|
12
12
|
.gsub(/[‘’]/, "'")
|
13
|
-
.gsub(/<(?<sign>[?@#!]?)(?<dt>.*?)>/) do
|
14
|
-
sign =
|
15
|
-
dt =
|
13
|
+
.gsub(/<(?<sign>[?@#!]?)(?<dt>.*?)>/) do
|
14
|
+
sign = Regexp.last_match[:sign]
|
15
|
+
dt = Regexp.last_match[:dt]
|
16
16
|
rhs = dt.split('|', 2).last
|
17
17
|
case sign
|
18
18
|
when '@', '!'
|
@@ -33,7 +33,7 @@ module Slack
|
|
33
33
|
@web_client = Slack::Web::Client.new(token: token, logger: logger)
|
34
34
|
end
|
35
35
|
|
36
|
-
[
|
36
|
+
%i[users self channels team teams groups ims bots].each do |store_method|
|
37
37
|
define_method store_method do
|
38
38
|
store.send(store_method) if store
|
39
39
|
end
|
@@ -60,7 +60,7 @@ module Slack
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def stop!
|
63
|
-
|
63
|
+
raise ClientNotStartedError unless started?
|
64
64
|
@socket.disconnect! if @socket
|
65
65
|
end
|
66
66
|
|
@@ -106,7 +106,7 @@ module Slack
|
|
106
106
|
|
107
107
|
# @return [Slack::RealTime::Socket]
|
108
108
|
def build_socket
|
109
|
-
|
109
|
+
raise ClientAlreadyStartedError if started?
|
110
110
|
start = web_client.send(rtm_start_method, start_options)
|
111
111
|
data = Slack::Messages::Message.new(start)
|
112
112
|
@url = data.url
|
@@ -138,13 +138,12 @@ module Slack
|
|
138
138
|
end
|
139
139
|
|
140
140
|
def send_json(data)
|
141
|
-
|
141
|
+
raise ClientNotStartedError unless started?
|
142
142
|
logger.debug("#{self.class}##{__method__}") { data }
|
143
143
|
@socket.send_data(data.to_json)
|
144
144
|
end
|
145
145
|
|
146
|
-
def open(_event)
|
147
|
-
end
|
146
|
+
def open(_event); end
|
148
147
|
|
149
148
|
def close(_event)
|
150
149
|
socket = @socket
|
@@ -183,9 +182,11 @@ module Slack
|
|
183
182
|
|
184
183
|
def run_handlers(type, data)
|
185
184
|
handlers = store.class.events[type.to_s]
|
186
|
-
handlers
|
187
|
-
|
188
|
-
|
185
|
+
if handlers
|
186
|
+
handlers.each do |handler|
|
187
|
+
store.instance_exec(data, &handler)
|
188
|
+
end
|
189
|
+
end
|
189
190
|
rescue StandardError => e
|
190
191
|
logger.error e
|
191
192
|
false
|
@@ -38,7 +38,11 @@ module Slack
|
|
38
38
|
logger.debug("#{self.class}##{__method__}") { e }
|
39
39
|
driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'server closed connection')) unless @closing
|
40
40
|
ensure
|
41
|
-
|
41
|
+
begin
|
42
|
+
current_actor.terminate if current_actor.alive?
|
43
|
+
rescue
|
44
|
+
nil
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
def close
|
@@ -5,15 +5,15 @@ module Slack
|
|
5
5
|
|
6
6
|
extend self
|
7
7
|
|
8
|
-
ATTRIBUTES = [
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
ATTRIBUTES = %i[
|
9
|
+
token
|
10
|
+
websocket_ping
|
11
|
+
websocket_proxy
|
12
|
+
concurrency
|
13
|
+
start_method
|
14
|
+
start_options
|
15
|
+
store_class
|
16
|
+
logger
|
17
17
|
].freeze
|
18
18
|
|
19
19
|
attr_accessor(*Config::ATTRIBUTES)
|
@@ -36,7 +36,7 @@ module Slack
|
|
36
36
|
private
|
37
37
|
|
38
38
|
def detect_concurrency
|
39
|
-
[
|
39
|
+
%i[Eventmachine Celluloid].each do |concurrency|
|
40
40
|
begin
|
41
41
|
return Slack::RealTime::Concurrency.const_get(concurrency)
|
42
42
|
rescue LoadError, NameError
|
@@ -44,7 +44,7 @@ module Slack
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
raise NoConcurrencyError, 'Missing concurrency. Add faye-websocket or celluloid-io to your Gemfile.'
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -50,7 +50,7 @@ module Slack
|
|
50
50
|
|
51
51
|
# @return [#join]
|
52
52
|
def start_async(_client)
|
53
|
-
|
53
|
+
raise NotImplementedError, "Expected #{self.class} to implement #{__method__}."
|
54
54
|
end
|
55
55
|
|
56
56
|
def close
|
@@ -79,7 +79,7 @@ module Slack
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def connect
|
82
|
-
|
82
|
+
raise NotImplementedError, "Expected #{self.class} to implement #{__method__}."
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -16,342 +16,342 @@ module Slack
|
|
16
16
|
|
17
17
|
# The membership of an existing User Group has changed.
|
18
18
|
# @see https://api.slack.com/events/subteam_members_changed
|
19
|
-
# @see https://github.com/
|
19
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
|
20
20
|
# on :subteam_members_changed do |data|
|
21
21
|
|
22
22
|
# Subscribe to presence events for the specified users.
|
23
23
|
# @see https://api.slack.com/events/presence_sub
|
24
|
-
# @see https://github.com/
|
24
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_sub.json
|
25
25
|
# on :presence_sub do |data|
|
26
26
|
|
27
27
|
# A user left a public or private channel.
|
28
28
|
# @see https://api.slack.com/events/member_left_channel
|
29
|
-
# @see https://github.com/
|
29
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/member_left_channel.json
|
30
30
|
# on :member_left_channel do |data|
|
31
31
|
|
32
32
|
# A user joined a public or private channel.
|
33
33
|
# @see https://api.slack.com/events/member_joined_channel
|
34
|
-
# @see https://github.com/
|
34
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/member_joined_channel.json
|
35
35
|
# on :member_joined_channel do |data|
|
36
36
|
|
37
37
|
# The server intends to close the connection soon..
|
38
38
|
# @see https://api.slack.com/events/goodbye
|
39
|
-
# @see https://github.com/
|
39
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/goodbye.json
|
40
40
|
# on :goodbye do |data|
|
41
41
|
|
42
42
|
# Verifies ownership of an Events API Request URL.
|
43
43
|
# @see https://api.slack.com/events/url_verification
|
44
|
-
# @see https://github.com/
|
44
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/url_verification.json
|
45
45
|
# on :url_verification do |data|
|
46
46
|
|
47
47
|
# A message was posted in a multiparty direct message channel.
|
48
48
|
# @see https://api.slack.com/events/message.mpim
|
49
|
-
# @see https://github.com/
|
49
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.mpim.json
|
50
50
|
# on :message.mpim do |data|
|
51
51
|
|
52
52
|
# A message was posted in a direct message channel.
|
53
53
|
# @see https://api.slack.com/events/message.im
|
54
|
-
# @see https://github.com/
|
54
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.im.json
|
55
55
|
# on :message.im do |data|
|
56
56
|
|
57
57
|
# A message was posted to a private channel.
|
58
58
|
# @see https://api.slack.com/events/message.groups
|
59
|
-
# @see https://github.com/
|
59
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.groups.json
|
60
60
|
# on :message.groups do |data|
|
61
61
|
|
62
62
|
# A message was posted to a channel.
|
63
63
|
# @see https://api.slack.com/events/message.channels
|
64
|
-
# @see https://github.com/
|
64
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.channels.json
|
65
65
|
# on :message.channels do |data|
|
66
66
|
|
67
67
|
# A channel member is typing a message.
|
68
68
|
# @see https://api.slack.com/events/user_typing
|
69
|
-
# @see https://github.com/
|
69
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/user_typing.json
|
70
70
|
# on :user_typing do |data|
|
71
71
|
|
72
72
|
# A team member's data has changed.
|
73
73
|
# @see https://api.slack.com/events/user_change
|
74
|
-
# @see https://github.com/
|
74
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/user_change.json
|
75
75
|
# on :user_change do |data|
|
76
76
|
|
77
77
|
# A new team member has joined.
|
78
78
|
# @see https://api.slack.com/events/team_join
|
79
|
-
# @see https://github.com/
|
79
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_join.json
|
80
80
|
# on :team_join do |data|
|
81
81
|
|
82
82
|
# An existing user group has been updated or its members changed.
|
83
83
|
# @see https://api.slack.com/events/subteam_updated
|
84
|
-
# @see https://github.com/
|
84
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_updated.json
|
85
85
|
# on :subteam_updated do |data|
|
86
86
|
|
87
87
|
# You have been removed from a user group.
|
88
88
|
# @see https://api.slack.com/events/subteam_self_removed
|
89
|
-
# @see https://github.com/
|
89
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_self_removed.json
|
90
90
|
# on :subteam_self_removed do |data|
|
91
91
|
|
92
92
|
# You have been added to a user group.
|
93
93
|
# @see https://api.slack.com/events/subteam_self_added
|
94
|
-
# @see https://github.com/
|
94
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_self_added.json
|
95
95
|
# on :subteam_self_added do |data|
|
96
96
|
|
97
97
|
# A user group has been added to the team.
|
98
98
|
# @see https://api.slack.com/events/subteam_created
|
99
|
-
# @see https://github.com/
|
99
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_created.json
|
100
100
|
# on :subteam_created do |data|
|
101
101
|
|
102
102
|
# A team member removed a star.
|
103
103
|
# @see https://api.slack.com/events/star_removed
|
104
|
-
# @see https://github.com/
|
104
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_removed.json
|
105
105
|
# on :star_removed do |data|
|
106
106
|
|
107
107
|
# A team member has starred an item.
|
108
108
|
# @see https://api.slack.com/events/star_added
|
109
|
-
# @see https://github.com/
|
109
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_added.json
|
110
110
|
# on :star_added do |data|
|
111
111
|
|
112
112
|
# Experimental.
|
113
113
|
# @see https://api.slack.com/events/reconnect_url
|
114
|
-
# @see https://github.com/
|
114
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reconnect_url.json
|
115
115
|
# on :reconnect_url do |data|
|
116
116
|
|
117
117
|
# A team member removed an emoji reaction.
|
118
118
|
# @see https://api.slack.com/events/reaction_removed
|
119
|
-
# @see https://github.com/
|
119
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reaction_removed.json
|
120
120
|
# on :reaction_removed do |data|
|
121
121
|
|
122
122
|
# A team member has added an emoji reaction to an item.
|
123
123
|
# @see https://api.slack.com/events/reaction_added
|
124
|
-
# @see https://github.com/
|
124
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reaction_added.json
|
125
125
|
# on :reaction_added do |data|
|
126
126
|
|
127
127
|
# A team member's presence changed.
|
128
128
|
# @see https://api.slack.com/events/presence_change
|
129
|
-
# @see https://github.com/
|
129
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_change.json
|
130
130
|
# on :presence_change do |data|
|
131
131
|
|
132
132
|
# You have updated your preferences.
|
133
133
|
# @see https://api.slack.com/events/pref_change
|
134
|
-
# @see https://github.com/
|
134
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pref_change.json
|
135
135
|
# on :pref_change do |data|
|
136
136
|
|
137
137
|
# A pin was removed from a channel.
|
138
138
|
# @see https://api.slack.com/events/pin_removed
|
139
|
-
# @see https://github.com/
|
139
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pin_removed.json
|
140
140
|
# on :pin_removed do |data|
|
141
141
|
|
142
142
|
# A pin was added to a channel.
|
143
143
|
# @see https://api.slack.com/events/pin_added
|
144
|
-
# @see https://github.com/
|
144
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pin_added.json
|
145
145
|
# on :pin_added do |data|
|
146
146
|
|
147
147
|
# You manually updated your presence.
|
148
148
|
# @see https://api.slack.com/events/manual_presence_change
|
149
|
-
# @see https://github.com/
|
149
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/manual_presence_change.json
|
150
150
|
# on :manual_presence_change do |data|
|
151
151
|
|
152
152
|
# You opened a direct message channel.
|
153
153
|
# @see https://api.slack.com/events/im_open
|
154
|
-
# @see https://github.com/
|
154
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_open.json
|
155
155
|
# on :im_open do |data|
|
156
156
|
|
157
157
|
# A direct message read marker was updated.
|
158
158
|
# @see https://api.slack.com/events/im_marked
|
159
|
-
# @see https://github.com/
|
159
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_marked.json
|
160
160
|
# on :im_marked do |data|
|
161
161
|
|
162
162
|
# Bulk updates were made to a DM channel's history.
|
163
163
|
# @see https://api.slack.com/events/im_history_changed
|
164
|
-
# @see https://github.com/
|
164
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_history_changed.json
|
165
165
|
# on :im_history_changed do |data|
|
166
166
|
|
167
167
|
# A direct message channel was created.
|
168
168
|
# @see https://api.slack.com/events/im_created
|
169
|
-
# @see https://github.com/
|
169
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_created.json
|
170
170
|
# on :im_created do |data|
|
171
171
|
|
172
172
|
# You closed a direct message channel.
|
173
173
|
# @see https://api.slack.com/events/im_close
|
174
|
-
# @see https://github.com/
|
174
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_close.json
|
175
175
|
# on :im_close do |data|
|
176
176
|
|
177
177
|
# A private group was unarchived.
|
178
178
|
# @see https://api.slack.com/events/group_unarchive
|
179
|
-
# @see https://github.com/
|
179
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_unarchive.json
|
180
180
|
# on :group_unarchive do |data|
|
181
181
|
|
182
182
|
# A private group was renamed.
|
183
183
|
# @see https://api.slack.com/events/group_rename
|
184
|
-
# @see https://github.com/
|
184
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_rename.json
|
185
185
|
# on :group_rename do |data|
|
186
186
|
|
187
187
|
# You opened a group channel.
|
188
188
|
# @see https://api.slack.com/events/group_open
|
189
|
-
# @see https://github.com/
|
189
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_open.json
|
190
190
|
# on :group_open do |data|
|
191
191
|
|
192
192
|
# A private group read marker was updated.
|
193
193
|
# @see https://api.slack.com/events/group_marked
|
194
|
-
# @see https://github.com/
|
194
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_marked.json
|
195
195
|
# on :group_marked do |data|
|
196
196
|
|
197
197
|
# You left a private group.
|
198
198
|
# @see https://api.slack.com/events/group_left
|
199
|
-
# @see https://github.com/
|
199
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_left.json
|
200
200
|
# on :group_left do |data|
|
201
201
|
|
202
202
|
# You joined a private group.
|
203
203
|
# @see https://api.slack.com/events/group_joined
|
204
|
-
# @see https://github.com/
|
204
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_joined.json
|
205
205
|
# on :group_joined do |data|
|
206
206
|
|
207
207
|
# Bulk updates were made to a group's history.
|
208
208
|
# @see https://api.slack.com/events/group_history_changed
|
209
|
-
# @see https://github.com/
|
209
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_history_changed.json
|
210
210
|
# on :group_history_changed do |data|
|
211
211
|
|
212
212
|
# You closed a group channel.
|
213
213
|
# @see https://api.slack.com/events/group_close
|
214
|
-
# @see https://github.com/
|
214
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_close.json
|
215
215
|
# on :group_close do |data|
|
216
216
|
|
217
217
|
# A private group was archived.
|
218
218
|
# @see https://api.slack.com/events/group_archive
|
219
|
-
# @see https://github.com/
|
219
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_archive.json
|
220
220
|
# on :group_archive do |data|
|
221
221
|
|
222
222
|
# A file was unshared.
|
223
223
|
# @see https://api.slack.com/events/file_unshared
|
224
|
-
# @see https://github.com/
|
224
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_unshared.json
|
225
225
|
# on :file_unshared do |data|
|
226
226
|
|
227
227
|
# A file was shared.
|
228
228
|
# @see https://api.slack.com/events/file_shared
|
229
|
-
# @see https://github.com/
|
229
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_shared.json
|
230
230
|
# on :file_shared do |data|
|
231
231
|
|
232
232
|
# A file was made public.
|
233
233
|
# @see https://api.slack.com/events/file_public
|
234
|
-
# @see https://github.com/
|
234
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_public.json
|
235
235
|
# on :file_public do |data|
|
236
236
|
|
237
237
|
# A file was made private.
|
238
238
|
# @see https://api.slack.com/events/file_private
|
239
|
-
# @see https://github.com/
|
239
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_private.json
|
240
240
|
# on :file_private do |data|
|
241
241
|
|
242
242
|
# A file was deleted.
|
243
243
|
# @see https://api.slack.com/events/file_deleted
|
244
|
-
# @see https://github.com/
|
244
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_deleted.json
|
245
245
|
# on :file_deleted do |data|
|
246
246
|
|
247
247
|
# A file was created.
|
248
248
|
# @see https://api.slack.com/events/file_created
|
249
|
-
# @see https://github.com/
|
249
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_created.json
|
250
250
|
# on :file_created do |data|
|
251
251
|
|
252
252
|
# A file comment was edited.
|
253
253
|
# @see https://api.slack.com/events/file_comment_edited
|
254
|
-
# @see https://github.com/
|
254
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_edited.json
|
255
255
|
# on :file_comment_edited do |data|
|
256
256
|
|
257
257
|
# A file comment was deleted.
|
258
258
|
# @see https://api.slack.com/events/file_comment_deleted
|
259
|
-
# @see https://github.com/
|
259
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_deleted.json
|
260
260
|
# on :file_comment_deleted do |data|
|
261
261
|
|
262
262
|
# A file comment was added.
|
263
263
|
# @see https://api.slack.com/events/file_comment_added
|
264
|
-
# @see https://github.com/
|
264
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_added.json
|
265
265
|
# on :file_comment_added do |data|
|
266
266
|
|
267
267
|
# A file was changed.
|
268
268
|
# @see https://api.slack.com/events/file_change
|
269
|
-
# @see https://github.com/
|
269
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_change.json
|
270
270
|
# on :file_change do |data|
|
271
271
|
|
272
272
|
# A team custom emoji has been added or changed.
|
273
273
|
# @see https://api.slack.com/events/emoji_changed
|
274
|
-
# @see https://github.com/
|
274
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/emoji_changed.json
|
275
275
|
# on :emoji_changed do |data|
|
276
276
|
|
277
277
|
# Do not Disturb settings changed for a team member.
|
278
278
|
# @see https://api.slack.com/events/dnd_updated_user
|
279
|
-
# @see https://github.com/
|
279
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/dnd_updated_user.json
|
280
280
|
# on :dnd_updated_user do |data|
|
281
281
|
|
282
282
|
# Do not Disturb settings changed for the current user.
|
283
283
|
# @see https://api.slack.com/events/dnd_updated
|
284
|
-
# @see https://github.com/
|
284
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/dnd_updated.json
|
285
285
|
# on :dnd_updated do |data|
|
286
286
|
|
287
287
|
# A team slash command has been added or changed.
|
288
288
|
# @see https://api.slack.com/events/commands_changed
|
289
|
-
# @see https://github.com/
|
289
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/commands_changed.json
|
290
290
|
# on :commands_changed do |data|
|
291
291
|
|
292
292
|
# A team channel was unarchived.
|
293
293
|
# @see https://api.slack.com/events/channel_unarchive
|
294
|
-
# @see https://github.com/
|
294
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_unarchive.json
|
295
295
|
# on :channel_unarchive do |data|
|
296
296
|
|
297
297
|
# A team channel was renamed.
|
298
298
|
# @see https://api.slack.com/events/channel_rename
|
299
|
-
# @see https://github.com/
|
299
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_rename.json
|
300
300
|
# on :channel_rename do |data|
|
301
301
|
|
302
302
|
# Your channel read marker was updated.
|
303
303
|
# @see https://api.slack.com/events/channel_marked
|
304
|
-
# @see https://github.com/
|
304
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_marked.json
|
305
305
|
# on :channel_marked do |data|
|
306
306
|
|
307
307
|
# You left a channel.
|
308
308
|
# @see https://api.slack.com/events/channel_left
|
309
|
-
# @see https://github.com/
|
309
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_left.json
|
310
310
|
# on :channel_left do |data|
|
311
311
|
|
312
312
|
# You joined a channel.
|
313
313
|
# @see https://api.slack.com/events/channel_joined
|
314
|
-
# @see https://github.com/
|
314
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_joined.json
|
315
315
|
# on :channel_joined do |data|
|
316
316
|
|
317
317
|
# Bulk updates were made to a channel's history.
|
318
318
|
# @see https://api.slack.com/events/channel_history_changed
|
319
|
-
# @see https://github.com/
|
319
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_history_changed.json
|
320
320
|
# on :channel_history_changed do |data|
|
321
321
|
|
322
322
|
# A team channel was deleted.
|
323
323
|
# @see https://api.slack.com/events/channel_deleted
|
324
|
-
# @see https://github.com/
|
324
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_deleted.json
|
325
325
|
# on :channel_deleted do |data|
|
326
326
|
|
327
327
|
# A team channel was created.
|
328
328
|
# @see https://api.slack.com/events/channel_created
|
329
|
-
# @see https://github.com/
|
329
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_created.json
|
330
330
|
# on :channel_created do |data|
|
331
331
|
|
332
332
|
# A team channel was archived.
|
333
333
|
# @see https://api.slack.com/events/channel_archive
|
334
|
-
# @see https://github.com/
|
334
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_archive.json
|
335
335
|
# on :channel_archive do |data|
|
336
336
|
|
337
337
|
# An integration bot was changed.
|
338
338
|
# @see https://api.slack.com/events/bot_changed
|
339
|
-
# @see https://github.com/
|
339
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/bot_changed.json
|
340
340
|
# on :bot_changed do |data|
|
341
341
|
|
342
342
|
# An integration bot was added.
|
343
343
|
# @see https://api.slack.com/events/bot_added
|
344
|
-
# @see https://github.com/
|
344
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/bot_added.json
|
345
345
|
# on :bot_added do |data|
|
346
346
|
|
347
347
|
# The list of accounts a user is signed into has changed.
|
348
348
|
# @see https://api.slack.com/events/accounts_changed
|
349
|
-
# @see https://github.com/
|
349
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/accounts_changed.json
|
350
350
|
# on :accounts_changed do |data|
|
351
351
|
|
352
352
|
# The team domain has changed.
|
353
353
|
# @see https://api.slack.com/events/team_domain_change
|
354
|
-
# @see https://github.com/
|
354
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_domain_change.json
|
355
355
|
on :team_domain_change do |data|
|
356
356
|
team.url = data.url
|
357
357
|
team.domain = data.domain
|
@@ -359,19 +359,19 @@ module Slack
|
|
359
359
|
|
360
360
|
# The team is being migrated between servers.
|
361
361
|
# @see https://api.slack.com/events/team_migration_started
|
362
|
-
# @see https://github.com/
|
362
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_migration_started.json
|
363
363
|
# on :team_migration_started do |data|
|
364
364
|
|
365
365
|
# The team billing plan has changed.
|
366
366
|
# @see https://api.slack.com/events/team_plan_change
|
367
|
-
# @see https://github.com/
|
367
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_plan_change.json
|
368
368
|
on :team_plan_change do |data|
|
369
369
|
team.plan = data.plan
|
370
370
|
end
|
371
371
|
|
372
372
|
# A team preference has been updated.
|
373
373
|
# @see https://api.slack.com/events/team_pref_change
|
374
|
-
# @see https://github.com/
|
374
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_pref_change.json
|
375
375
|
on :team_pref_change do |data|
|
376
376
|
team.prefs ||= {}
|
377
377
|
team.prefs[data.name] = data.value
|
@@ -379,29 +379,29 @@ module Slack
|
|
379
379
|
|
380
380
|
# Team profile fields have been updated.
|
381
381
|
# @see https://api.slack.com/events/team_profile_change
|
382
|
-
# @see https://github.com/
|
382
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_change.json
|
383
383
|
# on :team_profile_change do |data|
|
384
384
|
|
385
385
|
# Team profile fields have been deleted.
|
386
386
|
# @see https://api.slack.com/events/team_profile_delete
|
387
|
-
# @see https://github.com/
|
387
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_delete.json
|
388
388
|
# on :team_profile_delete do |data|
|
389
389
|
|
390
390
|
# Team profile fields have been reordered.
|
391
391
|
# @see https://api.slack.com/events/team_profile_reorder
|
392
|
-
# @see https://github.com/
|
392
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_reorder.json
|
393
393
|
# on :team_profile_reorder do |data|
|
394
394
|
|
395
395
|
# The team name has changed.
|
396
396
|
# @see https://api.slack.com/events/team_rename
|
397
|
-
# @see https://github.com/
|
397
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_rename.json
|
398
398
|
on :team_rename do |data|
|
399
399
|
team.name = data.name
|
400
400
|
end
|
401
401
|
|
402
402
|
# The team email domain has changed.
|
403
403
|
# @see https://api.slack.com/events/email_domain_changed
|
404
|
-
# @see https://github.com/
|
404
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/email_domain_changed.json
|
405
405
|
on :email_domain_changed do |data|
|
406
406
|
team.email_domain = data.email_domain
|
407
407
|
end
|