slack-ruby-client 1.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/integration_test.yml +45 -0
  4. data/.github/workflows/lint.yml +14 -0
  5. data/.github/workflows/pr_lint.yml +21 -0
  6. data/.github/workflows/test.yml +37 -0
  7. data/.gitignore +4 -3
  8. data/.rubocop.yml +6 -1
  9. data/.rubocop_todo.yml +88 -34
  10. data/.ruby-version +1 -0
  11. data/CHANGELOG.md +36 -0
  12. data/CONTRIBUTING.md +6 -5
  13. data/Gemfile +13 -1
  14. data/Gemfile.danger +6 -0
  15. data/README.md +78 -76
  16. data/RELEASING.md +2 -2
  17. data/SECURITY.md +9 -0
  18. data/UPGRADING.md +28 -0
  19. data/bin/commands/admin_analytics.rb +16 -10
  20. data/bin/commands/admin_apps.rb +48 -42
  21. data/bin/commands/admin_apps_approved.rb +17 -11
  22. data/bin/commands/admin_apps_requests.rb +28 -11
  23. data/bin/commands/admin_apps_restricted.rb +17 -11
  24. data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
  25. data/bin/commands/admin_auth_policy.rb +37 -31
  26. data/bin/commands/admin_barriers.rb +44 -38
  27. data/bin/commands/admin_conversations.rb +221 -163
  28. data/bin/commands/admin_conversations_ekm.rb +17 -11
  29. data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
  30. data/bin/commands/admin_emoji.rb +50 -44
  31. data/bin/commands/admin_inviteRequests.rb +34 -28
  32. data/bin/commands/admin_inviteRequests_approved.rb +16 -10
  33. data/bin/commands/admin_inviteRequests_denied.rb +16 -10
  34. data/bin/commands/admin_roles.rb +46 -0
  35. data/bin/commands/admin_teams.rb +26 -20
  36. data/bin/commands/admin_teams_admins.rb +16 -10
  37. data/bin/commands/admin_teams_owners.rb +16 -10
  38. data/bin/commands/admin_teams_settings.rb +59 -53
  39. data/bin/commands/admin_usergroups.rb +45 -39
  40. data/bin/commands/admin_users.rb +91 -85
  41. data/bin/commands/admin_users_session.rb +72 -66
  42. data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
  43. data/bin/commands/api.rb +14 -8
  44. data/bin/commands/apps.rb +15 -9
  45. data/bin/commands/apps_connections.rb +13 -7
  46. data/bin/commands/apps_event_authorizations.rb +16 -10
  47. data/bin/commands/apps_manifest.rb +48 -41
  48. data/bin/commands/auth.rb +21 -15
  49. data/bin/commands/auth_teams.rb +16 -10
  50. data/bin/commands/bookmarks.rb +59 -0
  51. data/bin/commands/bots.rb +15 -9
  52. data/bin/commands/calls.rb +49 -43
  53. data/bin/commands/calls_participants.rb +24 -18
  54. data/bin/commands/chat.rb +150 -141
  55. data/bin/commands/chat_scheduledMessages.rb +19 -13
  56. data/bin/commands/conversations.rb +233 -225
  57. data/bin/commands/dialog.rb +15 -9
  58. data/bin/commands/dnd.rb +46 -40
  59. data/bin/commands/emoji.rb +14 -7
  60. data/bin/commands/files.rb +112 -83
  61. data/bin/commands/files_comments.rb +15 -9
  62. data/bin/commands/files_remote.rb +73 -67
  63. data/bin/commands/functions_workflows_steps.rb +22 -0
  64. data/bin/commands/functions_workflows_steps_responses.rb +22 -0
  65. data/bin/commands/migration.rb +16 -10
  66. data/bin/commands/oauth.rb +18 -12
  67. data/bin/commands/oauth_v2.rb +28 -22
  68. data/bin/commands/openid_connect.rb +26 -20
  69. data/bin/commands/pins.rb +33 -26
  70. data/bin/commands/reactions.rb +52 -46
  71. data/bin/commands/reminders.rb +53 -47
  72. data/bin/commands/rtm.rb +15 -24
  73. data/bin/commands/search.rb +43 -37
  74. data/bin/commands/stars.rb +38 -32
  75. data/bin/commands/team.rb +47 -38
  76. data/bin/commands/team_billing.rb +13 -7
  77. data/bin/commands/team_preferences.rb +13 -7
  78. data/bin/commands/team_profile.rb +14 -8
  79. data/bin/commands/tooling_tokens.rb +14 -8
  80. data/bin/commands/usergroups.rb +64 -58
  81. data/bin/commands/usergroups_users.rb +27 -21
  82. data/bin/commands/users.rb +111 -105
  83. data/bin/commands/users_admin.rb +28 -22
  84. data/bin/commands/users_prefs.rb +13 -7
  85. data/bin/commands/users_profile.rb +26 -20
  86. data/bin/commands/views.rb +47 -39
  87. data/bin/commands/workflows.rb +36 -30
  88. data/bin/slack +48 -43
  89. data/lib/slack/real_time/api/message.rb +3 -2
  90. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  91. data/lib/slack/real_time/api/typing.rb +2 -1
  92. data/lib/slack/real_time/client.rb +10 -28
  93. data/lib/slack/real_time/config.rb +3 -3
  94. data/lib/slack/real_time/models/channel.rb +4 -0
  95. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  96. data/lib/slack/real_time/models.rb +2 -1
  97. data/lib/slack/real_time/stores/base.rb +25 -9
  98. data/lib/slack/real_time/stores/starter.rb +323 -309
  99. data/lib/slack/real_time/stores/store.rb +265 -198
  100. data/lib/slack/real_time/stores.rb +1 -7
  101. data/lib/slack/version.rb +1 -1
  102. data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
  103. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  104. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
  105. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  106. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  107. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  108. data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
  109. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  110. data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
  111. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  112. data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
  113. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  114. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  115. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  116. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  117. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  118. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  119. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  120. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
  121. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  122. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  123. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  124. data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
  125. data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
  126. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  127. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  128. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  129. data/lib/slack/web/api/endpoints/chat.rb +37 -31
  130. data/lib/slack/web/api/endpoints/conversations.rb +38 -34
  131. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  132. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  133. data/lib/slack/web/api/endpoints/emoji.rb +2 -0
  134. data/lib/slack/web/api/endpoints/files.rb +45 -10
  135. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  136. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  137. data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
  138. data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
  139. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  140. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  141. data/lib/slack/web/api/endpoints/pins.rb +5 -3
  142. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  143. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  144. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  145. data/lib/slack/web/api/endpoints/search.rb +3 -3
  146. data/lib/slack/web/api/endpoints/team.rb +13 -1
  147. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  148. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  149. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  150. data/lib/slack/web/api/endpoints/users.rb +4 -4
  151. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  152. data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
  153. data/lib/slack/web/api/endpoints/views.rb +16 -11
  154. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  155. data/lib/slack/web/api/endpoints.rb +12 -0
  156. data/lib/slack/web/api/errors.rb +146 -8
  157. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  158. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  159. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  160. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  161. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  162. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  163. data/lib/slack/web/api/templates/command.erb +18 -12
  164. data/lib/slack/web/api/templates/method.erb +1 -1
  165. data/lib/slack/web/config.rb +2 -2
  166. data/lib/slack/web/faraday/connection.rb +4 -4
  167. data/lib/slack/web/faraday/request.rb +2 -0
  168. data/lib/slack/web/faraday/response/raise_error.rb +2 -10
  169. data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
  170. data/lib/slack-ruby-client.rb +2 -1
  171. data/lib/tasks/real_time.rake +44 -24
  172. data/lib/tasks/web.rake +9 -8
  173. data/slack-ruby-client.gemspec +5 -14
  174. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  175. data/spec/integration/integration_spec.rb +1 -1
  176. data/spec/slack/events/config_spec.rb +2 -0
  177. data/spec/slack/events/request_spec.rb +5 -1
  178. data/spec/slack/messages/formatting_spec.rb +10 -0
  179. data/spec/slack/real_time/api/message_spec.rb +1 -1
  180. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  181. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  182. data/spec/slack/real_time/client_spec.rb +91 -127
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  184. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  185. data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
  186. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  187. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
  188. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  189. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  190. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  191. data/spec/slack/slack_spec.rb +5 -4
  192. data/spec/slack/version_spec.rb +1 -1
  193. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
  194. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  195. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
  196. data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
  197. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
  198. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
  199. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
  200. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
  201. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
  202. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  203. data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
  204. data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
  205. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  206. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  207. data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
  208. data/spec/slack/web/client_spec.rb +39 -11
  209. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
  210. data/spec/support/real_time/connected_client.rb +1 -1
  211. data/spec/support/real_time/loaded_client.rb +120 -0
  212. metadata +45 -197
  213. data/.travis.yml +0 -29
  214. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  215. data/bin/commands/apps_permissions.rb +0 -23
  216. data/bin/commands/apps_permissions_resources.rb +0 -15
  217. data/bin/commands/apps_permissions_scopes.rb +0 -13
  218. data/bin/commands/apps_permissions_users.rb +0 -26
  219. data/bin/commands/channels.rb +0 -23
  220. data/bin/commands/groups.rb +0 -14
  221. data/bin/commands/im.rb +0 -6
  222. data/bin/commands/mpim.rb +0 -6
  223. data/bin/commands.rb +0 -66
  224. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  225. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  226. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  227. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  228. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  229. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  230. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  231. data/lib/slack/web/api/endpoints/im.rb +0 -13
  232. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  233. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  234. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  235. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  236. data/lib/slack/web/api/templates/commands.erb +0 -6
  237. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  238. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  239. data/spec/slack/real_time/store_spec.rb +0 -12
