slack-ruby-client 0.14.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +15 -3
  4. data/.rubocop_todo.yml +110 -38
  5. data/.travis.yml +2 -5
  6. data/CHANGELOG.md +42 -0
  7. data/CONTRIBUTING.md +19 -8
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/LICENSE.md +1 -1
  11. data/README.md +38 -36
  12. data/RELEASING.md +1 -1
  13. data/UPGRADING.md +62 -2
  14. data/bin/commands/admin_analytics.rb +16 -0
  15. data/bin/commands/admin_apps.rb +26 -2
  16. data/bin/commands/admin_apps_requests.rb +1 -0
  17. data/bin/commands/admin_auth_policy.rb +39 -0
  18. data/bin/commands/admin_barriers.rb +47 -0
  19. data/bin/commands/admin_conversations.rb +155 -3
  20. data/bin/commands/admin_conversations_ekm.rb +17 -0
  21. data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
  22. data/bin/commands/admin_conversations_whitelist.rb +37 -0
  23. data/bin/commands/admin_emoji.rb +1 -1
  24. data/bin/commands/admin_teams.rb +1 -1
  25. data/bin/commands/admin_usergroups.rb +48 -0
  26. data/bin/commands/admin_users.rb +3 -2
  27. data/bin/commands/admin_users_session.rb +62 -0
  28. data/bin/commands/api.rb +0 -1
  29. data/bin/commands/apps_connections.rb +13 -0
  30. data/bin/commands/apps_event_authorizations.rb +16 -0
  31. data/bin/commands/apps_manifest.rb +51 -0
  32. data/bin/commands/auth_teams.rb +16 -0
  33. data/bin/commands/bots.rb +1 -0
  34. data/bin/commands/calls.rb +52 -0
  35. data/bin/commands/calls_participants.rb +25 -0
  36. data/bin/commands/channels.rb +1 -155
  37. data/bin/commands/chat.rb +17 -12
  38. data/bin/commands/chat_scheduledMessages.rb +1 -0
  39. data/bin/commands/conversations.rb +71 -3
  40. data/bin/commands/dnd.rb +2 -0
  41. data/bin/commands/files.rb +6 -4
  42. data/bin/commands/files_remote.rb +2 -2
  43. data/bin/commands/groups.rb +1 -162
  44. data/bin/commands/im.rb +1 -63
  45. data/bin/commands/migration.rb +1 -0
  46. data/bin/commands/mpim.rb +1 -61
  47. data/bin/commands/oauth.rb +0 -13
  48. data/bin/commands/oauth_v2.rb +13 -1
  49. data/bin/commands/openid_connect.rb +27 -0
  50. data/bin/commands/pins.rb +2 -4
  51. data/bin/commands/reactions.rb +1 -0
  52. data/bin/commands/reminders.rb +6 -0
  53. data/bin/commands/rtm.rb +2 -2
  54. data/bin/commands/search.rb +4 -0
  55. data/bin/commands/stars.rb +7 -6
  56. data/bin/commands/team.rb +3 -0
  57. data/bin/commands/team_billing.rb +13 -0
  58. data/bin/commands/team_preferences.rb +13 -0
  59. data/bin/commands/tooling_tokens.rb +14 -0
  60. data/bin/commands/usergroups.rb +5 -0
  61. data/bin/commands/usergroups_users.rb +2 -0
  62. data/bin/commands/users.rb +4 -2
  63. data/bin/commands/users_profile.rb +5 -5
  64. data/bin/commands/views.rb +2 -2
  65. data/bin/commands/workflows.rb +38 -0
  66. data/bin/commands.rb +17 -8
  67. data/lib/slack/config.rb +1 -2
  68. data/lib/slack/events/request.rb +10 -4
  69. data/lib/slack/messages/message.rb +0 -4
  70. data/lib/slack/real_time/client.rb +6 -6
  71. data/lib/slack/real_time/concurrency/async.rb +7 -11
  72. data/lib/slack/real_time/concurrency.rb +0 -2
  73. data/lib/slack/real_time/config.rb +5 -14
  74. data/lib/slack/real_time/models/base.rb +0 -4
  75. data/lib/slack/real_time/socket.rb +3 -4
  76. data/lib/slack/real_time/stores/base.rb +4 -7
  77. data/lib/slack/real_time/stores/starter.rb +6 -3
  78. data/lib/slack/real_time/stores/store.rb +5 -0
  79. data/lib/slack/version.rb +1 -1
  80. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  81. data/lib/slack/web/api/endpoints/admin_apps.rb +42 -6
  82. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +2 -2
  83. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +4 -2
  84. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +2 -2
  85. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +72 -0
  86. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  87. data/lib/slack/web/api/endpoints/admin_conversations.rb +234 -4
  88. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  89. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  90. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  91. data/lib/slack/web/api/endpoints/admin_emoji.rb +10 -10
  92. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +7 -7
  93. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +3 -3
  94. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
  95. data/lib/slack/web/api/endpoints/admin_teams.rb +7 -7
  96. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +2 -2
  97. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -2
  98. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +5 -5
  99. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  100. data/lib/slack/web/api/endpoints/admin_users.rb +23 -23
  101. data/lib/slack/web/api/endpoints/admin_users_session.rb +97 -3
  102. data/lib/slack/web/api/endpoints/api.rb +1 -3
  103. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  104. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  105. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  106. data/lib/slack/web/api/endpoints/apps_manifest.rb +75 -0
  107. data/lib/slack/web/api/endpoints/auth.rb +1 -1
  108. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  109. data/lib/slack/web/api/endpoints/bots.rb +3 -1
  110. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  111. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  112. data/lib/slack/web/api/endpoints/channels.rb +1 -245
  113. data/lib/slack/web/api/endpoints/chat.rb +76 -66
  114. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +5 -3
  115. data/lib/slack/web/api/endpoints/conversations.rb +149 -41
  116. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  117. data/lib/slack/web/api/endpoints/dnd.rb +6 -3
  118. data/lib/slack/web/api/endpoints/files.rb +21 -17
  119. data/lib/slack/web/api/endpoints/files_comments.rb +1 -1
  120. data/lib/slack/web/api/endpoints/files_remote.rb +23 -23
  121. data/lib/slack/web/api/endpoints/groups.rb +0 -253
  122. data/lib/slack/web/api/endpoints/im.rb +0 -101
  123. data/lib/slack/web/api/endpoints/migration.rb +4 -2
  124. data/lib/slack/web/api/endpoints/mpim.rb +0 -96
  125. data/lib/slack/web/api/endpoints/oauth.rb +5 -30
  126. data/lib/slack/web/api/endpoints/oauth_v2.rb +24 -6
  127. data/lib/slack/web/api/endpoints/openid_connect.rb +42 -0
  128. data/lib/slack/web/api/endpoints/pins.rb +7 -12
  129. data/lib/slack/web/api/endpoints/reactions.rb +16 -14
  130. data/lib/slack/web/api/endpoints/reminders.rb +17 -5
  131. data/lib/slack/web/api/endpoints/rtm.rb +10 -10
  132. data/lib/slack/web/api/endpoints/search.rb +27 -13
  133. data/lib/slack/web/api/endpoints/stars.rb +13 -11
  134. data/lib/slack/web/api/endpoints/team.rb +11 -5
  135. data/lib/slack/web/api/endpoints/team_billing.rb +21 -0
  136. data/lib/slack/web/api/endpoints/team_preferences.rb +21 -0
  137. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  138. data/lib/slack/web/api/endpoints/tooling_tokens.rb +24 -0
  139. data/lib/slack/web/api/endpoints/usergroups.rb +26 -16
  140. data/lib/slack/web/api/endpoints/usergroups_users.rb +9 -5
  141. data/lib/slack/web/api/endpoints/users.rb +20 -18
  142. data/lib/slack/web/api/endpoints/users_profile.rb +7 -7
  143. data/lib/slack/web/api/endpoints/views.rb +13 -13
  144. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  145. data/lib/slack/web/api/endpoints.rb +35 -18
  146. data/lib/slack/web/api/errors/server_error.rb +37 -0
  147. data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -4
  148. data/lib/slack/web/api/errors.rb +486 -12
  149. data/lib/slack/web/api/mixins/{channels.id.rb → conversations.id.rb} +3 -5
  150. data/lib/slack/web/api/mixins/ids.id.rb +3 -5
  151. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  152. data/lib/slack/web/api/mixins.rb +1 -2
  153. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +25 -24
  154. data/lib/slack/web/api/templates/endpoints.erb +1 -2
  155. data/lib/slack/web/api/templates/method.erb +4 -1
  156. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  157. data/lib/slack/web/config.rb +2 -0
  158. data/lib/slack/web/faraday/connection.rb +23 -20
  159. data/lib/slack/web/faraday/request.rb +2 -1
  160. data/lib/slack/web/faraday/response/raise_error.rb +12 -1
  161. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  162. data/lib/slack/web/pagination/cursor.rb +3 -7
  163. data/lib/slack-ruby-client.rb +4 -4
  164. data/lib/tasks/web.rake +11 -3
  165. data/slack-ruby-client.gemspec +6 -7
  166. data/spec/fixtures/slack/web/429_error.yml +50 -54
  167. data/spec/fixtures/slack/web/auth_test_error.yml +51 -18
  168. data/spec/fixtures/slack/web/auth_test_success.yml +50 -26
  169. data/spec/fixtures/slack/web/conversations_info.yml +167 -0
  170. data/spec/fixtures/slack/web/conversations_setTopic.yml +84 -0
  171. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +172 -0
  172. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +253 -0
  173. data/spec/fixtures/slack/web/paginated_users_list.yml +501 -69
  174. data/spec/fixtures/slack/web/rtm_connect.yml +267 -30
  175. data/spec/fixtures/slack/web/rtm_start.yml +771 -60
  176. data/spec/fixtures/slack/web/users_info.yml +153 -69
  177. data/spec/fixtures/slack/web/users_list.yml +102 -41
  178. data/spec/fixtures/slack/web/views_open_error.yml +49 -42
  179. data/spec/slack/events/request_spec.rb +13 -8
  180. data/spec/slack/real_time/client_spec.rb +35 -22
  181. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  182. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +1 -1
  184. data/spec/slack/real_time/event_handlers/channel_spec.rb +1 -1
  185. data/spec/slack/real_time/event_handlers/im_spec.rb +5 -5
  186. data/spec/slack/real_time/event_handlers/user_spec.rb +2 -2
  187. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  188. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  189. data/spec/slack/slack_spec.rb +3 -1
  190. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  191. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +10 -0
  192. data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +35 -0
  193. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  194. data/spec/slack/web/api/endpoints/{apps_permissions_scopes_spec.rb → admin_conversations_ekm_spec.rb} +1 -1
  195. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  196. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +85 -0
  197. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +6 -6
  198. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +10 -10
  199. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +2 -2
  200. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  201. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +28 -0
  202. data/spec/slack/web/api/endpoints/admin_users_spec.rb +15 -23
  203. data/spec/slack/web/api/endpoints/{apps_permissions_resources_spec.rb → apps_connections_spec.rb} +1 -1
  204. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  205. data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +36 -0
  206. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  207. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  208. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  209. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  210. data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +4 -6
  211. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  212. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +2 -2
  213. data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -5
  214. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  215. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  216. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  217. data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -22
  218. data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +6 -3
  219. data/spec/slack/web/api/endpoints/openid_connect_spec.rb +8 -0
  220. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  221. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  222. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  223. data/spec/slack/web/api/endpoints/team_billing_spec.rb +8 -0
  224. data/spec/slack/web/api/endpoints/team_preferences_spec.rb +8 -0
  225. data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +13 -0
  226. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  227. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  228. data/spec/slack/web/api/error_spec.rb +5 -7
  229. data/spec/slack/web/api/errors/slack_error_spec.rb +21 -26
  230. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  231. data/spec/slack/web/api/mixins/{channels_spec.rb → conversations_spec.rb} +8 -8
  232. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  233. data/spec/slack/web/api/pagination/cursor_spec.rb +1 -3
  234. data/spec/slack/web/client_spec.rb +123 -1
  235. data/spec/slack/web/faraday/request_spec.rb +80 -0
  236. data/spec/slack/web/faraday/response/raise_error_spec.rb +8 -6
  237. data/spec/spec_helper.rb +1 -1
  238. data/spec/support/real_time/connected_client.rb +1 -7
  239. data/spec/support/vcr.rb +36 -1
  240. metadata +95 -173
  241. data/examples/hi_real_time/Gemfile +0 -6
  242. data/examples/hi_real_time/hi.gif +0 -0
  243. data/examples/hi_real_time/hi.rb +0 -41
  244. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  245. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  246. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  247. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  248. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  249. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  250. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  251. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  252. data/lib/slack/web/api/mixins/channels.id.json +0 -20
  253. data/lib/slack/web/api/mixins/groups.id.json +0 -20
  254. data/lib/slack/web/api/mixins/groups.id.rb +0 -27
  255. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  256. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  257. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  258. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  259. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
  260. data/spec/fixtures/slack/web/503_error.yml +0 -14
  261. data/spec/fixtures/slack/web/channels_info.yml +0 -46
  262. data/spec/fixtures/slack/web/groups_info.yml +0 -43
  263. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  264. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  265. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +0 -16
  266. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +0 -19
  267. data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -101
  268. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  269. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  270. data/spec/slack/web/api/endpoints/im_spec.rb +0 -39
  271. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -39
  272. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  273. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
  274. data/spec/slack/web/api/mixins/groups_spec.rb +0 -43
