slack-ruby-client 1.1.0 → 2.0.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.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/{integtest.yml → integration_test.yml} +6 -5
  3. data/.github/workflows/{rubocop.yml → lint.yml} +5 -4
  4. data/.github/workflows/{danger.yml → pr_lint.yml} +8 -6
  5. data/.github/workflows/test.yml +4 -2
  6. data/.gitignore +0 -1
  7. data/.rubocop.yml +4 -0
  8. data/.rubocop_todo.yml +8 -14
  9. data/.ruby-version +1 -0
  10. data/CHANGELOG.md +14 -0
  11. data/CONTRIBUTING.md +5 -4
  12. data/Gemfile +1 -6
  13. data/README.md +60 -63
  14. data/RELEASING.md +1 -1
  15. data/UPGRADING.md +28 -0
  16. data/bin/commands/admin_audit_anomaly_allow.rb +23 -0
  17. data/bin/commands/admin_conversations.rb +12 -11
  18. data/bin/commands/admin_users.rb +1 -1
  19. data/bin/commands/admin_users_session.rb +1 -1
  20. data/bin/commands/apps_connections.rb +2 -2
  21. data/bin/commands/bookmarks.rb +1 -0
  22. data/bin/commands/chat.rb +9 -6
  23. data/bin/commands/conversations.rb +8 -6
  24. data/bin/commands/files.rb +24 -0
  25. data/bin/commands/rtm.rb +0 -15
  26. data/bin/commands/views.rb +4 -2
  27. data/bin/commands.rb +1 -0
  28. data/bin/slack +1 -1
  29. data/lib/slack/real_time/api/message.rb +3 -2
  30. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  31. data/lib/slack/real_time/api/typing.rb +2 -1
  32. data/lib/slack/real_time/client.rb +8 -26
  33. data/lib/slack/real_time/config.rb +3 -3
  34. data/lib/slack/real_time/models/channel.rb +4 -0
  35. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  36. data/lib/slack/real_time/models.rb +2 -1
  37. data/lib/slack/real_time/stores/base.rb +25 -9
  38. data/lib/slack/real_time/stores/starter.rb +323 -309
  39. data/lib/slack/real_time/stores/store.rb +265 -198
  40. data/lib/slack/real_time/stores.rb +1 -7
  41. data/lib/slack/version.rb +1 -1
  42. data/lib/slack/web/api/endpoints/admin_analytics.rb +1 -1
  43. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  44. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +1 -1
  45. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  46. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  47. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  48. data/lib/slack/web/api/endpoints/admin_conversations.rb +30 -28
  49. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  50. data/lib/slack/web/api/endpoints/admin_emoji.rb +7 -7
  51. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  52. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  53. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  54. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  55. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  56. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  57. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  58. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  59. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  60. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  61. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  62. data/lib/slack/web/api/endpoints/apps_manifest.rb +6 -6
  63. data/lib/slack/web/api/endpoints/bookmarks.rb +10 -8
  64. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  65. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  66. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  67. data/lib/slack/web/api/endpoints/chat.rb +36 -30
  68. data/lib/slack/web/api/endpoints/conversations.rb +37 -33
  69. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  70. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  71. data/lib/slack/web/api/endpoints/files.rb +45 -8
  72. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  73. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  74. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  75. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  76. data/lib/slack/web/api/endpoints/pins.rb +3 -3
  77. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  78. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  79. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  80. data/lib/slack/web/api/endpoints/search.rb +3 -3
  81. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  82. data/lib/slack/web/api/endpoints/usergroups.rb +4 -4
  83. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  84. data/lib/slack/web/api/endpoints/users.rb +4 -4
  85. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  86. data/lib/slack/web/api/endpoints/views.rb +16 -11
  87. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  88. data/lib/slack/web/api/endpoints.rb +2 -0
  89. data/lib/slack/web/api/errors.rb +56 -6
  90. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  91. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  92. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  93. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  94. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  95. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  96. data/lib/slack/web/api/templates/method.erb +1 -1
  97. data/lib/slack/web/config.rb +2 -2
  98. data/lib/tasks/real_time.rake +44 -22
  99. data/lib/tasks/web.rake +9 -2
  100. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  101. data/spec/slack/events/config_spec.rb +2 -0
  102. data/spec/slack/events/request_spec.rb +4 -0
  103. data/spec/slack/messages/formatting_spec.rb +10 -0
  104. data/spec/slack/real_time/api/message_spec.rb +1 -1
  105. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  106. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  107. data/spec/slack/real_time/client_spec.rb +73 -111
  108. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  109. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  110. data/spec/slack/real_time/event_handlers/im_spec.rb +28 -25
  111. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  112. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +24 -20
  113. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  114. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  115. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  116. data/spec/slack/slack_spec.rb +1 -0
  117. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  118. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +17 -1
  119. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +2 -0
  120. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +13 -4
  121. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  122. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  123. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  124. data/spec/slack/web/api/pagination/cursor_spec.rb +4 -0
  125. data/spec/slack/web/client_spec.rb +14 -4
  126. data/spec/support/real_time/loaded_client.rb +120 -0
  127. metadata +18 -35
  128. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  129. data/bin/commands/apps_permissions.rb +0 -23
  130. data/bin/commands/apps_permissions_resources.rb +0 -15
  131. data/bin/commands/apps_permissions_scopes.rb +0 -13
  132. data/bin/commands/apps_permissions_users.rb +0 -26
  133. data/bin/commands/channels.rb +0 -23
  134. data/bin/commands/groups.rb +0 -14
  135. data/bin/commands/im.rb +0 -6
  136. data/bin/commands/mpim.rb +0 -6
  137. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  138. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  139. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  140. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  141. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  142. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  143. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  144. data/lib/slack/web/api/endpoints/im.rb +0 -13
  145. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  146. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  147. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  148. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  149. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  150. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  151. data/spec/slack/real_time/store_spec.rb +0 -12