@@ -16,8 +16,8 @@ module Slack
16
16
  # @see https://api.slack.com/methods/calls.participants.add
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.add.json
18
18
  def calls_participants_add(options = {})
19
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
20
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
19
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
20
+ raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
21
21
  post('calls.participants.add', options)
22
22
  end
23
23
 
@@ -31,8 +31,8 @@ module Slack
31
31
  # @see https://api.slack.com/methods/calls.participants.remove
32
32
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.remove.json
33
33
  def calls_participants_remove(options = {})
34
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
35
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
34
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
35
+ raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
36
36
  post('calls.participants.remove', options)
37
37
  end
38
38
  end
@@ -17,8 +17,8 @@ module Slack
17
17
  # Additional parameters provided to the slash command.
18
18
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/chat/chat.command.json
19
19
  def chat_command(options = {})
20
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
21
- throw ArgumentError.new('Required arguments :command missing') if options[:command].nil?
20
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
21
+ raise ArgumentError, 'Required arguments :command missing' if options[:command].nil?
22
22
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
23
23
  logger.warn('The chat.command method is undocumented.')
24
24
  post('chat.command', options)
@@ -36,8 +36,8 @@ module Slack
36
36
  # @see https://api.slack.com/methods/chat.delete
37
37
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.delete.json
38
38
  def chat_delete(options = {})