@@ -9,20 +9,38 @@ module Slack
9
9
  #
10
10
  # Exchanges a temporary OAuth verifier code for an access token.
11
11
  #
12
- # @option options [Object] :code
13
- # The code param returned via the OAuth callback.
14
- # @option options [Object] :client_id
12
+ # @option options [string] :client_id
15
13
  # Issued when you created your application.
16
- # @option options [Object] :client_secret
14
+ # @option options [string] :client_secret
17
15
  # Issued when you created your application.
18
- # @option options [Object] :redirect_uri
16
+ # @option options [string] :code
17
+ # The code param returned via the OAuth callback.
18
+ # @option options [string] :grant_type
19
+ # The grant_type param as described in the OAuth spec.
20
+ # @option options [string] :redirect_uri
19
21
  # This must match the originally submitted URI (if one was sent).
22
+ # @option options [string] :refresh_token
23
+ # The refresh_token param as described in the OAuth spec.
20
24
  # @see https://api.slack.com/methods/oauth.v2.access
21
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth.v2/oauth.v2.access.json
22
26
  def oauth_v2_access(options = {})
23
- throw ArgumentError.new('Required arguments :code missing') if options[:code].nil?
24
27
  post('oauth.v2.access', options)
25
28
  end
29
+
30
+ #
31
+ # Exchanges a legacy access token for a new expiring access token and refresh token
32
+ #
33
+ # @option options [string] :client_id
34
+ # Issued when you created your application.
35
+ # @option options [string] :client_secret
36
+ # Issued when you created your application.
37
+ # @see https://api.slack.com/methods/oauth.v2.exchange
38
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth.v2/oauth.v2.exchange.json
39
+ def oauth_v2_exchange(options = {})
40
+ throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
41
+ throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
42
+ post('oauth.v2.exchange', options)
43
+ end
26
44
  end