@@ -24,7 +24,7 @@ module Slack
24
24
  # @see https://api.slack.com/methods/conversations.acceptSharedInvite
25
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.acceptSharedInvite.json
26
26
  def conversations_acceptSharedInvite(options = {})
27
- throw ArgumentError.new('Required arguments :channel_name missing') if options[:channel_name].nil?
27
+ raise ArgumentError, 'Required arguments :channel_name missing' if options[:channel_name].nil?
28
28
  post('conversations.acceptSharedInvite', options)
29
29
  end
30
30
 
@@ -38,7 +38,7 @@ module Slack
38
38
  # @see https://api.slack.com/methods/conversations.approveSharedInvite
39
39
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.approveSharedInvite.json
40
40
  def conversations_approveSharedInvite(options = {})
41
- throw ArgumentError.new('Required arguments :invite_id missing') if options[:invite_id].nil?
41
+ raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
42
42
  post('conversations.approveSharedInvite', options)
43
43
  end
44
44
 
@@ -50,7 +50,7 @@ module Slack
50
50
  # @see https://api.slack.com/methods/conversations.archive
51
51
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.archive.json
52
52
  def conversations_archive(options = {})
53
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
53
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
54
54
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
55
55
  post('conversations.archive', options)
56
56
  end
@@ -63,7 +63,7 @@ module Slack
63
63
  # @see https://api.slack.com/methods/conversations.close
64
64
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.close.json
65
65
  def conversations_close(options = {})
66
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
66
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
67
67
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
68
68
  post('conversations.close', options)
69
69
  end
@@ -80,7 +80,7 @@ module Slack
80
80
  # @see https://api.slack.com/methods/conversations.create
81
81
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
82
82
  def conversations_create(options = {})
83
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
83
+ raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
84
84
  post('conversations.create', options)
85
85
  end
86
86
 
@@ -94,7 +94,7 @@ module Slack
94
94
  # @see https://api.slack.com/methods/conversations.declineSharedInvite
95
95
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.declineSharedInvite.json
96
96
  def conversations_declineSharedInvite(options = {})
