slack-ruby-client 0.14.5 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +11 -3
  4. data/.rubocop_todo.yml +61 -23
  5. data/.travis.yml +1 -5
  6. data/CHANGELOG.md +43 -4
  7. data/CONTRIBUTING.md +17 -6
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/LICENSE.md +1 -1
  11. data/README.md +86 -52
  12. data/UPGRADING.md +20 -2
  13. data/bin/commands.rb +23 -0
  14. data/bin/commands/admin_analytics.rb +16 -0
  15. data/bin/commands/admin_apps.rb +15 -2
  16. data/bin/commands/admin_apps_approved.rb +17 -0
  17. data/bin/commands/admin_apps_restricted.rb +17 -0
  18. data/bin/commands/admin_barriers.rb +47 -0
  19. data/bin/commands/admin_conversations.rb +159 -0
  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 +54 -0
  24. data/bin/commands/admin_inviteRequests.rb +36 -0
  25. data/bin/commands/admin_inviteRequests_approved.rb +16 -0
  26. data/bin/commands/admin_inviteRequests_denied.rb +16 -0
  27. data/bin/commands/admin_teams.rb +27 -0
  28. data/bin/commands/admin_teams_admins.rb +16 -0
  29. data/bin/commands/admin_teams_owners.rb +16 -0
  30. data/bin/commands/admin_teams_settings.rb +64 -0
  31. data/bin/commands/admin_usergroups.rb +48 -0
  32. data/bin/commands/admin_users.rb +97 -0
  33. data/bin/commands/admin_users_session.rb +22 -0
  34. data/bin/commands/api.rb +0 -1
  35. data/bin/commands/apps_connections.rb +13 -0
  36. data/bin/commands/apps_event_authorizations.rb +16 -0
  37. data/bin/commands/auth_teams.rb +16 -0
  38. data/bin/commands/bots.rb +1 -0
  39. data/bin/commands/calls.rb +52 -0
  40. data/bin/commands/calls_participants.rb +25 -0
  41. data/bin/commands/channels.rb +1 -155
  42. data/bin/commands/chat.rb +14 -12
  43. data/bin/commands/chat_scheduledMessages.rb +1 -0
  44. data/bin/commands/conversations.rb +15 -4
  45. data/bin/commands/dnd.rb +3 -1
  46. data/bin/commands/files.rb +7 -5
  47. data/bin/commands/files_remote.rb +3 -3
  48. data/bin/commands/groups.rb +1 -162
  49. data/bin/commands/im.rb +1 -63
  50. data/bin/commands/migration.rb +1 -0
  51. data/bin/commands/mpim.rb +1 -61
  52. data/bin/commands/oauth.rb +1 -1
  53. data/bin/commands/pins.rb +0 -2
  54. data/bin/commands/reactions.rb +1 -0
  55. data/bin/commands/search.rb +4 -1
  56. data/bin/commands/team.rb +3 -0
  57. data/bin/commands/usergroups.rb +6 -1
  58. data/bin/commands/usergroups_users.rb +2 -0
  59. data/bin/commands/users.rb +5 -3
  60. data/bin/commands/users_profile.rb +5 -5
  61. data/bin/commands/views.rb +1 -1
  62. data/bin/commands/workflows.rb +38 -0
  63. data/lib/slack-ruby-client.rb +5 -4
  64. data/lib/slack/events/request.rb +7 -3
  65. data/lib/slack/messages/message.rb +0 -4
  66. data/lib/slack/real_time/client.rb +2 -1
  67. data/lib/slack/real_time/concurrency.rb +0 -2
  68. data/lib/slack/real_time/concurrency/async.rb +1 -3
  69. data/lib/slack/real_time/config.rb +5 -14
  70. data/lib/slack/real_time/models/base.rb +0 -4
  71. data/lib/slack/real_time/socket.rb +2 -2
  72. data/lib/slack/real_time/stores/base.rb +3 -1
  73. data/lib/slack/version.rb +1 -1
  74. data/lib/slack/web/api/endpoints.rb +47 -0
  75. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  76. data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
  77. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
  78. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
  79. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  80. data/lib/slack/web/api/endpoints/admin_conversations.rb +246 -0
  81. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  82. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  83. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  84. data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
  85. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
  86. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
  87. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
  88. data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
  89. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
  90. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
  91. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
  92. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  93. data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
  94. data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
  95. data/lib/slack/web/api/endpoints/api.rb +0 -2
  96. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  97. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  98. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  99. data/lib/slack/web/api/endpoints/bots.rb +2 -0
  100. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  101. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  102. data/lib/slack/web/api/endpoints/channels.rb +1 -245
  103. data/lib/slack/web/api/endpoints/chat.rb +23 -19
  104. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -1
  105. data/lib/slack/web/api/endpoints/conversations.rb +37 -19
  106. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  107. data/lib/slack/web/api/endpoints/files.rb +8 -4
  108. data/lib/slack/web/api/endpoints/files_remote.rb +4 -4
  109. data/lib/slack/web/api/endpoints/groups.rb +0 -253
  110. data/lib/slack/web/api/endpoints/im.rb +0 -101
  111. data/lib/slack/web/api/endpoints/migration.rb +2 -0
  112. data/lib/slack/web/api/endpoints/mpim.rb +0 -96
  113. data/lib/slack/web/api/endpoints/oauth.rb +1 -4
  114. data/lib/slack/web/api/endpoints/pins.rb +3 -8
  115. data/lib/slack/web/api/endpoints/reactions.rb +5 -3
  116. data/lib/slack/web/api/endpoints/search.rb +6 -0
  117. data/lib/slack/web/api/endpoints/stars.rb +2 -2
  118. data/lib/slack/web/api/endpoints/team.rb +6 -0
  119. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  120. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  121. data/lib/slack/web/api/endpoints/users.rb +7 -5
  122. data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
  123. data/lib/slack/web/api/endpoints/views.rb +1 -1
  124. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  125. data/lib/slack/web/api/errors.rb +848 -0
  126. data/lib/slack/web/api/errors/internal_error.rb +14 -0
  127. data/lib/slack/web/api/errors/slack_error.rb +12 -0
  128. data/lib/slack/web/api/mixins.rb +1 -0
  129. data/lib/slack/web/api/mixins/channels.id.rb +1 -3
  130. data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
  131. data/lib/slack/web/api/mixins/groups.id.rb +1 -3
  132. data/lib/slack/web/api/mixins/ids.id.rb +3 -5
  133. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  134. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +26 -24
  135. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  136. data/lib/slack/web/api/templates/errors.erb +20 -0
  137. data/lib/slack/web/api/templates/method.erb +4 -1
  138. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  139. data/lib/slack/web/client.rb +1 -1
  140. data/lib/slack/web/config.rb +2 -0
  141. data/lib/slack/web/faraday/connection.rb +23 -20
  142. data/lib/slack/web/faraday/response/raise_error.rb +16 -2
  143. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  144. data/lib/slack/web/pagination/cursor.rb +2 -2
  145. data/lib/tasks/real_time.rake +1 -1
  146. data/lib/tasks/web.rake +21 -4
  147. data/slack-ruby-client.gemspec +5 -5
  148. data/spec/fixtures/slack/web/channels_info.yml +108 -15
  149. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  150. data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
  151. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
  152. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
  153. data/spec/fixtures/slack/web/views_open_error.yml +76 -0
  154. data/spec/slack/events/request_spec.rb +13 -8
  155. data/spec/slack/real_time/client_spec.rb +18 -1
  156. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  157. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  158. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  159. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  160. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  161. data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
  162. data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
  163. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  164. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  165. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
  166. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  167. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +93 -0
  168. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
  169. data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
  170. data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
  171. data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
  172. data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
  173. data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
  174. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
  175. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
  176. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  177. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
  178. data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
  179. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
  180. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  181. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
  182. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
  183. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  184. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  185. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  186. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  187. data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
  188. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  189. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  190. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  191. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  192. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  193. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  194. data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -14
  195. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  196. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  197. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  198. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  199. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  200. data/spec/slack/web/api/errors/slack_error_spec.rb +22 -0
  201. data/spec/slack/web/api/mixins/channels_spec.rb +1 -1
  202. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  203. data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
  204. data/spec/slack/web/api/mixins/groups_spec.rb +1 -1
  205. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  206. data/spec/slack/web/client_spec.rb +121 -0
  207. data/spec/slack/web/faraday/response/raise_error_spec.rb +33 -9
  208. data/spec/support/vcr.rb +4 -0
  209. metadata +145 -55
  210. data/examples/hi_real_time/Gemfile +0 -6
  211. data/examples/hi_real_time/hi.gif +0 -0
  212. data/examples/hi_real_time/hi.rb +0 -41
  213. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  214. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  215. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  216. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  217. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  218. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  219. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  220. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  221. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  222. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  223. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  224. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  225. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
  226. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  227. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  228. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  229. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  230. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  231. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