27
45
  end
28
46
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module OpenidConnect
9
+ #
10
+ # Exchanges a temporary OAuth verifier code for an access token for Sign in with Slack.
11
+ #
12
+ # @option options [string] :client_id
13
+ # Issued when you created your application.
14
+ # @option options [string] :client_secret
15
+ # Issued when you created your application.
16
+ # @option options [string] :code
17
+ # The code param returned via the OAuth callback.
18
+ # @option options [string] :grant_type
19
+ # The grant_type param as described in the OAuth spec.
20
+ # @option options [string] :redirect_uri
21
+ # This must match the originally submitted URI (if one was sent).
22
+ # @option options [string] :refresh_token
23
+ # The refresh_token param as described in the OAuth spec.
24
+ # @see https://api.slack.com/methods/openid.connect.token
25
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/openid.connect/openid.connect.token.json
26
+ def openid_connect_token(options = {})
27
+ post('openid.connect.token', options)
28
+ end
29
+
30
+ #
31
+ # Get the identity of a user who has authorized Sign in with Slack.
32
+ #
33
+ # @see https://api.slack.com/methods/openid.connect.userInfo
34
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/openid.connect/openid.connect.userInfo.json
35
+ def openid_connect_userInfo(options = {})
36
+ post('openid.connect.userInfo', options)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -10,15 +10,14 @@ module Slack
10
10
  # Pins an item to a channel.