97
- throw ArgumentError.new('Required arguments :invite_id missing') if options[:invite_id].nil?
97
+ raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
98
98
  post('conversations.declineSharedInvite', options)
99
99
  end
100
100
 
@@ -105,18 +105,20 @@ module Slack
105
105
  # Conversation ID to fetch history for.
106
106
  # @option options [string] :cursor
107
107
  # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
108
+ # @option options [boolean] :include_all_metadata
109
+ # Return all metadata associated with this message.
108
110
  # @option options [boolean] :inclusive
109
- # Include messages with latest or oldest timestamp in results only when either timestamp is specified.
111
+ # Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.
110
112
  # @option options [timestamp] :latest
111
- # End of time range of messages to include in results. Default is the current time.
113
+ # Only messages before this Unix timestamp will be included in results. Default is the current time.
112
114
  # @option options [number] :limit
113
115
  # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
114
116
  # @option options [timestamp] :oldest
115
- # Start of time range of messages to include in results.
117
+ # Only messages after this Unix timestamp will be included in results.
116
118
  # @see https://api.slack.com/methods/conversations.history
117
119
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.history.json
118
120
  def conversations_history(options = {})
119
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
121
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
120
122
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
121
123
  if block_given?
122
124
  Pagination::Cursor.new(self, :conversations_history, options).each do |page|
@@ -139,7 +141,7 @@ module Slack
139
141
  # @see https://api.slack.com/methods/conversations.info
140
142
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.info.json
141
143
  def conversations_info(options = {})
142
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
144
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
143
145
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
144
146
  post('conversations.info', options)
145
147
  end
@@ -154,8 +156,8 @@ module Slack
154
156
  # @see https://api.slack.com/methods/conversations.invite
155
157
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
156
158
  def conversations_invite(options = {})
157
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
158
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
159
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
160
+ raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
159
161
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
160
162
  post('conversations.invite', options)
161
163
  end
@@ -174,7 +176,7 @@ module Slack
174
176
  # @see https://api.slack.com/methods/conversations.inviteShared
175
177
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.inviteShared.json
176
178
  def conversations_inviteShared(options = {})
177
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
179
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
178
180
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
179
181
  post('conversations.inviteShared', options)
180
182
  end
@@ -187,7 +189,7 @@ module Slack
187
189
  # @see https://api.slack.com/methods/conversations.join
188
190
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.join.json
189
191
  def conversations_join(options = {})
190
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
192
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
191
193
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
192
194
  post('conversations.join', options)
193
195
  end
@@ -202,8 +204,8 @@ module Slack
202
204
  # @see https://api.slack.com/methods/conversations.kick
203
205
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
204
206
  def conversations_kick(options = {})
205
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
206
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
207
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
208
+ raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
207
209
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
208
210
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
209
211
  post('conversations.kick', options)
@@ -217,7 +219,7 @@ module Slack
217
219
  # @see https://api.slack.com/methods/conversations.leave
218
220
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.leave.json
219
221
  def conversations_leave(options = {})
220
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
222
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
221
223
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
222
224
  post('conversations.leave', options)
223
225
  end
@@ -276,8 +278,8 @@ module Slack
276
278
  # @see https://api.slack.com/methods/conversations.mark
277
279
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.mark.json
278
280
  def conversations_mark(options = {})
279
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
280
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
281
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
282
+ raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
281
283
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
282
284
  post('conversations.mark', options)
283
285
  end
@@ -294,7 +296,7 @@ module Slack
294
296
  # @see https://api.slack.com/methods/conversations.members
295
297
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.members.json
296
298
  def conversations_members(options = {})
297
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
299
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
298
300
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
299
301
  if block_given?
300
302
  Pagination::Cursor.new(self, :conversations_members, options).each do |page|
@@ -333,8 +335,8 @@ module Slack
333
335
  # @see https://api.slack.com/methods/conversations.rename
334
336
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.rename.json
335
337
  def conversations_rename(options = {})
336
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
337
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
338
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
339
+ raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
338
340
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
339
341
  post('conversations.rename', options)
340
342
  end