39
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
40
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
39
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
40
+ raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
41
41
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
42
42
  post('chat.delete', options)
43
43
  end
@@ -54,8 +54,8 @@ module Slack
54
54
  # @see https://api.slack.com/methods/chat.deleteScheduledMessage
55
55
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.deleteScheduledMessage.json
56
56
  def chat_deleteScheduledMessage(options = {})
57
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
58
- throw ArgumentError.new('Required arguments :scheduled_message_id missing') if options[:scheduled_message_id].nil?
57
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
58
+ raise ArgumentError, 'Required arguments :scheduled_message_id missing' if options[:scheduled_message_id].nil?
59
59
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
60
60
  post('chat.deleteScheduledMessage', options)
61
61
  end
@@ -70,8 +70,8 @@ module Slack
70
70
  # @see https://api.slack.com/methods/chat.getPermalink
71
71
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.getPermalink.json
72
72
  def chat_getPermalink(options = {})
73
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
74
- throw ArgumentError.new('Required arguments :message_ts missing') if options[:message_ts].nil?
73
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
74
+ raise ArgumentError, 'Required arguments :message_ts missing' if options[:message_ts].nil?
75
75
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
76
76
  post('chat.getPermalink', options)
77
77
  end
@@ -86,8 +86,8 @@ module Slack
86
86
  # @see https://api.slack.com/methods/chat.meMessage