@@ -6,107 +6,6 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Im
9
- #
10
- # Close a direct message channel.
11
- #
12
- # @option options [im] :channel
13
- # Direct message channel to close.
14
- # @see https://api.slack.com/methods/im.close
15
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.close.json
16
- def im_close(options = {})
17
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
19
- post('im.close', options)
20
- end
21
-
22
- #
23
- # Fetches history of messages and events from direct message channel.
24
- #
25
- # @option options [im] :channel
26
- # Direct message channel to fetch history for.
27
- # @option options [Object] :inclusive
28
- # Include messages with latest or oldest timestamp in results.
29
- # @option options [timestamp] :latest
30
- # End of time range of messages to include in results.
31
- # @option options [timestamp] :oldest
32
- # Start of time range of messages to include in results.
33
- # @option options [Object] :unreads
34
- # Include unread_count_display in the output?.
35
- # @see https://api.slack.com/methods/im.history
36
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.history.json
37
- def im_history(options = {})
38
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
39
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
40
- post('im.history', options)
41
- end
42
-
43
- #
44
- # Lists direct message channels for the calling user.
45
- #
46
- # @option options [Object] :cursor
47
- # 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.
48
- # @option options [Object] :limit
49
- # 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.
50
- # @see https://api.slack.com/methods/im.list
51
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.list.json
52
- def im_list(options = {})
53
- if block_given?
54
- Pagination::Cursor.new(self, :im_list, options).each do |page|
55
- yield page
56
- end
57
- else
58
- post('im.list', options)
59
- end
60
- end
61
-
62
- #
63
- # Sets the read cursor in a direct message channel.
64
- #
65
- # @option options [im] :channel
66
- # Direct message channel to set reading cursor in.
67
- # @option options [timestamp] :ts
68
- # Timestamp of the most recently seen message.
69
- # @see https://api.slack.com/methods/im.mark
70
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.mark.json
71
- def im_mark(options = {})
72
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
73
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
74
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
75
- post('im.mark', options)
76
- end
77
-
78
- #
79
- # Opens a direct message channel.
80
- #
81
- # @option options [user] :user
82
- # User to open a direct message channel with.
83
- # @option options [Object] :include_locale
84
- # Set this to true to receive the locale for this im. Defaults to false.
85
- # @option options [Object] :return_im
86
- # Boolean, indicates you want the full IM channel definition in the response.
87
- # @see https://api.slack.com/methods/im.open
88
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.open.json
89
- def im_open(options = {})
90
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
91
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
92
- post('im.open', options)
93
- end
94
-
95
- #
96
- # Retrieve a thread of messages posted to a direct message conversation
97
- #
98
- # @option options [im] :channel
99
- # Direct message channel to fetch thread from.
100
- # @option options [Object] :thread_ts
101
- # Unique identifier of a thread's parent message.
102
- # @see https://api.slack.com/methods/im.replies
103
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/im/im.replies.json
104
- def im_replies(options = {})
105
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
106
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
107
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
108
- post('im.replies', options)
109
- end
110
9
  end
