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
@@ -26,109 +26,119 @@ module Slack
|
|
26
26
|
@users = {}
|
27
27
|
end
|
28
28
|
|
29
|
-
attrs.users
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
if attrs.users
|
30
|
+
attrs.users.each do |data|
|
31
|
+
user = Models::User.new(data)
|
32
|
+
@users[data.id] = @users.key?(data.id) ? @users[data.id].merge(user) : user
|
33
|
+
end
|
34
|
+
end
|
33
35
|
|
34
36
|
@channels = {}
|
35
|
-
attrs.channels
|
36
|
-
|
37
|
-
|
37
|
+
if attrs.channels
|
38
|
+
attrs.channels.each do |data|
|
39
|
+
@channels[data.id] = Models::Channel.new(data)
|
40
|
+
end
|
41
|
+
end
|
38
42
|
|
39
43
|
@bots = {}
|
40
|
-
attrs.bots
|
41
|
-
|
42
|
-
|
44
|
+
if attrs.bots
|
45
|
+
attrs.bots.each do |data|
|
46
|
+
@bots[data.id] = Models::Bot.new(data)
|
47
|
+
end
|
48
|
+
end
|
43
49
|
|
44
50
|
@groups = {}
|
45
|
-
attrs.groups
|
46
|
-
|
47
|
-
|
51
|
+
if attrs.groups
|
52
|
+
attrs.groups.each do |data|
|
53
|
+
@groups[data.id] = Models::Group.new(data)
|
54
|
+
end
|
55
|
+
end
|
48
56
|
|
49
57
|
@ims = {}
|
50
|
-
attrs.ims
|
51
|
-
|
52
|
-
|
58
|
+
if attrs.ims
|
59
|
+
attrs.ims.each do |data|
|
60
|
+
@ims[data.id] = Models::Im.new(data)
|
61
|
+
end
|
62
|
+
end
|
53
63
|
end
|
54
64
|
|
55
65
|
### RealTime Events
|
56
66
|
|
57
67
|
# The membership of an existing User Group has changed.
|
58
68
|
# @see https://api.slack.com/events/subteam_members_changed
|
59
|
-
# @see https://github.com/
|
69
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
|
60
70
|
# on :subteam_members_changed do |data|
|
61
71
|
|
62
72
|
# Subscribe to presence events for the specified users.
|
63
73
|
# @see https://api.slack.com/events/presence_sub
|
64
|
-
# @see https://github.com/
|
74
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_sub.json
|
65
75
|
# on :presence_sub do |data|
|
66
76
|
|
67
77
|
# A user left a public or private channel.
|
68
78
|
# @see https://api.slack.com/events/member_left_channel
|
69
|
-
# @see https://github.com/
|
79
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/member_left_channel.json
|
70
80
|
# on :member_left_channel do |data|
|
71
81
|
|
72
82
|
# A user joined a public or private channel.
|
73
83
|
# @see https://api.slack.com/events/member_joined_channel
|
74
|
-
# @see https://github.com/
|
84
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/member_joined_channel.json
|
75
85
|
# on :member_joined_channel do |data|
|
76
86
|
|
77
87
|
# The server intends to close the connection soon..
|
78
88
|
# @see https://api.slack.com/events/goodbye
|
79
|
-
# @see https://github.com/
|
89
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/goodbye.json
|
80
90
|
# on :goodbye do |data|
|
81
91
|
|
82
92
|
# Verifies ownership of an Events API Request URL.
|
83
93
|
# @see https://api.slack.com/events/url_verification
|
84
|
-
# @see https://github.com/
|
94
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/url_verification.json
|
85
95
|
# on :url_verification do |data|
|
86
96
|
|
87
97
|
# A message was posted in a multiparty direct message channel.
|
88
98
|
# @see https://api.slack.com/events/message.mpim
|
89
|
-
# @see https://github.com/
|
99
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.mpim.json
|
90
100
|
# on :message.mpim do |data|
|
91
101
|
|
92
102
|
# A message was posted in a direct message channel.
|
93
103
|
# @see https://api.slack.com/events/message.im
|
94
|
-
# @see https://github.com/
|
104
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.im.json
|
95
105
|
# on :message.im do |data|
|
96
106
|
|
97
107
|
# A message was posted to a private channel.
|
98
108
|
# @see https://api.slack.com/events/message.groups
|
99
|
-
# @see https://github.com/
|
109
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.groups.json
|
100
110
|
# on :message.groups do |data|
|
101
111
|
|
102
112
|
# A message was posted to a channel.
|
103
113
|
# @see https://api.slack.com/events/message.channels
|
104
|
-
# @see https://github.com/
|
114
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/message.channels.json
|
105
115
|
# on :message.channels do |data|
|
106
116
|
|
107
117
|
# A direct message read marker was updated.
|
108
118
|
# @see https://api.slack.com/events/im_marked
|
109
|
-
# @see https://github.com/
|
119
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_marked.json
|
110
120
|
# on :im_marked do |data|
|
111
121
|
|
112
122
|
# Bulk updates were made to a DM channel's history.
|
113
123
|
# @see https://api.slack.com/events/im_history_changed
|
114
|
-
# @see https://github.com/
|
124
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_history_changed.json
|
115
125
|
# on :im_history_changed do |data|
|
116
126
|
|
117
127
|
# The list of accounts a user is signed into has changed.
|
118
128
|
# @see https://api.slack.com/events/accounts_changed
|
119
|
-
# @see https://github.com/
|
129
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/accounts_changed.json
|
120
130
|
# on :accounts_changed do |data|
|
121
131
|
|
122
132
|
# An integration bot was added.
|
123
133
|
# @see https://api.slack.com/events/bot_added
|
124
|
-
# @see https://github.com/
|
134
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/bot_added.json
|
125
135
|
on :bot_added do |data|
|
126
136
|
bots[data.bot.id] = Models::Bot.new(data.bot)
|
127
137
|
end
|
128
138
|
|
129
139
|
# An integration bot was changed.
|
130
140
|
# @see https://api.slack.com/events/bot_changed
|
131
|
-
# @see https://github.com/
|
141
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/bot_changed.json
|
132
142
|
on :bot_changed do |data|
|
133
143
|
bot = bots[data.bot.id]
|
134
144
|
bot.merge!(data.bot) if bot
|
@@ -136,7 +146,7 @@ module Slack
|
|
136
146
|
|
137
147
|
# A team channel was archived.
|
138
148
|
# @see https://api.slack.com/events/channel_archive
|
139
|
-
# @see https://github.com/
|
149
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_archive.json
|
140
150
|
on :channel_archive do |data|
|
141
151
|
channel = channels[data.channel]
|
142
152
|
channel.is_archived = true if channel
|
@@ -144,7 +154,7 @@ module Slack
|
|
144
154
|
|
145
155
|
# A team channel was created.
|
146
156
|
# @see https://api.slack.com/events/channel_created
|
147
|
-
# @see https://github.com/
|
157
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_created.json
|
148
158
|
on :channel_created do |data|
|
149
159
|
channel = Models::Channel.new(data.channel)
|
150
160
|
channels[channel.id] = channel
|
@@ -152,19 +162,19 @@ module Slack
|
|
152
162
|
|
153
163
|
# A team channel was deleted.
|
154
164
|
# @see https://api.slack.com/events/channel_deleted
|
155
|
-
# @see https://github.com/
|
165
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_deleted.json
|
156
166
|
on :channel_deleted do |data|
|
157
167
|
channels.delete(data.channel)
|
158
168
|
end
|
159
169
|
|
160
170
|
# Bulk updates were made to a channel's history.
|
161
171
|
# @see https://api.slack.com/events/channel_history_changed
|
162
|
-
# @see https://github.com/
|
172
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_history_changed.json
|
163
173
|
# on :channel_history_changed do |data|
|
164
174
|
|
165
175
|
# You joined a channel.
|
166
176
|
# @see https://api.slack.com/events/channel_joined
|
167
|
-
# @see https://github.com/
|
177
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_joined.json
|
168
178
|
on :channel_joined do |data|
|
169
179
|
channel_id = data.channel.id
|
170
180
|
channel = channels[channel_id]
|
@@ -177,7 +187,7 @@ module Slack
|
|
177
187
|
|
178
188
|
# You left a channel.
|
179
189
|
# @see https://api.slack.com/events/channel_left
|
180
|
-
# @see https://github.com/
|
190
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_left.json
|
181
191
|
on :channel_left do |data|
|
182
192
|
channel = channels[data.channel]
|
183
193
|
channel.members.delete(self.self.id) if channel.key? :members
|
@@ -185,12 +195,12 @@ module Slack
|
|
185
195
|
|
186
196
|
# Your channel read marker was updated.
|
187
197
|
# @see https://api.slack.com/events/channel_marked
|
188
|
-
# @see https://github.com/
|
198
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_marked.json
|
189
199
|
# on :channel_marked do |data|
|
190
200
|
|
191
201
|
# A team channel was renamed.
|
192
202
|
# @see https://api.slack.com/events/channel_rename
|
193
|
-
# @see https://github.com/
|
203
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_rename.json
|
194
204
|
on :channel_rename do |data|
|
195
205
|
channel = channels[data.channel.id]
|
196
206
|
channel.name = data.channel.name if channel
|
@@ -198,7 +208,7 @@ module Slack
|
|
198
208
|
|
199
209
|
# A team channel was unarchived.
|
200
210
|
# @see https://api.slack.com/events/channel_unarchive
|
201
|
-
# @see https://github.com/
|
211
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/channel_unarchive.json
|
202
212
|
on :channel_unarchive do |data|
|
203
213
|
channel = channels[data.channel]
|
204
214
|
channel.is_archived = false if channel
|
@@ -206,84 +216,84 @@ module Slack
|
|
206
216
|
|
207
217
|
# A team slash command has been added or changed.
|
208
218
|
# @see https://api.slack.com/events/commands_changed
|
209
|
-
# @see https://github.com/
|
219
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/commands_changed.json
|
210
220
|
# on :commands_changed do |data|
|
211
221
|
|
212
222
|
# Do not Disturb settings changed for the current user.
|
213
223
|
# @see https://api.slack.com/events/dnd_updated
|
214
|
-
# @see https://github.com/
|
224
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/dnd_updated.json
|
215
225
|
# on :dnd_updated do |data|
|
216
226
|
|
217
227
|
# Do not Disturb settings changed for a team member.
|
218
228
|
# @see https://api.slack.com/events/dnd_updated_user
|
219
|
-
# @see https://github.com/
|
229
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/dnd_updated_user.json
|
220
230
|
# on :dnd_updated_user do |data|
|
221
231
|
|
222
232
|
# The team email domain has changed.
|
223
233
|
# @see https://api.slack.com/events/email_domain_changed
|
224
|
-
# @see https://github.com/
|
234
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/email_domain_changed.json
|
225
235
|
on :email_domain_changed do |data|
|
226
236
|
team.email_domain = data.email_domain
|
227
237
|
end
|
228
238
|
|
229
239
|
# A team custom emoji has been added or changed.
|
230
240
|
# @see https://api.slack.com/events/emoji_changed
|
231
|
-
# @see https://github.com/
|
241
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/emoji_changed.json
|
232
242
|
# on :emoji_changed do |data|
|
233
243
|
|
234
244
|
# A file was changed.
|
235
245
|
# @see https://api.slack.com/events/file_change
|
236
|
-
# @see https://github.com/
|
246
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_change.json
|
237
247
|
# on :file_change do |data|
|
238
248
|
|
239
249
|
# A file comment was added.
|
240
250
|
# @see https://api.slack.com/events/file_comment_added
|
241
|
-
# @see https://github.com/
|
251
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_added.json
|
242
252
|
# on :file_comment_added do |data| do
|
243
253
|
|
244
254
|
# A file comment was deleted.
|
245
255
|
# @see https://api.slack.com/events/file_comment_deleted
|
246
|
-
# @see https://github.com/
|
256
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_deleted.json
|
247
257
|
# on :file_comment_deleted do |data|
|
248
258
|
|
249
259
|
# A file comment was edited.
|
250
260
|
# @see https://api.slack.com/events/file_comment_edited
|
251
|
-
# @see https://github.com/
|
261
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_comment_edited.json
|
252
262
|
# on :file_comment_edited do |data|
|
253
263
|
|
254
264
|
# A file was created.
|
255
265
|
# @see https://api.slack.com/events/file_created
|
256
|
-
# @see https://github.com/
|
266
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_created.json
|
257
267
|
# on :file_created do |data|
|
258
268
|
|
259
269
|
# A file was deleted.
|
260
270
|
# @see https://api.slack.com/events/file_deleted
|
261
|
-
# @see https://github.com/
|
271
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_deleted.json
|
262
272
|
# on :file_deleted do |data|
|
263
273
|
|
264
274
|
# A file was made private.
|
265
275
|
# @see https://api.slack.com/events/file_private
|
266
|
-
# @see https://github.com/
|
276
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_private.json
|
267
277
|
# on :file_private do |data|
|
268
278
|
|
269
279
|
# A file was made public.
|
270
280
|
# @see https://api.slack.com/events/file_public
|
271
|
-
# @see https://github.com/
|
281
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_public.json
|
272
282
|
# on :file_public do |data|
|
273
283
|
|
274
284
|
# A file was shared.
|
275
285
|
# @see https://api.slack.com/events/file_shared
|
276
|
-
# @see https://github.com/
|
286
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_shared.json
|
277
287
|
# on :file_shared do |data|
|
278
288
|
|
279
289
|
# A file was unshared.
|
280
290
|
# @see https://api.slack.com/events/file_unshared
|
281
|
-
# @see https://github.com/
|
291
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/file_unshared.json
|
282
292
|
# on :file_unshared do |data|
|
283
293
|
|
284
294
|
# A private group was archived.
|
285
295
|
# @see https://api.slack.com/events/group_archive
|
286
|
-
# @see https://github.com/
|
296
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_archive.json
|
287
297
|
on :group_archive do |data|
|
288
298
|
channel = groups[data.channel]
|
289
299
|
channel.is_archived = true if channel
|
@@ -291,26 +301,26 @@ module Slack
|
|
291
301
|
|
292
302
|
# You closed a group channel.
|
293
303
|
# @see https://api.slack.com/events/group_close
|
294
|
-
# @see https://github.com/
|
304
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_close.json
|
295
305
|
on :group_close do |data|
|
296
306
|
groups[data.channel].is_open = false
|
297
307
|
end
|
298
308
|
|
299
309
|
# Bulk updates were made to a group's history.
|
300
310
|
# @see https://api.slack.com/events/group_history_changed
|
301
|
-
# @see https://github.com/
|
311
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_history_changed.json
|
302
312
|
# on :group_history_changed do |data|
|
303
313
|
|
304
314
|
# You joined a private group.
|
305
315
|
# @see https://api.slack.com/events/group_joined
|
306
|
-
# @see https://github.com/
|
316
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_joined.json
|
307
317
|
on :group_joined do |data|
|
308
318
|
groups[data.channel.id] = Models::Channel.new(data.channel)
|
309
319
|
end
|
310
320
|
|
311
321
|
# You left a private group.
|
312
322
|
# @see https://api.slack.com/events/group_left
|
313
|
-
# @see https://github.com/
|
323
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_left.json
|
314
324
|
on :group_left do |data|
|
315
325
|
channel = groups[data.channel]
|
316
326
|
channel.members.delete(self.self.id) if channel && channel.key?(:members)
|
@@ -318,19 +328,19 @@ module Slack
|
|
318
328
|
|
319
329
|
# A private group read marker was updated.
|
320
330
|
# @see https://api.slack.com/events/group_marked
|
321
|
-
# @see https://github.com/
|
331
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_marked.json
|
322
332
|
# on :group_marked do |data|
|
323
333
|
|
324
334
|
# You opened a group channel.
|
325
335
|
# @see https://api.slack.com/events/group_open
|
326
|
-
# @see https://github.com/
|
336
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_open.json
|
327
337
|
on :group_open do |data|
|
328
338
|
groups[data.channel].is_open = true
|
329
339
|
end
|
330
340
|
|
331
341
|
# A private group was renamed.
|
332
342
|
# @see https://api.slack.com/events/group_rename
|
333
|
-
# @see https://github.com/
|
343
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_rename.json
|
334
344
|
on :group_rename do |data|
|
335
345
|
channel = groups[data.channel.id]
|
336
346
|
channel.name = data.channel.name if channel
|
@@ -338,7 +348,7 @@ module Slack
|
|
338
348
|
|
339
349
|
# A private group was unarchived.
|
340
350
|
# @see https://api.slack.com/events/group_unarchive
|
341
|
-
# @see https://github.com/
|
351
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_unarchive.json
|
342
352
|
on :group_unarchive do |data|
|
343
353
|
channel = groups[data.channel]
|
344
354
|
channel.is_archived = false if channel
|
@@ -346,7 +356,7 @@ module Slack
|
|
346
356
|
|
347
357
|
# You closed a direct message channel.
|
348
358
|
# @see https://api.slack.com/events/im_close
|
349
|
-
# @see https://github.com/
|
359
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_close.json
|
350
360
|
on :im_close do |data|
|
351
361
|
return unless ims && ims.key?(data.channel)
|
352
362
|
ims[data.channel].is_open = false
|
@@ -354,24 +364,24 @@ module Slack
|
|
354
364
|
|
355
365
|
# A direct message channel was created.
|
356
366
|
# @see https://api.slack.com/events/im_created
|
357
|
-
# @see https://github.com/
|
367
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_created.json
|
358
368
|
on :im_created do |data|
|
359
369
|
ims[data.channel.id] = Models::Im.new(data.channel)
|
360
370
|
end
|
361
371
|
|
362
372
|
# Bulk updates were made to a DM channel's history.
|
363
373
|
# @see https://api.slack.com/events/im_history_changed
|
364
|
-
# @see https://github.com/
|
374
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_history_changed.json
|
365
375
|
# on :im_history_changed do |data|
|
366
376
|
|
367
377
|
# A direct message read marker was updated.
|
368
378
|
# @see https://api.slack.com/events/im_marked
|
369
|
-
# @see https://github.com/
|
379
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_marked.json
|
370
380
|
# on :im_marked do |data|
|
371
381
|
|
372
382
|
# You opened a direct message channel.
|
373
383
|
# @see https://api.slack.com/events/im_open
|
374
|
-
# @see https://github.com/
|
384
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/im_open.json
|
375
385
|
on :im_open do |data|
|
376
386
|
return unless ims && ims.key?(data.channel)
|
377
387
|
ims[data.channel].is_open = true
|
@@ -379,24 +389,24 @@ module Slack
|
|
379
389
|
|
380
390
|
# You manually updated your presence.
|
381
391
|
# @see https://api.slack.com/events/manual_presence_change
|
382
|
-
# @see https://github.com/
|
392
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/manual_presence_change.json
|
383
393
|
on :manual_presence_change do |data|
|
384
394
|
self.self.presence = data.presence
|
385
395
|
end
|
386
396
|
|
387
397
|
# A pin was added to a channel.
|
388
398
|
# @see https://api.slack.com/events/pin_added
|
389
|
-
# @see https://github.com/
|
399
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pin_added.json
|
390
400
|
# on :pin_added do |data|
|
391
401
|
|
392
402
|
# A pin was removed from a channel.
|
393
403
|
# @see https://api.slack.com/events/pin_removed
|
394
|
-
# @see https://github.com/
|
404
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pin_removed.json
|
395
405
|
# on :pin_removed do |data|
|
396
406
|
|
397
407
|
# You have updated your preferences.
|
398
408
|
# @see https://api.slack.com/events/pref_change
|
399
|
-
# @see https://github.com/
|
409
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/pref_change.json
|
400
410
|
on :pref_change do |data|
|
401
411
|
self.self.prefs ||= {}
|
402
412
|
self.self.prefs[data.name] = data.value
|
@@ -404,7 +414,7 @@ module Slack
|
|
404
414
|
|
405
415
|
# A team member's presence changed.
|
406
416
|
# @see https://api.slack.com/events/presence_change
|
407
|
-
# @see https://github.com/
|
417
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_change.json
|
408
418
|
on :presence_change do |data|
|
409
419
|
user = users[data.user]
|
410
420
|
user.presence = data.presence if user
|
@@ -412,52 +422,52 @@ module Slack
|
|
412
422
|
|
413
423
|
# A team member has added an emoji reaction to an item.
|
414
424
|
# @see https://api.slack.com/events/reaction_added
|
415
|
-
# @see https://github.com/
|
425
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reaction_added.json
|
416
426
|
# on :reaction_added do |data|
|
417
427
|
|
418
428
|
# A team member removed an emoji reaction.
|
419
429
|
# @see https://api.slack.com/events/reaction_removed
|
420
|
-
# @see https://github.com/
|
430
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reaction_removed.json
|
421
431
|
# on :reaction_removed do |data|
|
422
432
|
|
423
433
|
# Experimental.
|
424
434
|
# @see https://api.slack.com/events/reconnect_url
|
425
|
-
# @see https://github.com/
|
435
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/reconnect_url.json
|
426
436
|
# on :reconnect_url do |data|
|
427
437
|
|
428
438
|
# A team member has starred an item.
|
429
439
|
# @see https://api.slack.com/events/star_added
|
430
|
-
# @see https://github.com/
|
440
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_added.json
|
431
441
|
# on :star_added do |data|
|
432
442
|
|
433
443
|
# A team member removed a star.
|
434
444
|
# @see https://api.slack.com/events/star_removed
|
435
|
-
# @see https://github.com/
|
445
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/star_removed.json
|
436
446
|
# on :star_removed do |data|
|
437
447
|
|
438
448
|
# A user group has been added to the team.
|
439
449
|
# @see https://api.slack.com/events/subteam_created
|
440
|
-
# @see https://github.com/
|
450
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_created.json
|
441
451
|
# on :subteam_created do |data|
|
442
452
|
|
443
453
|
# You have been added to a user group.
|
444
454
|
# @see https://api.slack.com/events/subteam_self_added
|
445
|
-
# @see https://github.com/
|
455
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_self_added.json
|
446
456
|
# on :subteam_self_added do |data|
|
447
457
|
|
448
458
|
# You have been removed from a user group.
|
449
459
|
# @see https://api.slack.com/events/subteam_self_removed
|
450
|
-
# @see https://github.com/
|
460
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_self_removed.json
|
451
461
|
# on :subteam_self_removed do |data|
|
452
462
|
|
453
463
|
# An existing user group has been updated or its members changed.
|
454
464
|
# @see https://api.slack.com/events/subteam_updated
|
455
|
-
# @see https://github.com/
|
465
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_updated.json
|
456
466
|
# on :subteam_updated do |data|
|
457
467
|
|
458
468
|
# The team domain has changed.
|
459
469
|
# @see https://api.slack.com/events/team_domain_change
|
460
|
-
# @see https://github.com/
|
470
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_domain_change.json
|
461
471
|
on :team_domain_change do |data|
|
462
472
|
team.url = data.url
|
463
473
|
team.domain = data.domain
|
@@ -465,26 +475,26 @@ module Slack
|
|
465
475
|
|
466
476
|
# A new team member has joined.
|
467
477
|
# @see https://api.slack.com/events/team_join
|
468
|
-
# @see https://github.com/
|
478
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_join.json
|
469
479
|
on :team_join do |data|
|
470
480
|
users[data.user.id] = Models::User.new(data.user)
|
471
481
|
end
|
472
482
|
|
473
483
|
# The team is being migrated between servers.
|
474
484
|
# @see https://api.slack.com/events/team_migration_started
|
475
|
-
# @see https://github.com/
|
485
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_migration_started.json
|
476
486
|
# on :team_migration_started do |data|
|
477
487
|
|
478
488
|
# The team billing plan has changed.
|
479
489
|
# @see https://api.slack.com/events/team_plan_change
|
480
|
-
# @see https://github.com/
|
490
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_plan_change.json
|
481
491
|
on :team_plan_change do |data|
|
482
492
|
team.plan = data.plan
|
483
493
|
end
|
484
494
|
|
485
495
|
# A team preference has been updated.
|
486
496
|
# @see https://api.slack.com/events/team_pref_change
|
487
|
-
# @see https://github.com/
|
497
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_pref_change.json
|
488
498
|
on :team_pref_change do |data|
|
489
499
|
team.prefs ||= {}
|
490
500
|
team.prefs[data.name] = data.value
|
@@ -492,36 +502,36 @@ module Slack
|
|
492
502
|
|
493
503
|
# Team profile fields have been updated.
|
494
504
|
# @see https://api.slack.com/events/team_profile_change
|
495
|
-
# @see https://github.com/
|
505
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_change.json
|
496
506
|
# on :team_profile_change do |data|
|
497
507
|
|
498
508
|
# Team profile fields have been deleted.
|
499
509
|
# @see https://api.slack.com/events/team_profile_delete
|
500
|
-
# @see https://github.com/
|
510
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_delete.json
|
501
511
|
# on :team_profile_delete do |data|
|
502
512
|
|
503
513
|
# Team profile fields have been reordered.
|
504
514
|
# @see https://api.slack.com/events/team_profile_reorder
|
505
|
-
# @see https://github.com/
|
515
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_profile_reorder.json
|
506
516
|
# on :team_profile_reorder do |data|
|
507
517
|
|
508
518
|
# The team name has changed.
|
509
519
|
# @see https://api.slack.com/events/team_rename
|
510
|
-
# @see https://github.com/
|
520
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/team_rename.json
|
511
521
|
on :team_rename do |data|
|
512
522
|
team.name = data.name
|
513
523
|
end
|
514
524
|
|
515
525
|
# A team member's data has changed.
|
516
526
|
# @see https://api.slack.com/events/user_change
|
517
|
-
# @see https://github.com/
|
527
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/user_change.json
|
518
528
|
on :user_change do |data|
|
519
529
|
users[data.user.id] = Models::User.new(data.user)
|
520
530
|
end
|
521
531
|
|
522
532
|
# A channel member is typing a message.
|
523
533
|
# @see https://api.slack.com/events/user_typing
|
524
|
-
# @see https://github.com/
|
534
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/user_typing.json
|
525
535
|
# on :user_typing do |data|
|
526
536
|
end
|
527
537
|
end
|