@@ -348,19 +350,21 @@ module Slack
348
350
  # Unique identifier of either a thread's parent message or a message in the thread. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message.
349
351
  # @option options [string] :cursor
350
352
  # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
353
+ # @option options [boolean] :include_all_metadata
354
+ # Return all metadata associated with this message.
351
355
  # @option options [boolean] :inclusive
352
- # Include messages with latest or oldest timestamp in results only when either timestamp is specified.
356
+ # Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.
353
357
  # @option options [timestamp] :latest
354
- # End of time range of messages to include in results.
358
+ # Only messages before this Unix timestamp will be included in results.
355
359
  # @option options [number] :limit
356
360
  # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
357
361
  # @option options [timestamp] :oldest
358
- # Start of time range of messages to include in results.
362
+ # Only messages after this Unix timestamp will be included in results.
359
363
  # @see https://api.slack.com/methods/conversations.replies
360
364
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.replies.json
361
365
  def conversations_replies(options = {})
362
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
363
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
366
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
367
+ raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
364
368
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
365
369
  if block_given?
366
370
  Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
@@ -381,8 +385,8 @@ module Slack
381
385
  # @see https://api.slack.com/methods/conversations.setPurpose
382
386
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setPurpose.json
383
387
  def conversations_setPurpose(options = {})
384
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
385
- throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
388
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
389
+ raise ArgumentError, 'Required arguments :purpose missing' if options[:purpose].nil?
386
390
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
387
391
  post('conversations.setPurpose', options)
388
392
  end
@@ -397,8 +401,8 @@ module Slack
397
401
  # @see https://api.slack.com/methods/conversations.setTopic
398
402
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setTopic.json
399
403
  def conversations_setTopic(options = {})
400
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
401
- throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
404
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
405
+ raise ArgumentError, 'Required arguments :topic missing' if options[:topic].nil?
402
406
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
403
407
  post('conversations.setTopic', options)
404
408
  end
@@ -411,7 +415,7 @@ module Slack
411
415
  # @see https://api.slack.com/methods/conversations.unarchive
412
416
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.unarchive.json
413
417
  def conversations_unarchive(options = {})
414
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
418
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
415
419
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
416
420
  post('conversations.unarchive', options)
417
421
  end
@@ -16,8 +16,8 @@ module Slack
16
16
  # @see https://api.slack.com/methods/dialog.open
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dialog/dialog.open.json
18
18
  def dialog_open(options = {})
19
- throw ArgumentError.new('Required arguments :dialog missing') if options[:dialog].nil?
20
- throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
19
+ raise ArgumentError, 'Required arguments :dialog missing' if options[:dialog].nil?
20
+ raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil?
21
21
  # dialog must be passed as an encoded JSON string
22
22
  if options.key?(:dialog)
23
23
  dialog = options[:dialog]
@@ -59,7 +59,7 @@ module Slack
59
59
  # @see https://api.slack.com/methods/dnd.teamInfo
60
60
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
61
61
  def dnd_teamInfo(options = {})
62
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
62
+ raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
63
63
  post('dnd.teamInfo', options)
64
64
  end
65
65
  end
@@ -6,6 +6,24 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Files
9
+ #
10
+ # Finishes an upload started with files.getUploadURLExternal
11
+ #
12
+ # @option options [array] :files
13
+ # Array of file ids and their corresponding (optional) titles.
14
+ # @option options [Object] :channel_id
15
+ # Channel ID where the file will be shared. If not specified the file will be private.
16
+ # @option options [string] :initial_comment
17
+ # The message text introducing the file in specified channels.
18
+ # @option options [string] :thread_ts
19
+ # Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
20
+ # @see https://api.slack.com/methods/files.completeUploadExternal
21
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
22
+ def files_completeUploadExternal(options = {})
23
+ raise ArgumentError, 'Required arguments :files missing' if options[:files].nil?
24
+ post('files.completeUploadExternal', options)
25
+ end
26
+
9
27
  #
10
28
  # Deletes a file.
11
29
  #
@@ -14,7 +32,7 @@ module Slack
14
32
  # @see https://api.slack.com/methods/files.delete