11
11
  #
12
12
  # @option options [channel] :channel
13
- # Channel to pin the item in.
14
- # @option options [Object] :timestamp
15
- # Timestamp of the message to pin.
13
+ # Channel to pin the messsage to. You must also include a timestamp when pinning messages.
14
+ # @option options [string] :timestamp
15
+ # Timestamp of the message to pin. You must also include the channel.
16
16
  # @see https://api.slack.com/methods/pins.add
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.add.json
18
18
  def pins_add(options = {})
19
19
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
20
- throw ArgumentError.new('Required arguments :timestamp missing') if options[:timestamp].nil?
21
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
20
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
22
21
  post('pins.add', options)
23
22
  end
24
23
 
@@ -31,7 +30,7 @@ module Slack
31
30
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.list.json
32
31
  def pins_list(options = {})
33
32
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
34
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
33
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
35
34
  post('pins.list', options)
36
35
  end
37
36
 
@@ -40,17 +39,13 @@ module Slack
40
39
  #
41
40
  # @option options [channel] :channel
42
41
  # Channel where the item is pinned to.
43
- # @option options [file] :file
44
- # File to un-pin.
45
- # @option options [Object] :file_comment
46
- # File comment to un-pin.
47
- # @option options [Object] :timestamp
42
+ # @option options [string] :timestamp
48
43
  # Timestamp of the message to un-pin.