111
10
  end
112
11
  end
@@ -11,6 +11,8 @@ module Slack
11
11
  #
12
12
  # @option options [Object] :users
13
13
  # A comma-separated list of user ids, up to 400 per request.
14
+ # @option options [Object] :team_id
15
+ # Specify team_id starts with T in case of Org Token.
14
16
  # @option options [Object] :to_old
15
17
  # Specify true to convert W global user IDs to workspace-specific U IDs. Defaults to false.
16
18
  # @see https://api.slack.com/methods/migration.exchange
@@ -6,102 +6,6 @@ module Slack
6
6
  module Api
7
7
  module Endpoints
8
8
  module Mpim
9
- #
10
- # Closes a multiparty direct message channel.
11
- #
12
- # @option options [channel] :channel
13
- # MPIM to close.
14
- # @see https://api.slack.com/methods/mpim.close
15
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.close.json
16
- def mpim_close(options = {})
17
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
18
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
19
- post('mpim.close', options)
20
- end
21
-
22
- #
23
- # Fetches history of messages and events from a multiparty direct message.
24
- #
25
- # @option options [channel] :channel
26
- # Multiparty direct message to fetch history for.
27
- # @option options [Object] :inclusive
28
- # Include messages with latest or oldest timestamp in results.
29
- # @option options [timestamp] :latest
30
- # End of time range of messages to include in results.
31
- # @option options [timestamp] :oldest
32
- # Start of time range of messages to include in results.
33
- # @option options [Object] :unreads
34
- # Include unread_count_display in the output?.
35
- # @see https://api.slack.com/methods/mpim.history
36
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.history.json
37
- def mpim_history(options = {})
38
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
39
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
40
- post('mpim.history', options)
41
- end
42
-
43
- #
44
- # Lists multiparty direct message channels for the calling user.
45
- #
46
- # @option options [Object] :cursor
47
- # 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.
48
- # @option options [Object] :limit
49
- # 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.
50
- # @see https://api.slack.com/methods/mpim.list
51
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.list.json
52
- def mpim_list(options = {})
53
- if block_given?
54
- Pagination::Cursor.new(self, :mpim_list, options).each do |page|
55
- yield page
56
- end
57
- else
58
- post('mpim.list', options)
59
- end
60
- end
61
-
62
- #
63
- # Sets the read cursor in a multiparty direct message channel.
64
- #
65
- # @option options [channel] :channel
66
- # multiparty direct message channel to set reading cursor in.
67
- # @option options [timestamp] :ts
68
- # Timestamp of the most recently seen message.
69
- # @see https://api.slack.com/methods/mpim.mark
70
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.mark.json
71
- def mpim_mark(options = {})
72
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
73
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
74
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
75
- post('mpim.mark', options)
76
- end
77
-
78
- #
79
- # This method opens a multiparty direct message.
80
- #
81
- # @option options [Object] :users
82
- # Comma separated lists of users. The ordering of the users is preserved whenever a MPIM group is returned.
83
- # @see https://api.slack.com/methods/mpim.open
84
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.open.json
85
- def mpim_open(options = {})
86
- throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
87
- post('mpim.open', options)
88
- end
89
-
90
- #
91
- # Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message.
92
- #
93
- # @option options [channel] :channel
94
- # Multiparty direct message channel to fetch thread from.
95
- # @option options [Object] :thread_ts
96
- # Unique identifier of a thread's parent message.
97
- # @see https://api.slack.com/methods/mpim.replies
98
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.replies.json
99
- def mpim_replies(options = {})
100
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
101
- throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
102
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
103
- post('mpim.replies', options)
104
- end
105
9
  end