15
33
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.delete.json
16
34
  def files_delete(options = {})
17
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
35
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
18
36
  post('files.delete', options)
19
37
  end
20
38
 
@@ -29,12 +47,31 @@ module Slack
29
47
  # New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types.
30
48
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json
31
49
  def files_edit(options = {})
32
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
33
- throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
50
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
51
+ raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
34
52
  logger.warn('The files.edit method is undocumented.')
35
53
  post('files.edit', options)
36
54
  end
37
55
 
56
+ #
57
+ # Gets a URL for an edge external file upload
58
+ #
59
+ # @option options [string] :filename
60
+ # Name of the file being uploaded.
61
+ # @option options [integer] :length
62
+ # Size in bytes of the file being uploaded.
63
+ # @option options [string] :alt_txt
64
+ # Description of image for screen-reader.
65
+ # @option options [string] :snippet_type
66
+ # Syntax type of the snippet being uploaded.
67
+ # @see https://api.slack.com/methods/files.getUploadURLExternal
68
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.getUploadURLExternal.json
69
+ def files_getUploadURLExternal(options = {})
70
+ raise ArgumentError, 'Required arguments :filename missing' if options[:filename].nil?
71
+ raise ArgumentError, 'Required arguments :length missing' if options[:length].nil?
72
+ post('files.getUploadURLExternal', options)
73
+ end
74
+
38
75
  #
39
76
  # Gets information about a file.
40
77
  #
@@ -47,7 +84,7 @@ module Slack
47
84
  # @see https://api.slack.com/methods/files.info
48
85
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
49
86
  def files_info(options = {})
50
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
87
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
51
88
  if block_given?
52
89
  Pagination::Cursor.new(self, :files_info, options).each do |page|
53
90
  yield page
@@ -92,7 +129,7 @@ module Slack
92
129
  # @see https://api.slack.com/methods/files.revokePublicURL
93
130
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json
94
131
  def files_revokePublicURL(options = {})
95
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
132
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
96
133
  post('files.revokePublicURL', options)
97
134
  end
98
135
 
@@ -105,8 +142,8 @@ module Slack
105
142
  # Channel to share the file in. Works with both public (channel ID) and private channels (group ID).
106
143
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json
107
144
  def files_share(options = {})
108
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
109
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
145
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
146
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
110
147
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
111
148
  logger.warn('The files.share method is undocumented.')
112
149
  post('files.share', options)
@@ -120,7 +157,7 @@ module Slack
120
157
  # @see https://api.slack.com/methods/files.sharedPublicURL
121
158
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json
122
159
  def files_sharedPublicURL(options = {})
123
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
160
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
124
161
  post('files.sharedPublicURL', options)
125
162
  end
126
163
 
@@ -16,8 +16,8 @@ module Slack
16
16
  # @see https://api.slack.com/methods/files.comments.delete
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.delete.json
18
18
  def files_comments_delete(options = {})
19
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
20
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
19
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
20
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
21
21
  post('files.comments.delete', options)
22
22
  end
23
23
  end
@@ -17,16 +17,16 @@ module Slack
17
17
  # Title of the file being shared.
18
18
  # @option options [string] :filetype
19
19
  # type of file.
20
- # @option options [string] :indexable_file_contents
20
+ # @option options [Object] :indexable_file_contents
21
21
  # A text file (txt, pdf, doc, etc.) containing textual search terms that are used to improve discovery of the remote file.
22
- # @option options [string] :preview_image
22
+ # @option options [Object] :preview_image
23
23
  # Preview of the document via multipart/form-data.
24
24
  # @see https://api.slack.com/methods/files.remote.add
25
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.remote/files.remote.add.json
26
26
  def files_remote_add(options = {})
27
- throw ArgumentError.new('Required arguments :external_id missing') if options[:external_id].nil?
28
- throw ArgumentError.new('Required arguments :external_url missing') if options[:external_url].nil?
29
- throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
27
+ raise ArgumentError, 'Required arguments :external_id missing' if options[:external_id].nil?
28
+ raise ArgumentError, 'Required arguments :external_url missing' if options[:external_url].nil?
29
+ raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
30
30
  post('files.remote.add', options)