49
44
  # @see https://api.slack.com/methods/pins.remove
50
45
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/pins/pins.remove.json
51
46
  def pins_remove(options = {})
52
47
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
53
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
48
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
54
49
  post('pins.remove', options)
55
50
  end
56
51
  end
@@ -11,9 +11,9 @@ module Slack
11
11
  #
12
12
  # @option options [channel] :channel
13
13
  # Channel where the message to add reaction to was posted.
14
- # @option options [Object] :name
14
+ # @option options [string] :name
15
15
  # Reaction (emoji) name.
16
- # @option options [Object] :timestamp
16
+ # @option options [string] :timestamp
17
17
  # Timestamp of the message to add reaction to.
18
18
  # @see https://api.slack.com/methods/reactions.add
19
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.add.json
@@ -21,7 +21,7 @@ module Slack
21
21
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
22
22
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
23
23
  throw ArgumentError.new('Required arguments :timestamp missing') if options[:timestamp].nil?
24
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
24
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
25
25
  post('reactions.add', options)
26
26
  end
27
27
 
@@ -32,28 +32,30 @@ module Slack
32
32
  # Channel where the message to get reactions for was posted.
33
33
  # @option options [file] :file
34
34
  # File to get reactions for.
35
- # @option options [Object] :file_comment
35
+ # @option options [string] :file_comment
36
36
  # File comment to get reactions for.
37
- # @option options [Object] :full
37
+ # @option options [boolean] :full
38
38
  # If true always return the complete reaction list.
39
- # @option options [Object] :timestamp
39
+ # @option options [string] :timestamp
40
40
  # Timestamp of the message to get reactions for.
41
41
  # @see https://api.slack.com/methods/reactions.get
42
42
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.get.json
43
43
  def reactions_get(options = {})
44
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
44
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
45
45
  post('reactions.get', options)
46
46
  end
47
47
 
48
48
  #
49
49
  # Lists reactions made by a user.
50
50
  #
51
- # @option options [Object] :cursor
51
+ # @option options [string] :cursor
52
52
  # Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection. See pagination for more details.
53
- # @option options [Object] :full
53
+ # @option options [boolean] :full
54
54
  # If true always return the complete reaction list.
55
- # @option options [Object] :limit
55
+ # @option options [integer] :limit
56
56
  # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached.
57
+ # @option options [string] :team_id
58
+ # encoded team id to list reactions in, required if org token is used.
57
59
  # @option options [user] :user
58
60
  # Show reactions made by this user. Defaults to the authed user.
59
61
  # @see https://api.slack.com/methods/reactions.list
@@ -72,21 +74,21 @@ module Slack
72
74
  #
73
75
  # Removes a reaction from an item.
74
76
  #
75
- # @option options [Object] :name
77
+ # @option options [string] :name
76
78
  # Reaction (emoji) name.
77
79
  # @option options [channel] :channel
78
80
  # Channel where the message to remove reaction from was posted.
79
81
  # @option options [file] :file
80
82
  # File to remove reaction from.
81
- # @option options [Object] :file_comment
83
+ # @option options [string] :file_comment
82
84
  # File comment to remove reaction from.
83
- # @option options [Object] :timestamp
85
+ # @option options [string] :timestamp
84
86
  # Timestamp of the message to remove reaction from.
85
87
  # @see https://api.slack.com/methods/reactions.remove
86
88
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.remove.json
87
89
  def reactions_remove(options = {})
88
90
  throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
89
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
91
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
90
92
  post('reactions.remove', options)
91
93
  end
92
94
  end
@@ -9,10 +9,14 @@ module Slack
9
9
  #
10
10
  # Creates a reminder.
11
11
  #
12
- # @option options [Object] :text
12
+ # @option options [string] :text
13
13
  # The content of the reminder.
14
- # @option options [Object] :time
14
+ # @option options [string] :time
15
15
  # When this reminder should happen: the Unix timestamp (up to five years from now), the number of seconds until the reminder (if within 24 hours), or a natural language description (Ex. "in 15 minutes," or "every Thursday").
