slack-ruby-client 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -22,8 +22,8 @@ module Slack
22
22
  # @see https://api.slack.com/methods/admin.users.assign
23
23
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.assign.json
24
24
  def admin_users_assign(options = {})
25
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
26
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
25
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
26
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
27
27
  post('admin.users.assign', options)
28
28
  end
29
29
 
@@ -53,9 +53,9 @@ module Slack
53
53
  # @see https://api.slack.com/methods/admin.users.invite
54
54
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.invite.json
55
55
  def admin_users_invite(options = {})
56
- throw ArgumentError.new('Required arguments :channel_ids missing') if options[:channel_ids].nil?
57
- throw ArgumentError.new('Required arguments :email missing') if options[:email].nil?
58
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
56
+ raise ArgumentError, 'Required arguments :channel_ids missing' if options[:channel_ids].nil?
57
+ raise ArgumentError, 'Required arguments :email missing' if options[:email].nil?
58
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
59
59
  post('admin.users.invite', options)
60
60
  end
61
61
 
@@ -67,7 +67,7 @@ module Slack
67
67
  # @option options [integer] :limit
68
68
  # Limit for how many users to be retrieved per page.
69
69
  # @option options [Object] :team_id
70
- # The ID (T1234) of the workspace.
70
+ # The ID (T1234) of the workspace. The team_id is required if you use an org-level token.
71
71
  # @see https://api.slack.com/methods/admin.users.list
72
72
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.list.json
73
73
  def admin_users_list(options = {})
@@ -90,8 +90,8 @@ module Slack
90
90
  # @see https://api.slack.com/methods/admin.users.remove
91
91
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.remove.json
92
92
  def admin_users_remove(options = {})
93
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
94
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
93
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
94
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
95
95
  post('admin.users.remove', options)
96
96
  end
97
97
 
@@ -105,8 +105,8 @@ module Slack
105
105
  # @see https://api.slack.com/methods/admin.users.setAdmin
106
106
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setAdmin.json
107
107
  def admin_users_setAdmin(options = {})
108
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
109
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
108
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
109
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
110
110
  post('admin.users.setAdmin', options)
111
111
  end
112
112
 
@@ -122,8 +122,8 @@ module Slack
122
122
  # @see https://api.slack.com/methods/admin.users.setExpiration
123
123
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setExpiration.json
124
124
  def admin_users_setExpiration(options = {})
125
- throw ArgumentError.new('Required arguments :expiration_ts missing') if options[:expiration_ts].nil?
126
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
125
+ raise ArgumentError, 'Required arguments :expiration_ts missing' if options[:expiration_ts].nil?
126
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
127
127
  post('admin.users.setExpiration', options)
128
128
  end
129
129
 
@@ -137,8 +137,8 @@ module Slack
137
137
  # @see https://api.slack.com/methods/admin.users.setOwner
138
138
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setOwner.json
139
139
  def admin_users_setOwner(options = {})
140
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
141
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
140
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
141
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
142
142
  post('admin.users.setOwner', options)
143
143
  end
144
144
 
@@ -152,8 +152,8 @@ module Slack
152
152
  # @see https://api.slack.com/methods/admin.users.setRegular
153
153
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setRegular.json
154
154
  def admin_users_setRegular(options = {})
155
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
156
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
155
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
156
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
157
157
  post('admin.users.setRegular', options)
158
158
  end
159
159
  end
@@ -14,7 +14,7 @@ module Slack
14
14
  # @see https://api.slack.com/methods/admin.users.session.clearSettings
15
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.clearSettings.json
16
16
  def admin_users_session_clearSettings(options = {})
17
- throw ArgumentError.new('Required arguments :user_ids missing') if options[:user_ids].nil?
17
+ raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
18
18
  post('admin.users.session.clearSettings', options)
19
19
  end
20
20
 
@@ -26,7 +26,7 @@ module Slack
26
26
  # @see https://api.slack.com/methods/admin.users.session.getSettings
27
27
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.getSettings.json
28
28
  def admin_users_session_getSettings(options = {})
29
- throw ArgumentError.new('Required arguments :user_ids missing') if options[:user_ids].nil?
29
+ raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
30
30
  post('admin.users.session.getSettings', options)
31
31
  end
32
32
 
@@ -40,8 +40,8 @@ module Slack
40
40
  # @see https://api.slack.com/methods/admin.users.session.invalidate
41
41
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.invalidate.json
42
42
  def admin_users_session_invalidate(options = {})
43
- throw ArgumentError.new('Required arguments :session_id missing') if options[:session_id].nil?
44
- throw ArgumentError.new('Required arguments :team_id missing') if options[:team_id].nil?
43
+ raise ArgumentError, 'Required arguments :session_id missing' if options[:session_id].nil?
44
+ raise ArgumentError, 'Required arguments :team_id missing' if options[:team_id].nil?
45
45
  post('admin.users.session.invalidate', options)
46
46
  end
47
47
 
@@ -80,7 +80,7 @@ module Slack
80
80
  # @see https://api.slack.com/methods/admin.users.session.reset