31
31
  end
32
32
 
@@ -94,7 +94,7 @@ module Slack
94
94
  # @see https://api.slack.com/methods/files.remote.share
95
95
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.remote/files.remote.share.json
96
96
  def files_remote_share(options = {})
97
- throw ArgumentError.new('Required arguments :channels missing') if options[:channels].nil?
97
+ raise ArgumentError, 'Required arguments :channels missing' if options[:channels].nil?
98
98
  post('files.remote.share', options)
99
99
  end
100
100
 
@@ -109,9 +109,9 @@ module Slack
109
109
  # Specify a file by providing its ID.
110
110
  # @option options [string] :filetype
111
111
  # type of file.
112
- # @option options [string] :indexable_file_contents
112
+ # @option options [Object] :indexable_file_contents
113
113
  # File containing contents that can be used to improve searchability for the remote file.
114
- # @option options [string] :preview_image
114
+ # @option options [Object] :preview_image
115
115
  # Preview of the document via multipart/form-data.
116
116
  # @option options [string] :title
117
117
  # Title of the file being shared.
@@ -18,7 +18,7 @@ module Slack
18
18
  # @see https://api.slack.com/methods/migration.exchange
19
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/migration/migration.exchange.json
20
20
  def migration_exchange(options = {})
21
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
21
+ raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
22
22
  post('migration.exchange', options)
23
23
  end
24
24
  end
@@ -37,8 +37,8 @@ module Slack
37
37
  # @see https://api.slack.com/methods/oauth.v2.exchange
38
38
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth.v2/oauth.v2.exchange.json
39
39
  def oauth_v2_exchange(options = {})
40
- throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
41
- throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
40
+ raise ArgumentError, 'Required arguments :client_id missing' if options[:client_id].nil?
41
+ raise ArgumentError, 'Required arguments :client_secret missing' if options[:client_secret].nil?
42
42
  post('oauth.v2.exchange', options)
43
43
  end
44
44
  end
@@ -16,7 +16,7 @@ module Slack
16
16
  # @see https://api.slack.com/methods/pins.add
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.add.json
18
18
  def pins_add(options = {})
19
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
19
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
20
20
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
21
21
  post('pins.add', options)
22
22
  end
@@ -29,7 +29,7 @@ module Slack
29
29
  # @see https://api.slack.com/methods/pins.list
30
30
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.list.json
31
31
  def pins_list(options = {})
32
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
32
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
33
33
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
34
34
  post('pins.list', options)
35
35
  end
@@ -44,7 +44,7 @@ module Slack
44
44
  # @see https://api.slack.com/methods/pins.remove
45
45
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.remove.json
46
46
  def pins_remove(options = {})
47
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
47
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
48
48
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
49
49
  post('pins.remove', options)
50
50
  end
@@ -18,9 +18,9 @@ module Slack
18
18
  # @see https://api.slack.com/methods/reactions.add
19
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.add.json
20
20
  def reactions_add(options = {})
21
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
22
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
23
- throw ArgumentError.new('Required arguments :timestamp missing') if options[:timestamp].nil?
21
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
22
+ raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
23
+ raise ArgumentError, 'Required arguments :timestamp missing' if options[:timestamp].nil?
24
24
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
25
25
  post('reactions.add', options)
26
26
  end
@@ -87,7 +87,7 @@ module Slack
87
87
  # @see https://api.slack.com/methods/reactions.remove
88
88
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.remove.json
89
89
  def reactions_remove(options = {})
90
- throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
90
+ raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
91
91
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
92
92
  post('reactions.remove', options)
93
93
  end
@@ -22,8 +22,8 @@ module Slack
22
22
  # @see https://api.slack.com/methods/reminders.add
23
23
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.add.json
24
24
  def reminders_add(options = {})
25
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
26
- throw ArgumentError.new('Required arguments :time missing') if options[:time].nil?
25
+ raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
26
+ raise ArgumentError, 'Required arguments :time missing' if options[:time].nil?
27
27
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
28
28
  post('reminders.add', options)