16
+ # @option options [object] :recurrence
17
+ # Specify the repeating behavior of a reminder. Available options: daily, weekly, monthly, or yearly. If weekly, may further specify the days of the week.
18
+ # @option options [string] :team_id
19
+ # Encoded team id, required if org token is used.
16
20
  # @option options [user] :user
17
21
  # The user who will receive the reminder. If no user is specified, the reminder will go to user who created it.
18
22
  # @see https://api.slack.com/methods/reminders.add
@@ -27,8 +31,10 @@ module Slack
27
31
  #
28
32
  # Marks a reminder as complete.
29
33
  #
30
- # @option options [Object] :reminder
34
+ # @option options [string] :reminder
31
35
  # The ID of the reminder to be marked as complete.
36
+ # @option options [string] :team_id
37
+ # Encoded team id, required if org token is used.
32
38
  # @see https://api.slack.com/methods/reminders.complete
33
39
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.complete.json
34
40
  def reminders_complete(options = {})
@@ -39,8 +45,10 @@ module Slack
39
45
  #
40
46
  # Deletes a reminder.
41
47
  #
42
- # @option options [Object] :reminder
48
+ # @option options [string] :reminder
43
49
  # The ID of the reminder.
50
+ # @option options [string] :team_id
51
+ # Encoded team id, required if org token is used.
44
52
  # @see https://api.slack.com/methods/reminders.delete
45
53
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.delete.json
46
54
  def reminders_delete(options = {})
@@ -51,8 +59,10 @@ module Slack
51
59
  #
52
60
  # Gets information about a reminder.
53
61
  #
54
- # @option options [Object] :reminder
62
+ # @option options [string] :reminder
55
63
  # The ID of the reminder.
64
+ # @option options [string] :team_id
65
+ # Encoded team id, required if org token is passed.
56
66
  # @see https://api.slack.com/methods/reminders.info
57
67
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.info.json
58
68
  def reminders_info(options = {})
@@ -63,6 +73,8 @@ module Slack
63
73
  #
64
74
  # Lists all reminders created by or for a given user.
65
75
  #
76
+ # @option options [string] :team_id
77
+ # Encoded team id, required if org token is passed.
66
78
  # @see https://api.slack.com/methods/reminders.list
67
79
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reminders/reminders.list.json
68
80
  def reminders_list(options = {})
@@ -9,9 +9,9 @@ module Slack
9
9
  #
10
10
  # Starts a Real Time Messaging session.
11
11
  #
12
- # @option options [Object] :batch_presence_aware
12
+ # @option options [boolean] :batch_presence_aware
13
13
  # Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.
14
- # @option options [Object] :presence_sub
14
+ # @option options [boolean] :presence_sub
15
15
  # Only deliver presence events when requested by subscription. See presence subscriptions.
16
16
  # @see https://api.slack.com/methods/rtm.connect
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/rtm/rtm.connect.json
@@ -20,21 +20,21 @@ module Slack
20
20
  end
21
21
 
22
22
  #
23
- # Starts a Real Time Messaging session.
23
+ # Deprecated: Starts a Real Time Messaging session. Use rtm.connect instead.
24
24
  #
25
- # @option options [Object] :batch_presence_aware
25
+ # @option options [boolean] :batch_presence_aware
26
26
  # Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.
27
- # @option options [Object] :include_locale
27
+ # @option options [boolean] :include_locale
28
28
  # Set this to true to receive the locale for users and channels. Defaults to false.
29
- # @option options [Object] :mpim_aware
29
+ # @option options [boolean] :mpim_aware
30
30
  # Returns MPIMs to the client in the API response.
31
- # @option options [Object] :no_latest
31
+ # @option options [boolean] :no_latest
32
32
  # Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.
33
- # @option options [Object] :no_unreads
33
+ # @option options [boolean] :no_unreads
34
34
  # Skip unread counts for each channel (improves performance).
35
- # @option options [Object] :presence_sub
35
+ # @option options [boolean] :presence_sub
36
36
  # Only deliver presence events when requested by subscription. See presence subscriptions.
37
- # @option options [Object] :simple_latest
37
+ # @option options [boolean] :simple_latest
38
38
  # Return timestamp only for latest message object of each channel (improves performance).
39
39
  # @see https://api.slack.com/methods/rtm.start
40
40
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/rtm/rtm.start.json
@@ -9,14 +9,16 @@ module Slack
9
9
  #
10
10
  # Searches for messages and files matching a query.
11
11
  #
12
- # @option options [Object] :query
12
+ # @option options [string] :query
13
13
  # Search query. May contains booleans, etc.