81
81
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.reset.json
82
82
  def admin_users_session_reset(options = {})
83
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
83
+ raise ArgumentError, 'Required arguments :user_id missing' if options[:user_id].nil?
84
84
  post('admin.users.session.reset', options)
85
85
  end
86
86
 
@@ -96,7 +96,7 @@ module Slack
96
96
  # @see https://api.slack.com/methods/admin.users.session.resetBulk
97
97
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.resetBulk.json
98
98
  def admin_users_session_resetBulk(options = {})
99
- throw ArgumentError.new('Required arguments :user_ids missing') if options[:user_ids].nil?
99
+ raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
100
100
  post('admin.users.session.resetBulk', options)
101
101
  end
102
102
 
@@ -104,7 +104,7 @@ module Slack
104
104
  # Configure the user-level session settings—the session duration and what happens when the client closes—for one or more users.
105
105
  #
106
106
  # @option options [array] :user_ids
107
- # The list of user IDs to apply the session settings for.
107
+ # The list of up to 1,000 user IDs to apply the session settings for.
108
108
  # @option options [boolean] :desktop_app_browser_quit
109
109
  # Terminate the session when the client—either the desktop app or a browser window—is closed.
110
110
  # @option options [integer] :duration
@@ -112,7 +112,7 @@ module Slack
112
112
  # @see https://api.slack.com/methods/admin.users.session.setSettings
113
113
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users.session/admin.users.session.setSettings.json
114
114
  def admin_users_session_setSettings(options = {})
115
- throw ArgumentError.new('Required arguments :user_ids missing') if options[:user_ids].nil?
115
+ raise ArgumentError, 'Required arguments :user_ids missing' if options[:user_ids].nil?
116
116
  post('admin.users.session.setSettings', options)
117
117
  end
118
118
  end
@@ -16,8 +16,8 @@ module Slack
16
16
  # @see https://api.slack.com/methods/apps.uninstall
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps/apps.uninstall.json
18
18
  def apps_uninstall(options = {})
19
- throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
20
- throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
19
+ raise ArgumentError, 'Required arguments :client_id missing' if options[:client_id].nil?
20
+ raise ArgumentError, 'Required arguments :client_secret missing' if options[:client_secret].nil?
21
21
  post('apps.uninstall', options)
22
22
  end
23
23
  end
@@ -7,7 +7,7 @@ module Slack
7
7
  module Endpoints
8
8
  module AppsConnections
9
9
  #
10
- # Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive events and interactive payloads over,
10
+ # Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive events and interactive payloads over.
11
11
  #
12
12
  # @see https://api.slack.com/methods/apps.connections.open
13
13
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.connections/apps.connections.open.json
@@ -18,7 +18,7 @@ module Slack
18
18
  # @see https://api.slack.com/methods/apps.event.authorizations.list
19
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.event.authorizations/apps.event.authorizations.list.json
20
20
  def apps_event_authorizations_list(options = {})
21
- throw ArgumentError.new('Required arguments :event_context missing') if options[:event_context].nil?
21
+ raise ArgumentError, 'Required arguments :event_context missing' if options[:event_context].nil?
22
22
  if block_given?
23
23
  Pagination::Cursor.new(self, :apps_event_authorizations_list, options).each do |page|
24
24
  yield page
@@ -14,7 +14,7 @@ module Slack
14
14
  # @see https://api.slack.com/methods/apps.manifest.create
15
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.create.json
16
16
  def apps_manifest_create(options = {})
17
- throw ArgumentError.new('Required arguments :manifest missing') if options[:manifest].nil?
17
+ raise ArgumentError, 'Required arguments :manifest missing' if options[:manifest].nil?
18
18
  post('apps.manifest.create', options)
19
19
  end
20
20
 
@@ -26,7 +26,7 @@ module Slack
26
26
  # @see https://api.slack.com/methods/apps.manifest.delete
27
27
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.delete.json
28
28
  def apps_manifest_delete(options = {})
29
- throw ArgumentError.new('Required arguments :app_id missing') if options[:app_id].nil?
29
+ raise ArgumentError, 'Required arguments :app_id missing' if options[:app_id].nil?
30
30
  post('apps.manifest.delete', options)
31
31
  end
32
32
 
@@ -38,7 +38,7 @@ module Slack
38
38
  # @see https://api.slack.com/methods/apps.manifest.export
39
39
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.export.json
40
40
  def apps_manifest_export(options = {})
41
- throw ArgumentError.new('Required arguments :app_id missing') if options[:app_id].nil?
41
+ raise ArgumentError, 'Required arguments :app_id missing' if options[:app_id].nil?
42
42
  post('apps.manifest.export', options)
43
43
  end
44
44
 
@@ -52,8 +52,8 @@ module Slack
52
52
  # @see https://api.slack.com/methods/apps.manifest.update
53
53
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.update.json
54
54
  def apps_manifest_update(options = {})
55
- throw ArgumentError.new('Required arguments :app_id missing') if options[:app_id].nil?
56
- throw ArgumentError.new('Required arguments :manifest missing') if options[:manifest].nil?
55
+ raise ArgumentError, 'Required arguments :app_id missing' if options[:app_id].nil?
56
+ raise ArgumentError, 'Required arguments :manifest missing' if options[:manifest].nil?
57
57
  post('apps.manifest.update', options)