106
10
  end
107
11
  end
@@ -18,13 +18,10 @@ module Slack
18
18
  # @option options [Object] :redirect_uri
19
19
  # This must match the originally submitted URI (if one was sent).
20
20
  # @option options [Object] :single_channel
21
- # Request the user to add your app only to a single channel.
21
+ # Request the user to add your app only to a single channel. Only valid with a legacy workspace app.
22
22
  # @see https://api.slack.com/methods/oauth.access
23
23
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth/oauth.access.json
24
24
  def oauth_access(options = {})
25
- throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
26
- throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
27
- throw ArgumentError.new('Required arguments :code missing') if options[:code].nil?
28
25
  post('oauth.access', options)
29
26
  end
30
27
 
@@ -17,8 +17,7 @@ module Slack
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
42
  # @option options [Object] :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
@@ -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
 
@@ -41,7 +41,7 @@ module Slack
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
 
@@ -54,6 +54,8 @@ module Slack
54
54
  # If true always return the complete reaction list.
55
55
  # @option options [Object] :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 [Object] :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
@@ -86,7 +88,7 @@ module Slack
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
@@ -17,6 +17,8 @@ module Slack
17
17
  # Return matches sorted by either score or timestamp.
18
18
  # @option options [Object] :sort_dir
19
19
  # Change sort direction to ascending (asc) or descending (desc).