14
- # @option options [Object] :highlight
14
+ # @option options [boolean] :highlight
15
15
  # Pass a value of true to enable query highlight markers (see below).
16
- # @option options [Object] :sort
16
+ # @option options [string] :sort
17
17
  # Return matches sorted by either score or timestamp.
18
- # @option options [Object] :sort_dir
18
+ # @option options [string] :sort_dir
19
19
  # Change sort direction to ascending (asc) or descending (desc).
20
+ # @option options [string] :team_id
21
+ # encoded team id to search in, required if org token is used.
20
22
  # @see https://api.slack.com/methods/search.all
21
23
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.all.json
22
24
  def search_all(options = {})
@@ -27,14 +29,16 @@ module Slack
27
29
  #
28
30
  # Searches for files matching a query.
29
31
  #
30
- # @option options [Object] :query
32
+ # @option options [string] :query
31
33
  # Search query.
32
- # @option options [Object] :highlight
34
+ # @option options [boolean] :highlight
33
35
  # Pass a value of true to enable query highlight markers (see below).
34
- # @option options [Object] :sort
36
+ # @option options [string] :sort
35
37
  # Return matches sorted by either score or timestamp.
36
- # @option options [Object] :sort_dir
38
+ # @option options [string] :sort_dir
37
39
  # Change sort direction to ascending (asc) or descending (desc).
40
+ # @option options [string] :team_id
41
+ # encoded team id to search in, required if org token is used.
38
42
  # @see https://api.slack.com/methods/search.files
39
43
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.files.json
40
44
  def search_files(options = {})
@@ -45,19 +49,29 @@ module Slack
45
49
  #
46
50
  # Searches for messages matching a query.
47
51
  #
48
- # @option options [Object] :query
52
+ # @option options [string] :query
49
53
  # Search query.
50
- # @option options [Object] :highlight
54
+ # @option options [string] :cursor
55
+ # Use this when getting results with cursormark pagination. For first call send * for subsequent calls, send the value of next_cursor returned in the previous call's results.
56
+ # @option options [boolean] :highlight
51
57
  # Pass a value of true to enable query highlight markers (see below).
52
- # @option options [Object] :sort
58
+ # @option options [string] :sort
53
59
  # Return matches sorted by either score or timestamp.
54
- # @option options [Object] :sort_dir
60
+ # @option options [string] :sort_dir
55
61
  # Change sort direction to ascending (asc) or descending (desc).
62
+ # @option options [string] :team_id
63
+ # encoded team id to search in, required if org token is used.
56
64
  # @see https://api.slack.com/methods/search.messages
57
65
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.messages.json
58
66
  def search_messages(options = {})
59
67
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
60
- post('search.messages', options)
68
+ if block_given?
69
+ Pagination::Cursor.new(self, :search_messages, options).each do |page|
70
+ yield page
71
+ end
72
+ else
73
+ post('search.messages', options)
74
+ end
61
75
  end
62
76
  end
63
77
  end
@@ -7,30 +7,32 @@ module Slack
7
7
  module Endpoints
8
8
  module Stars
9
9
  #
10
- # Adds a star to an item.
10
+ # Save an item for later. Formerly known as _adding a star_.
11
11
  #
12
12
  # @option options [channel] :channel
13
13
  # Channel to add star to, or channel where the message to add star to was posted (used with timestamp).
14
14
  # @option options [file] :file
15
15
  # File to add star to.
16
- # @option options [Object] :file_comment
16
+ # @option options [string] :file_comment
17
17
  # File comment to add star to.
18
- # @option options [Object] :timestamp
18
+ # @option options [string] :timestamp
19
19
  # Timestamp of the message to add star to.
20
20
  # @see https://api.slack.com/methods/stars.add
21
21
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/stars/stars.add.json
22
22
  def stars_add(options = {})
23
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
23
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
24
24
  post('stars.add', options)
25
25
  end
26
26
 
27
27
  #
28
- # Lists stars for a user.
28
+ # List a user's saved items, formerly known as _stars_.
29
29
  #
30
- # @option options [Object] :cursor
30
+ # @option options [string] :cursor
31
31
  # Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first "page" of the collection. See pagination for more details.
32
- # @option options [Object] :limit
32
+ # @option options [integer] :limit
33
33
  # The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached.
34
+ # @option options [string] :team_id
35
+ # encoded team id to list stars in, required if org token is used.
34
36
  # @see https://api.slack.com/methods/stars.list
35
37
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/stars/stars.list.json
36
38
  def stars_list(options = {})
@@ -44,20 +46,20 @@ module Slack
44
46
  end