29
29
  end
@@ -38,7 +38,7 @@ module Slack
38
38
  # @see https://api.slack.com/methods/reminders.complete
39
39
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.complete.json
40
40
  def reminders_complete(options = {})
41
- throw ArgumentError.new('Required arguments :reminder missing') if options[:reminder].nil?
41
+ raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
42
42
  post('reminders.complete', options)
43
43
  end
44
44
 
@@ -52,7 +52,7 @@ module Slack
52
52
  # @see https://api.slack.com/methods/reminders.delete
53
53
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.delete.json
54
54
  def reminders_delete(options = {})
55
- throw ArgumentError.new('Required arguments :reminder missing') if options[:reminder].nil?
55
+ raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
56
56
  post('reminders.delete', options)
57
57
  end
58
58
 
@@ -66,7 +66,7 @@ module Slack
66
66
  # @see https://api.slack.com/methods/reminders.info
67
67
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.info.json
68
68
  def reminders_info(options = {})
69
- throw ArgumentError.new('Required arguments :reminder missing') if options[:reminder].nil?
69
+ raise ArgumentError, 'Required arguments :reminder missing' if options[:reminder].nil?
70
70
  post('reminders.info', options)
71
71
  end
72
72
 
@@ -18,29 +18,6 @@ module Slack
18
18
  def rtm_connect(options = {})
19
19
  post('rtm.connect', options)
20
20
  end
21
-
22
- #
23
- # Deprecated: Starts a Real Time Messaging session. Use rtm.connect instead.
24
- #
25
- # @option options [boolean] :batch_presence_aware
26
- # Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.
27
- # @option options [boolean] :include_locale
28
- # Set this to true to receive the locale for users and channels. Defaults to false.
29
- # @option options [boolean] :mpim_aware
30
- # Returns MPIMs to the client in the API response.
31
- # @option options [boolean] :no_latest
32
- # Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.
33
- # @option options [boolean] :no_unreads
34
- # Skip unread counts for each channel (improves performance).
35
- # @option options [boolean] :presence_sub
36
- # Only deliver presence events when requested by subscription. See presence subscriptions.
37
- # @option options [boolean] :simple_latest
38
- # Return timestamp only for latest message object of each channel (improves performance).
39
- # @see https://api.slack.com/methods/rtm.start
40
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/rtm/rtm.start.json
41
- def rtm_start(options = {})
42
- post('rtm.start', options)
43
- end
44
21
  end
45
22
  end
46
23
  end
@@ -22,7 +22,7 @@ module Slack
22
22
  # @see https://api.slack.com/methods/search.all
23
23
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.all.json
24
24
  def search_all(options = {})
25
- throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
25
+ raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?
26
26
  post('search.all', options)
27
27
  end
28
28
 
@@ -42,7 +42,7 @@ module Slack
42
42
  # @see https://api.slack.com/methods/search.files
43
43
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.files.json
44
44
  def search_files(options = {})
45
- throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
45
+ raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?
46
46
  post('search.files', options)
47
47
  end
48
48
 
@@ -64,7 +64,7 @@ module Slack
64
64
  # @see https://api.slack.com/methods/search.messages
65
65
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.messages.json
66
66
  def search_messages(options = {})
67
- throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
67
+ raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?
68
68
  if block_given?
69
69
  Pagination::Cursor.new(self, :search_messages, options).each do |page|
70
70
  yield page
@@ -14,7 +14,7 @@ module Slack
14
14
  # @see https://api.slack.com/methods/tooling.tokens.rotate
15
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/tooling.tokens/tooling.tokens.rotate.json
16
16
  def tooling_tokens_rotate(options = {})
17
- throw ArgumentError.new('Required arguments :refresh_token missing') if options[:refresh_token].nil?
17
+ raise ArgumentError, 'Required arguments :refresh_token missing' if options[:refresh_token].nil?
18
18
  post('tooling.tokens.rotate', options)
19
19
  end
20
20
  end