87
87
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.meMessage.json
88
88
  def chat_meMessage(options = {})
89
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
90
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
89
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
90
+ raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
91
91
  post('chat.meMessage', options)
92
92
  end
93
93
 
@@ -101,7 +101,7 @@ module Slack
101
101
  # @option options [user] :user
102
102
  # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
103
103
  # @option options [boolean] :as_user
104
- # Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.
104
+ # (Legacy) Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.
105
105
  # @option options [string] :attachments
106
106
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
107
107
  # @option options [blocks[] as string] :blocks
@@ -121,9 +121,9 @@ module Slack
121
121
  # @see https://api.slack.com/methods/chat.postEphemeral
122
122
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
123
123
  def chat_postEphemeral(options = {})
124
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
125
- throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
126
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
124
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
125
+ raise ArgumentError, 'Required arguments :text, :attachments or :blocks missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
126
+ raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
127
127
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
128
128
  # attachments must be passed as an encoded JSON string
129
129
  if options.key?(:attachments)
@@ -152,17 +152,19 @@ module Slack
152
152
  # @option options [string] :text
153
153
  # The formatted text of the message to be published. If blocks are included, this will become the fallback text used in notifications.
154
154
  # @option options [boolean] :as_user
155
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
155
+ # (Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below.
156
156
  # @option options [string] :icon_emoji
157
157
  # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
158
158
  # @option options [string] :icon_url
159
159
  # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
160
160
  # @option options [boolean] :link_names
161
- # Find and link channel names and usernames.
161
+ # Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.
162
+ # @option options [string] :metadata
163
+ # JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
162
164
  # @option options [boolean] :mrkdwn
163
165
  # Disable Slack markup parsing by setting to false. Enabled by default.
164
166
  # @option options [string] :parse
165
- # Change how messages are treated. Defaults to none. See below.
167
+ # Change how messages are treated. See below.
166
168
  # @option options [boolean] :reply_broadcast
167
169
  # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
168
170
  # @option options [string] :thread_ts
@@ -176,8 +178,8 @@ module Slack
176
178
  # @see https://api.slack.com/methods/chat.postMessage
177
179
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
178
180
  def chat_postMessage(options = {})
179
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
180
- throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
181
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
182
+ raise ArgumentError, 'Required arguments :text, :attachments or :blocks missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
181
183
  # attachments must be passed as an encoded JSON string
182
184
  if options.key?(:attachments)
183
185
  attachments = options[:attachments]
@@ -203,15 +205,17 @@ module Slack
203
205
  # @option options [string] :text
204
206
  # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
205
207
  # @option options [boolean] :as_user
206
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.
208
+ # Set to true to post the message as the authed user, instead of as a bot. Defaults to false. Cannot be used by new Slack apps. See chat.postMessage.
207
209
  # @option options [string] :attachments
208
210
  # A JSON-based array of structured attachments, presented as a URL-encoded string.
209
211
  # @option options [blocks[] as string] :blocks
210
212
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
211
213
  # @option options [boolean] :link_names
212
- # Find and link channel names and usernames.
214
+ # Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.
215
+ # @option options [string] :metadata
216
+ # JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
213
217
  # @option options [string] :parse
214
- # Change how messages are treated. Defaults to none. See chat.postMessage.
218
+ # Change how messages are treated. See chat.postMessage.
215
219
  # @option options [boolean] :reply_broadcast
216
220
  # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
217
221
  # @option options [string] :thread_ts
@@ -223,9 +227,9 @@ module Slack
223
227
  # @see https://api.slack.com/methods/chat.scheduleMessage
224
228
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.scheduleMessage.json
225
229
  def chat_scheduleMessage(options = {})