45
47
 
46
48
  #
47
- # Removes a star from an item.
49
+ # Removes a saved item (star) from an item.
48
50
  #
49
51
  # @option options [channel] :channel
50
52
  # Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp).
51
53
  # @option options [file] :file
52
54
  # File to remove star from.
53
- # @option options [Object] :file_comment
55
+ # @option options [string] :file_comment
54
56
  # File comment to remove star from.
55
- # @option options [Object] :timestamp
57
+ # @option options [string] :timestamp
56
58
  # Timestamp of the message to remove star from.
57
59
  # @see https://api.slack.com/methods/stars.remove
58
60
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/stars/stars.remove.json
59
61
  def stars_remove(options = {})
60
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
62
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
61
63
  post('stars.remove', options)
62
64
  end
63
65
  end
@@ -9,8 +9,10 @@ module Slack
9
9
  #
10
10
  # Gets the access logs for the current team.
11
11
  #
12
- # @option options [Object] :before
12
+ # @option options [string] :before
13
13
  # End of time range of logs to include in results (inclusive).
14
+ # @option options [string] :team_id
15
+ # encoded team id to get logs from, required if org token is used.
14
16
  # @see https://api.slack.com/methods/team.accessLogs
15
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team/team.accessLogs.json
16
18
  def team_accessLogs(options = {})
@@ -20,6 +22,8 @@ module Slack
20
22
  #
21
23
  # Gets billable users information for the current team.
22
24
  #
25
+ # @option options [string] :team_id
26
+ # encoded team id to get the billable information from, required if org token is used.
23
27
  # @option options [user] :user
24
28
  # A user to retrieve the billable information for. Defaults to all users.
25
29
  # @see https://api.slack.com/methods/team.billableInfo
@@ -32,7 +36,7 @@ module Slack
32
36
  #
33
37
  # Gets information about the current team.
34
38
  #
35
- # @option options [Object] :team
39
+ # @option options [string] :team
36
40
  # Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels.
37
41
  # @see https://api.slack.com/methods/team.info
38
42
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team/team.info.json
@@ -43,12 +47,14 @@ module Slack
43
47
  #
44
48
  # Gets the integration logs for the current team.
45
49
  #
46
- # @option options [Object] :app_id
50
+ # @option options [string] :app_id
47
51
  # Filter logs to this Slack app. Defaults to all logs.
48
- # @option options [Object] :change_type
52
+ # @option options [string] :change_type
49
53
  # Filter logs with this change type. Defaults to all logs.
50
- # @option options [Object] :service_id
54
+ # @option options [string] :service_id
51
55
  # Filter logs to this service. Defaults to all logs.
56
+ # @option options [string] :team_id
57
+ # encoded team id to get logs from, required if org token is used.
52
58
  # @option options [user] :user
53
59
  # Filter logs generated by this user's actions. Defaults to all logs.
54
60
  # @see https://api.slack.com/methods/team.integrationLogs
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module TeamBilling
9
+ #
10
+ # Reads a workspace's billing plan information.
11
+ #
12
+ # @see https://api.slack.com/methods/team.billing.info
13
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team.billing/team.billing.info.json
14
+ def team_billing_info(options = {})
15
+ post('team.billing.info', options)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module TeamPreferences
9
+ #
10
+ # Retrieve a list of a workspace's team preferences.
11
+ #
12
+ # @see https://api.slack.com/methods/team.preferences.list
13
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team.preferences/team.preferences.list.json
14
+ def team_preferences_list(options = {})
15
+ post('team.preferences.list', options)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,7 +9,7 @@ module Slack
9
9
  #
10
10
  # Retrieve a team's profile.
11
11
  #
12
- # @option options [Object] :visibility
12
+ # @option options [string] :visibility
13
13
  # Filter by visibility.
14
14
  # @see https://api.slack.com/methods/team.profile.get
15
15
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/team.profile/team.profile.get.json
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module ToolingTokens
9
+ #
10
+ # Exchanges a refresh token for a new app configuration token.
11
+ #
12
+ # @option options [string] :refresh_token
13
+ # The xoxe refresh token that was issued along with the old app configuration token.
14
+ # @see https://api.slack.com/methods/tooling.tokens.rotate
15
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/tooling.tokens/tooling.tokens.rotate.json
16
+ def tooling_tokens_rotate(options = {})
17
+ throw ArgumentError.new('Required arguments :refresh_token missing') if options[:refresh_token].nil?
18
+ post('tooling.tokens.rotate', options)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end