20
+ # @option options [Object] :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 = {})
@@ -35,6 +37,8 @@ module Slack
35
37
  # Return matches sorted by either score or timestamp.
36
38
  # @option options [Object] :sort_dir
37
39
  # Change sort direction to ascending (asc) or descending (desc).
40
+ # @option options [Object] :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 = {})
@@ -53,6 +57,8 @@ module Slack
53
57
  # Return matches sorted by either score or timestamp.
54
58
  # @option options [Object] :sort_dir
55
59
  # Change sort direction to ascending (asc) or descending (desc).
60
+ # @option options [Object] :team_id
61
+ # encoded team id to search in, required if org token is used.
56
62
  # @see https://api.slack.com/methods/search.messages
57
63
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/search/search.messages.json
58
64
  def search_messages(options = {})
@@ -20,7 +20,7 @@ module Slack
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
 
@@ -57,7 +57,7 @@ module Slack
57
57
  # @see https://api.slack.com/methods/stars.remove
58
58
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/stars/stars.remove.json
59
59
  def stars_remove(options = {})
60
- options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
60
+ options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
61
61
  post('stars.remove', options)
62
62
  end
63
63
  end
@@ -11,6 +11,8 @@ module Slack
11
11
  #
12
12
  # @option options [Object] :before
13
13
  # End of time range of logs to include in results (inclusive).
14
+ # @option options [Object] :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 [Object] :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
@@ -49,6 +53,8 @@ module Slack
49
53
  # Filter logs with this change type. Defaults to all logs.
50
54
  # @option options [Object] :service_id
51
55
  # Filter logs to this service. Defaults to all logs.
56
+ # @option options [Object] :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
@@ -19,6 +19,8 @@ module Slack
19
19
  # A mention handle. Must be unique among channels, users and User Groups.
20
20
  # @option options [Object] :include_count
21
21
  # Include the number of users in each User Group.
22
+ # @option options [Object] :team_id
23
+ # Encoded team id where the user group has to be created, required if org token is used.
22
24
  # @see https://api.slack.com/methods/usergroups.create
23
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.create.json
24
26
  def usergroups_create(options = {})
@@ -33,6 +35,8 @@ module Slack
33
35
  # The encoded ID of the User Group to disable.
34
36
  # @option options [Object] :include_count
35
37
  # Include the number of users in the User Group.
38
+ # @option options [Object] :team_id
39
+ # Encoded team id where the user group is, required if org token is used.
36
40
  # @see https://api.slack.com/methods/usergroups.disable
37
41
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.disable.json
38
42
  def usergroups_disable(options = {})
@@ -47,6 +51,8 @@ module Slack
47
51
  # The encoded ID of the User Group to enable.
48
52
  # @option options [Object] :include_count
49
53
  # Include the number of users in the User Group.
54
+ # @option options [Object] :team_id
55
+ # Encoded team id where the user group is, required if org token is used.
50
56
  # @see https://api.slack.com/methods/usergroups.enable
51
57
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.enable.json
52
58
  def usergroups_enable(options = {})