226
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
227
- throw ArgumentError.new('Required arguments :post_at missing') if options[:post_at].nil?
228
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
230
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
231
+ raise ArgumentError, 'Required arguments :post_at missing' if options[:post_at].nil?
232
+ raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
229
233
  post('chat.scheduleMessage', options)
230
234
  end
231
235
 
@@ -253,9 +257,9 @@ module Slack
253
257
  # @see https://api.slack.com/methods/chat.unfurl
254
258
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.unfurl.json
255
259
  def chat_unfurl(options = {})
256
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
257
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
258
- throw ArgumentError.new('Required arguments :unfurls missing') if options[:unfurls].nil?
260
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
261
+ raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
262
+ raise ArgumentError, 'Required arguments :unfurls missing' if options[:unfurls].nil?
259
263
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
260
264
  post('chat.unfurl', options)
261
265
  end
@@ -277,6 +281,8 @@ module Slack
277
281
  # Array of new file ids that will be sent with this message.
278
282
  # @option options [boolean] :link_names
279
283
  # Find and link channel names and usernames. Defaults to none. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, none.
284
+ # @option options [string] :metadata
285
+ # JSON object with event_type and event_payload fields, presented as a URL-encoded string. If you don't include this field, the message's previous metadata will be retained. To remove previous metadata, include an empty object for this field. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
280
286
  # @option options [string] :parse
281
287
  # Change how messages are treated. Defaults to client, unlike chat.postMessage. Accepts either none or full. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, client.
282
288
  # @option options [boolean] :reply_broadcast
@@ -286,9 +292,9 @@ module Slack
286
292
  # @see https://api.slack.com/methods/chat.update
287
293
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
288
294
  def chat_update(options = {})
289
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
290
- throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
291
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
295
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
296
+ raise ArgumentError, 'Required arguments :text, :attachments, :blocks or :reply_broadcast missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? && options[:reply_broadcast].nil?
297
+ raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
292
298
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
293
299
  # attachments must be passed as an encoded JSON string
294
300
  if options.key?(:attachments)
@@ -19,12 +19,12 @@ module Slack
19
19
  # See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.
20
20
  # @option options [boolean] :is_private
21
21
  # Whether the channel should be private.
22
- # @option options [string] :team_id
22
+ # @option options [Object] :team_id
23
23
  # The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.
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
@@ -9,6 +9,8 @@ module Slack
9
9
  #
10
10
  # Lists custom emoji for a team.
11
11
  #
12
+ # @option options [boolean] :include_categories
13
+ # Include a list of categories for Unicode emoji and the emoji in each category.
12
14
  # @see https://api.slack.com/methods/emoji.list
13
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/emoji/emoji.list.json
14
16
  def emoji_list(options = {})
@@ -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
@@ -62,8 +99,6 @@ module Slack
62
99
  #
63
100
  # @option options [channel] :channel
64
101
  # Filter files appearing in a specific channel, indicated by its ID.
65
- # @option options [string] :files
66
- # .
67
102
  # @option options [boolean] :show_files_hidden_by_limit
68
103
  # Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.
69
104
  # @option options [string] :team_id
@@ -92,7 +127,7 @@ module Slack
92
127
  # @see https://api.slack.com/methods/files.revokePublicURL
93
128
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json
94
129
  def files_revokePublicURL(options = {})
95
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
130
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
96
131
  post('files.revokePublicURL', options)
97
132
  end
98
133
 
@@ -105,8 +140,8 @@ module Slack
105
140
  # Channel to share the file in. Works with both public (channel ID) and private channels (group ID).
106
141
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json
107
142
  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?
143
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
144
+ raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
110
145
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
111
146
  logger.warn('The files.share method is undocumented.')
112
147
  post('files.share', options)
@@ -120,7 +155,7 @@ module Slack
120
155
  # @see https://api.slack.com/methods/files.sharedPublicURL
121
156
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json
122
157
  def files_sharedPublicURL(options = {})
123
- throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
158
+ raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
124
159
  post('files.sharedPublicURL', options)
125
160
  end
126
161
 
@@ -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