58
58
  end
59
59
 
@@ -67,7 +67,7 @@ module Slack
67
67
  # @see https://api.slack.com/methods/apps.manifest.validate
68
68
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.manifest/apps.manifest.validate.json
69
69
  def apps_manifest_validate(options = {})
70
- throw ArgumentError.new('Required arguments :manifest missing') if options[:manifest].nil?
70
+ raise ArgumentError, 'Required arguments :manifest missing' if options[:manifest].nil?
71
71
  post('apps.manifest.validate', options)
72
72
  end
73
73
  end
@@ -26,9 +26,9 @@ module Slack
26
26
  # @see https://api.slack.com/methods/bookmarks.add
27
27
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.add.json
28
28
  def bookmarks_add(options = {})
29
- throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
30
- throw ArgumentError.new('Required arguments :title missing') if options[:title].nil?
31
- throw ArgumentError.new('Required arguments :type missing') if options[:type].nil?
29
+ raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
30
+ raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
31
+ raise ArgumentError, 'Required arguments :type missing' if options[:type].nil?
32
32
  post('bookmarks.add', options)
33
33
  end
34
34
 
@@ -48,8 +48,8 @@ module Slack
48
48
  # @see https://api.slack.com/methods/bookmarks.edit
49
49
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.edit.json
50
50
  def bookmarks_edit(options = {})
51
- throw ArgumentError.new('Required arguments :bookmark_id missing') if options[:bookmark_id].nil?
52
- throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
51
+ raise ArgumentError, 'Required arguments :bookmark_id missing' if options[:bookmark_id].nil?
52
+ raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
53
53
  post('bookmarks.edit', options)
54
54
  end
55
55
 
@@ -61,7 +61,7 @@ module Slack
61
61
  # @see https://api.slack.com/methods/bookmarks.list
62
62
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.list.json
63
63
  def bookmarks_list(options = {})
64
- throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
64
+ raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
65
65
  post('bookmarks.list', options)
66
66
  end
67
67
 
@@ -72,11 +72,13 @@ module Slack
72
72
  # Bookmark to remove.
73
73
  # @option options [string] :channel_id
74
74
  # Channel to remove bookmark.
75
+ # @option options [string] :quip_section_id
76
+ # Quip section ID to unbookmark.
75
77
  # @see https://api.slack.com/methods/bookmarks.remove
76
78
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bookmarks/bookmarks.remove.json
77
79
  def bookmarks_remove(options = {})
78
- throw ArgumentError.new('Required arguments :bookmark_id missing') if options[:bookmark_id].nil?
79
- throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
80
+ raise ArgumentError, 'Required arguments :bookmark_id missing' if options[:bookmark_id].nil?
81
+ raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
80
82
  post('bookmarks.remove', options)
81
83
  end
82
84
  end
@@ -11,7 +11,7 @@ module Slack
11
11
  #
12
12
  # @option options [user] :bot
13
13
  # Bot user to get info on.
14
- # @option options [team] :team_id
14
+ # @option options [string] :team_id
15
15
  # encoded team id or enterprise id where the bot exists, required if org token is used.
16
16
  # @see https://api.slack.com/methods/bots.info
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/bots/bots.info.json
@@ -28,8 +28,8 @@ module Slack
28
28
  # @see https://api.slack.com/methods/calls.add
29
29
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls/calls.add.json
30
30
  def calls_add(options = {})
31
- throw ArgumentError.new('Required arguments :external_unique_id missing') if options[:external_unique_id].nil?
32
- throw ArgumentError.new('Required arguments :join_url missing') if options[:join_url].nil?
31
+ raise ArgumentError, 'Required arguments :external_unique_id missing' if options[:external_unique_id].nil?
32
+ raise ArgumentError, 'Required arguments :join_url missing' if options[:join_url].nil?
33
33
  post('calls.add', options)
34
34
  end
35
35
 
@@ -43,7 +43,7 @@ module Slack
43
43
  # @see https://api.slack.com/methods/calls.end
44
44
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls/calls.end.json
45
45
  def calls_end(options = {})
46
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
46
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
47
47
  post('calls.end', options)
48
48
  end
49
49
 
@@ -55,7 +55,7 @@ module Slack
55
55
  # @see https://api.slack.com/methods/calls.info
56
56
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls/calls.info.json
57
57
  def calls_info(options = {})
58
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
58
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
59
59
  post('calls.info', options)
60
60
  end
61
61
 
@@ -73,7 +73,7 @@ module Slack
73
73
  # @see https://api.slack.com/methods/calls.update
74
74
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls/calls.update.json
75
75
  def calls_update(options = {})
76
- throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
76
+ raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
77
77
  post('calls.update', options)
78
78
  end
79
79
  end
@@ -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
 
@@ -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
+ # 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 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, :blocks or :reply_broadcast missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? && options[:reply_broadcast].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)