@@ -63,6 +69,8 @@ module Slack
63
69
  # Include disabled User Groups.
64
70
  # @option options [Object] :include_users
65
71
  # Include the list of users for each User Group.
72
+ # @option options [Object] :team_id
73
+ # encoded team id to list user groups in, required if org token is used.
66
74
  # @see https://api.slack.com/methods/usergroups.list
67
75
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.list.json
68
76
  def usergroups_list(options = {})
@@ -84,6 +92,8 @@ module Slack
84
92
  # Include the number of users in the User Group.
85
93
  # @option options [Object] :name
86
94
  # A name for the User Group. Must be unique among User Groups.
95
+ # @option options [Object] :team_id
96
+ # encoded team id where the user group exists, required if org token is used.
87
97
  # @see https://api.slack.com/methods/usergroups.update
88
98
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.update.json
89
99
  def usergroups_update(options = {})
@@ -13,6 +13,8 @@ module Slack
13
13
  # The encoded ID of the User Group to update.
14
14
  # @option options [Object] :include_disabled
15
15
  # Allow results that involve disabled User Groups.
16
+ # @option options [Object] :team_id
17
+ # encoded team id where the user group exists, required if org token is used.
16
18
  # @see https://api.slack.com/methods/usergroups.users.list
17
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups.users/usergroups.users.list.json
18
20
  def usergroups_users_list(options = {})
@@ -29,6 +31,8 @@ module Slack
29
31
  # A comma separated string of encoded user IDs that represent the entire list of users for the User Group.
30
32
  # @option options [Object] :include_count
31
33
  # Include the number of users in the User Group.
34
+ # @option options [Object] :team_id
35
+ # encoded team id where the user group exists, required if org token is used.
32
36
  # @see https://api.slack.com/methods/usergroups.users.update
33
37
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups.users/usergroups.users.update.json
34
38
  def usergroups_users_update(options = {})
@@ -15,6 +15,8 @@ module Slack
15
15
  # Set to true to exclude archived channels from the list.
16
16
  # @option options [Object] :limit
17
17
  # 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. Must be an integer no larger than 1000.
18
+ # @option options [Object] :team_id
19
+ # encoded team id to list conversations in, required if org token is used.
18
20
  # @option options [Object] :types
19
21
  # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
20
22
  # @option options [user] :user
@@ -49,7 +51,6 @@ module Slack
49
51
  # @see https://api.slack.com/methods/users.getPresence
50
52
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.getPresence.json
51
53
  def users_getPresence(options = {})
52
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
53
54
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
54
55
  post('users.getPresence', options)
55
56
  end
@@ -86,7 +87,9 @@ module Slack
86
87
  # @option options [Object] :include_locale
87
88
  # Set this to true to receive the locale for users. Defaults to false.
88
89
  # @option options [Object] :limit
89
- # 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.
90
+ # 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. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors.
91
+ # @option options [Object] :team_id
92
+ # encoded team id to list users in, required if org token is used.
90
93
  # @see https://api.slack.com/methods/users.list
91
94
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.list.json
92
95
  def users_list(options = {})
@@ -123,18 +126,17 @@ module Slack
123
126
  #
124
127
  # Set the user profile photo
125
128
  #
126
- # @option options [Object] :image
127
- # File contents via multipart/form-data.
128
129
  # @option options [Object] :crop_w
129
130
  # Width/height of crop box (always square).
130
131
  # @option options [Object] :crop_x
131
132
  # X coordinate of top-left corner of crop box.
132
133
  # @option options [Object] :crop_y
133
134
  # Y coordinate of top-left corner of crop box.
135
+ # @option options [Object] :image
136
+ # File contents via multipart/form-data.
134
137
  # @see https://api.slack.com/methods/users.setPhoto
135
138
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.setPhoto.json
136
139
  def users_setPhoto(options = {})
137
- throw ArgumentError.new('Required arguments :image missing') if options[:image].nil?
138
140
  post('users.setPhoto', options)
139
141
  end
140
142