slack-ruby-client 1.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/integration_test.yml +45 -0
  4. data/.github/workflows/lint.yml +14 -0
  5. data/.github/workflows/pr_lint.yml +21 -0
  6. data/.github/workflows/test.yml +37 -0
  7. data/.gitignore +4 -3
  8. data/.rubocop.yml +6 -1
  9. data/.rubocop_todo.yml +88 -34
  10. data/.ruby-version +1 -0
  11. data/CHANGELOG.md +36 -0
  12. data/CONTRIBUTING.md +6 -5
  13. data/Gemfile +13 -1
  14. data/Gemfile.danger +6 -0
  15. data/README.md +78 -76
  16. data/RELEASING.md +2 -2
  17. data/SECURITY.md +9 -0
  18. data/UPGRADING.md +28 -0
  19. data/bin/commands/admin_analytics.rb +16 -10
  20. data/bin/commands/admin_apps.rb +48 -42
  21. data/bin/commands/admin_apps_approved.rb +17 -11
  22. data/bin/commands/admin_apps_requests.rb +28 -11
  23. data/bin/commands/admin_apps_restricted.rb +17 -11
  24. data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
  25. data/bin/commands/admin_auth_policy.rb +37 -31
  26. data/bin/commands/admin_barriers.rb +44 -38
  27. data/bin/commands/admin_conversations.rb +221 -163
  28. data/bin/commands/admin_conversations_ekm.rb +17 -11
  29. data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
  30. data/bin/commands/admin_emoji.rb +50 -44
  31. data/bin/commands/admin_inviteRequests.rb +34 -28
  32. data/bin/commands/admin_inviteRequests_approved.rb +16 -10
  33. data/bin/commands/admin_inviteRequests_denied.rb +16 -10
  34. data/bin/commands/admin_roles.rb +46 -0
  35. data/bin/commands/admin_teams.rb +26 -20
  36. data/bin/commands/admin_teams_admins.rb +16 -10
  37. data/bin/commands/admin_teams_owners.rb +16 -10
  38. data/bin/commands/admin_teams_settings.rb +59 -53
  39. data/bin/commands/admin_usergroups.rb +45 -39
  40. data/bin/commands/admin_users.rb +91 -85
  41. data/bin/commands/admin_users_session.rb +72 -66
  42. data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
  43. data/bin/commands/api.rb +14 -8
  44. data/bin/commands/apps.rb +15 -9
  45. data/bin/commands/apps_connections.rb +13 -7
  46. data/bin/commands/apps_event_authorizations.rb +16 -10
  47. data/bin/commands/apps_manifest.rb +48 -41
  48. data/bin/commands/auth.rb +21 -15
  49. data/bin/commands/auth_teams.rb +16 -10
  50. data/bin/commands/bookmarks.rb +59 -0
  51. data/bin/commands/bots.rb +15 -9
  52. data/bin/commands/calls.rb +49 -43
  53. data/bin/commands/calls_participants.rb +24 -18
  54. data/bin/commands/chat.rb +150 -141
  55. data/bin/commands/chat_scheduledMessages.rb +19 -13
  56. data/bin/commands/conversations.rb +233 -225
  57. data/bin/commands/dialog.rb +15 -9
  58. data/bin/commands/dnd.rb +46 -40
  59. data/bin/commands/emoji.rb +14 -7
  60. data/bin/commands/files.rb +112 -83
  61. data/bin/commands/files_comments.rb +15 -9
  62. data/bin/commands/files_remote.rb +73 -67
  63. data/bin/commands/functions_workflows_steps.rb +22 -0
  64. data/bin/commands/functions_workflows_steps_responses.rb +22 -0
  65. data/bin/commands/migration.rb +16 -10
  66. data/bin/commands/oauth.rb +18 -12
  67. data/bin/commands/oauth_v2.rb +28 -22
  68. data/bin/commands/openid_connect.rb +26 -20
  69. data/bin/commands/pins.rb +33 -26
  70. data/bin/commands/reactions.rb +52 -46
  71. data/bin/commands/reminders.rb +53 -47
  72. data/bin/commands/rtm.rb +15 -24
  73. data/bin/commands/search.rb +43 -37
  74. data/bin/commands/stars.rb +38 -32
  75. data/bin/commands/team.rb +47 -38
  76. data/bin/commands/team_billing.rb +13 -7
  77. data/bin/commands/team_preferences.rb +13 -7
  78. data/bin/commands/team_profile.rb +14 -8
  79. data/bin/commands/tooling_tokens.rb +14 -8
  80. data/bin/commands/usergroups.rb +64 -58
  81. data/bin/commands/usergroups_users.rb +27 -21
  82. data/bin/commands/users.rb +111 -105
  83. data/bin/commands/users_admin.rb +28 -22
  84. data/bin/commands/users_prefs.rb +13 -7
  85. data/bin/commands/users_profile.rb +26 -20
  86. data/bin/commands/views.rb +47 -39
  87. data/bin/commands/workflows.rb +36 -30
  88. data/bin/slack +48 -43
  89. data/lib/slack/real_time/api/message.rb +3 -2
  90. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  91. data/lib/slack/real_time/api/typing.rb +2 -1
  92. data/lib/slack/real_time/client.rb +10 -28
  93. data/lib/slack/real_time/config.rb +3 -3
  94. data/lib/slack/real_time/models/channel.rb +4 -0
  95. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  96. data/lib/slack/real_time/models.rb +2 -1
  97. data/lib/slack/real_time/stores/base.rb +25 -9
  98. data/lib/slack/real_time/stores/starter.rb +323 -309
  99. data/lib/slack/real_time/stores/store.rb +265 -198
  100. data/lib/slack/real_time/stores.rb +1 -7
  101. data/lib/slack/version.rb +1 -1
  102. data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
  103. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  104. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
  105. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  106. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  107. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  108. data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
  109. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  110. data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
  111. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  112. data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
  113. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  114. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  115. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  116. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  117. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  118. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  119. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  120. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
  121. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  122. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  123. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  124. data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
  125. data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
  126. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  127. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  128. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  129. data/lib/slack/web/api/endpoints/chat.rb +37 -31
  130. data/lib/slack/web/api/endpoints/conversations.rb +38 -34
  131. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  132. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  133. data/lib/slack/web/api/endpoints/emoji.rb +2 -0
  134. data/lib/slack/web/api/endpoints/files.rb +45 -10
  135. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  136. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  137. data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
  138. data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
  139. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  140. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  141. data/lib/slack/web/api/endpoints/pins.rb +5 -3
  142. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  143. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  144. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  145. data/lib/slack/web/api/endpoints/search.rb +3 -3
  146. data/lib/slack/web/api/endpoints/team.rb +13 -1
  147. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  148. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  149. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  150. data/lib/slack/web/api/endpoints/users.rb +4 -4
  151. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  152. data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
  153. data/lib/slack/web/api/endpoints/views.rb +16 -11
  154. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  155. data/lib/slack/web/api/endpoints.rb +12 -0
  156. data/lib/slack/web/api/errors.rb +146 -8
  157. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  158. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  159. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  160. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  161. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  162. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  163. data/lib/slack/web/api/templates/command.erb +18 -12
  164. data/lib/slack/web/api/templates/method.erb +1 -1
  165. data/lib/slack/web/config.rb +2 -2
  166. data/lib/slack/web/faraday/connection.rb +4 -4
  167. data/lib/slack/web/faraday/request.rb +2 -0
  168. data/lib/slack/web/faraday/response/raise_error.rb +2 -10
  169. data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
  170. data/lib/slack-ruby-client.rb +2 -1
  171. data/lib/tasks/real_time.rake +44 -24
  172. data/lib/tasks/web.rake +9 -8
  173. data/slack-ruby-client.gemspec +5 -14
  174. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  175. data/spec/integration/integration_spec.rb +1 -1
  176. data/spec/slack/events/config_spec.rb +2 -0
  177. data/spec/slack/events/request_spec.rb +5 -1
  178. data/spec/slack/messages/formatting_spec.rb +10 -0
  179. data/spec/slack/real_time/api/message_spec.rb +1 -1
  180. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  181. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  182. data/spec/slack/real_time/client_spec.rb +91 -127
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  184. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  185. data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
  186. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  187. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
  188. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  189. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  190. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  191. data/spec/slack/slack_spec.rb +5 -4
  192. data/spec/slack/version_spec.rb +1 -1
  193. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
  194. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  195. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
  196. data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
  197. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
  198. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
  199. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
  200. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
  201. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
  202. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  203. data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
  204. data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
  205. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  206. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  207. data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
  208. data/spec/slack/web/client_spec.rb +39 -11
  209. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
  210. data/spec/support/real_time/connected_client.rb +1 -1
  211. data/spec/support/real_time/loaded_client.rb +120 -0
  212. metadata +45 -197
  213. data/.travis.yml +0 -29
  214. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  215. data/bin/commands/apps_permissions.rb +0 -23
  216. data/bin/commands/apps_permissions_resources.rb +0 -15
  217. data/bin/commands/apps_permissions_scopes.rb +0 -13
  218. data/bin/commands/apps_permissions_users.rb +0 -26
  219. data/bin/commands/channels.rb +0 -23
  220. data/bin/commands/groups.rb +0 -14
  221. data/bin/commands/im.rb +0 -6
  222. data/bin/commands/mpim.rb +0 -6
  223. data/bin/commands.rb +0 -66
  224. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  225. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  226. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  227. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  228. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  229. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  230. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  231. data/lib/slack/web/api/endpoints/im.rb +0 -13
  232. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  233. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  234. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  235. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  236. data/lib/slack/web/api/templates/commands.erb +0 -6
  237. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  238. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  239. data/spec/slack/real_time/store_spec.rb +0 -12
data/README.md CHANGED
@@ -2,7 +2,8 @@ Slack Ruby Client
2
2
  =================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-client.svg)](http://badge.fury.io/rb/slack-ruby-client)
5
- [![Build Status](https://app.travis-ci.com/slack-ruby/slack-ruby-client.svg?branch=master)](https://app.travis-ci.com/slack-ruby/slack-ruby-client)
5
+ [![Integration Tests](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/integration_test.yml/badge.svg?branch=master)](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/integration_test.yml)
6
+ [![Tests](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/slack-ruby/slack-ruby-client/actions/workflows/test.yml)
6
7
  [![Code Climate](https://codeclimate.com/github/slack-ruby/slack-ruby-client/badges/gpa.svg)](https://codeclimate.com/github/slack-ruby/slack-ruby-client)
7
8
 
8
9
  A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messaging](https://api.slack.com/rtm) and [Events](https://api.slack.com/events-api) APIs. Comes with a handy command-line client, too. If you are not familiar with these concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
@@ -17,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
17
18
  - [Usage](#usage)
18
19
  - [Create a New Bot Integration](#create-a-new-bot-integration)
19
20
  - [OAuth Code Grant](#oauth-code-grant)
20
- - [Using the Legacy API Token](#using-the-legacy-api-token)
21
+ - [Using an API Token](#using-an-api-token)
21
22
  - [Global Settings](#global-settings)
22
23
  - [Web Client](#web-client)
23
24
  - [Web Client Examples](#web-client-examples)
@@ -37,14 +38,13 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
37
38
  - [Rate Limiting](#rate-limiting)
38
39
  - [Other Errors](#other-errors)
39
40
  - [RealTime Client](#realtime-client)
40
- - [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
41
- - [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
42
- - [Configuring Slack::RealTime::Client](#configuring-slackrealtimeclient)
43
- - [Caveats](#caveats)
44
- - [websocket_ping](#websocket_ping)
45
- - [Connection Methods](#connection-methods)
41
+ - [Configuring Slack::RealTime::Client](#configuring-slackrealtimeclient)
42
+ - [Caveats](#caveats)
43
+ - [websocket_ping](#websocket_ping)
44
+ - [RealTime Store](#realtime-store)
45
+ - [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
46
+ - [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
46
47
  - [Combining RealTime and Web Clients](#combining-realtime-and-web-clients)
47
- - [Large Team Considerations](#large-team-considerations)
48
48
  - [Concurrency](#concurrency)
49
49
  - [Async](#async)
50
50
  - [Events API](#events-api)
@@ -54,10 +54,11 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
54
54
  - [Command-Line Client](#command-line-client)
55
55
  - [Authenticate with Slack](#authenticate-with-slack)
56
56
  - [Send a Message](#send-a-message)
57
- - [Get Channel Id](#get-channel-id)
58
57
  - [Get Channel Info](#get-channel-info-1)
59
58
  - [List Users](#list-users)
59
+ - [Enterprise Support](#enterprise-support)
60
60
  - [History](#history)
61
+ - [Security](#security)
61
62
  - [Contributing](#contributing)
62
63
  - [Copyright and License](#copyright-and-license)
63
64
 
@@ -70,7 +71,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
70
71
 
71
72
  ## Stable Release
72
73
 
73
- You're reading the documentation for the **stable** release of slack-ruby-client, v1.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
74
+ You're reading the documentation for the **stable** release of slack-ruby-client, v2.1.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
74
75
 
75
76
  ## Installation
76
77
 
@@ -100,9 +101,9 @@ To integrate your bot with Slack, you must first create a new [Slack App](https:
100
101
 
101
102
  Once created, go to the app's Basic Info tab and grab the Client ID and Client Secret. You'll need these in order complete an [OAuth code grant flow](https://api.slack.com/docs/oauth#flow) as described at [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
102
103
 
103
- ### Using the Legacy API Token
104
+ ### Using an API Token
104
105
 
105
- Although OAuth is recommended, you can still [generate a legacy API token](https://api.slack.com/custom-integrations/legacy-tokens) for your app and use it for some interactions.
106
+ Although OAuth is recommended, you can also [generate an API token](https://api.slack.com/tutorials/tracks/getting-a-token) for your app and use it for some interactions.
106
107
 
107
108
  ```ruby
108
109
  Slack.configure do |config|
@@ -175,7 +176,7 @@ client.files_upload(
175
176
 
176
177
  ##### Get Channel Info
177
178
 
178
- You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `conversations_list` in order to locate the channel ID.
179
+ You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `conversations_list` in order to locate the channel ID. This invocation can have a cost if you have many Slack channels. In this scenario, we encourage you to use channel id.
179
180
 
180
181
  ```ruby
181
182
  client.conversations_info(channel: 'C04KB5X4D') # calls conversations_info
@@ -373,32 +374,7 @@ You can send a ping with `ping`.
373
374
  client.ping
374
375
  ```
375
376
 
376
- By default, the RealTime client exposes and maintains a local store with the properties of [rtm.start](https://api.slack.com/methods/rtm.start) upon a successful connection.
377
-
378
- property | description
379
- ---------|-------------------------------------------------------------------------------------------------
380
- url | A WebSocket Message Server URL.
381
- self | The authenticated bot user.
382
- team | Details on the authenticated user's team.
383
- users | A hash of user objects by user ID.
384
- channels | A hash of channel objects, one for every channel visible to the authenticated user.
385
- groups | A hash of group objects, one for every group the authenticated user is in.
386
- ims | A hash of IM objects, one for every direct message channel visible to the authenticated user.
387
- bots | Details of the integrations set up on this team.
388
-
389
- It also tracks changes, such as users being renamed, added or deleted, therefore `client.users` is always up-to-date.
390
-
391
- Tracking with a local store can be disabled with `Slack::RealTime::Client.new(store_class: nil)`. Other stores are also available.
392
-
393
- #### Slack::RealTime::Stores::Store
394
-
395
- The default store that tracks all changes. By default the client will be connected using `rtm_start`.
396
-
397
- #### Slack::RealTime::Stores::Starter
398
-
399
- A smaller store that only stores and tracks information about the bot user, but not channels, users, groups, ims or bots. By default the client will be connected using `rtm_connect`.
400
-
401
- ### Configuring Slack::RealTime::Client
377
+ #### Configuring Slack::RealTime::Client
402
378
 
403
379
  You can configure the RealTime client either globally or via the initializer.
404
380
 
@@ -419,20 +395,21 @@ setting | description
419
395
  token | Slack API token.
420
396
  websocket_ping | How long the socket can be idle before sending a ping message to confirm it's still connected, default is 30.
421
397
  websocket_proxy | Connect via proxy, include `:origin` and `:headers`.
422
- store_class | Local store class name, default is an in-memory `Slack::RealTime::Stores::Store`.
423
- start_method | Optional start method, either `:rtm_start` or `:rtm_connect`.
424
- start_options | Options to pass into `rtm.start` or `rtm.connect`, default is `{ request: { timeout: 180 } }`.
398
+ start_options | Options to pass to `rtm.connect`, default is `{ request: { timeout: 180 } }`.
399
+ store_class | Local store class, default is an in-memory `Slack::RealTime::Stores::Starter`.
400
+ store_options | Options to initialize the store, default is `{}`.
425
401
  logger | Optional `Logger` instance that logs RealTime requests and socket data.
426
402
 
427
- Note that the RealTime client uses a Web client to obtain the WebSocket URL via [rtm.start](https://api.slack.com/methods/rtm.start) or [rtm.connect](https://api.slack.com/methods/rtm.connect). While `token` and `logger` options are passed down from the RealTime client, you may also configure Web client options via `Slack::Web::Client.configure` as described above.
403
+ Note that the RealTime client uses a Web client to obtain the WebSocket URL via [rtm.connect](https://api.slack.com/methods/rtm.connect). While `token` and `logger` options are passed down from the RealTime client, you may also configure Web client options via `Slack::Web::Client.configure` as described above.
428
404
 
429
- See a fully working example in [examples/hi_real_time](examples/hi_real_time/hi.rb).
405
+ See a fully working example in [examples/hi_real_time_and_web](examples/hi_real_time_and_web/hi.rb).
406
+
407
+ ![](examples/hi_real_time_and_web/hi.gif)
430
408
 
431
- ![](examples/hi_real_time/hi.gif)
409
+ ##### Caveats
432
410
 
433
- #### Caveats
411
+ ###### `websocket_ping`
434
412
 
435
- ##### `websocket_ping`
436
413
  This setting determines how long the socket can be idle before sending a ping message to confirm it's still connected.
437
414
 
438
415
  It's important to note that if a ping message was sent and no response was received within the amount of time specified in `websocket_ping` the client will attempt to reestablish it's connection to the message server.
@@ -441,15 +418,54 @@ Note that the ping may take between `websocket_ping` and `websocket_ping * 3/2`
441
418
 
442
419
  To disable this feature set `websocket_ping` to 0.
443
420
 
444
- ### Connection Methods
421
+ #### RealTime Store
445
422
 
446
- The RealTime client uses either [rtm.start](https://api.slack.com/methods/rtm.start) or [rtm.connect](https://api.slack.com/methods/rtm.connect) to open a connection. The former retrieves a lot of team information while the latter only serves connection purposes and is preferred. You should let the library choose the right method for you based on the `store_class` used and override this behavior with `start_method` when necessary.
423
+ The RealTime client exposes and maintains a local store upon successful connection.
424
+ Event hooks keep the store's cached data up-to-date.
447
425
 
426
+ Tracking with a local store can be disabled with `Slack::RealTime::Client.new(store_class: nil)`.
427
+
428
+ ##### `Slack::RealTime::Stores::Starter`
429
+
430
+ A small store that only caches and tracks data returned in the [rtm.connect](https://api.slack.com/methods/rtm.connect#examples) response.
431
+ This store provides `self` and `team` for accessing the limited data about the authenticated user and its workspace, but does not cache other users or bots, channels, or direct messages.
432
+
433
+ ##### `Slack::RealTime::Stores::Store`
434
+
435
+ A more complete store that tracks most changes visible to the authenticated user.
436
+
437
+ You can see all of the cache types in the table below (each is a hash indexed by its objects' `id`).
438
+
439
+ Cache | Description
440
+ -------------------|-------------------------------------------------------------------------------------------------
441
+ `teams` | Workspaces (teams). Will likely contain only one `team`.
442
+ `users` | All [user](https://api.slack.com/types/user) objects, including `self`.
443
+ `bots` | All [bot users](https://api.slack.com/bot-users) (from Slack Apps and legacy custom integrations).
444
+ `public_channels` | Public [conversation](https://api.slack.com/types/conversation) objects.
445
+ `private_channels` | Private [conversation](https://api.slack.com/types/conversation) and [group](https://api.slack.com/types/group) objects with the authenticated user as a member.
446
+ `ims` | Visible [im](https://api.slack.com/types/im) objects, direct message channels with the authenticated user.
447
+ `mpims` | Visible [mpim](https://api.slack.com/types/mpim) objects, multiparty direct message channels that include the authenticated user.
448
+
449
+ By default, none of these caches are initialized with data beyond what is returned from [rtm.connect](https://api.slack.com/methods/rtm.connect#examples), same as [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter).
450
+ When configured, this store initializes its caches by making additional calls to Web API methods upon successful connection to the RTM API (i.e. "hello" message).
451
+
452
+ Configure by specifying which caches to fetch:
448
453
  ```ruby
449
454
  Slack::RealTime::Client.configure do |config|
450
- config.start_method = :rtm_start
455
+ config.store_class = Slack::RealTime::Stores::Store
456
+ config.store_options = { caches: %i[teams users public_channels private_channels ims] }
451
457
  end
452
458
  ```
459
+ or with the `:all` option:
460
+ ```ruby
461
+ Slack::RealTime::Client.configure do |config|
462
+ config.store_class = Slack::RealTime::Stores::Store
463
+ config.store_options = { caches: :all }
464
+ end
465
+ ```
466
+
467
+ Note: For `teams`, this makes a single call to `team.info`, while for `users` and all conversation-like types, this makes paginated calls to `users.list` and `conversations.list` respectively.
468
+ Only `bots` requires a separate call for every bot user, so may be slow if your workplace has a lot of bot users.
453
469
 
454
470
  ### Combining RealTime and Web Clients
455
471
 
@@ -474,23 +490,6 @@ See a fully working example in [examples/hi_real_time_and_web](examples/hi_real_
474
490
 
475
491
  ![](examples/hi_real_time_and_web/hi.gif)
476
492
 
477
- ### Large Team Considerations
478
-
479
- The `rtm.start` call downloads a large amount of data. For large teams, consider reducing the amount of unnecessary data downloaded with `start_options`. You may also want to increase the default timeout of 180 seconds.
480
-
481
- ```ruby
482
- Slack::RealTime::Client.configure do |config|
483
- # Return timestamp only for latest message object of each channel.
484
- config.start_options[:simple_latest] = true
485
- # Skip unread counts for each channel.
486
- config.start_options[:no_unreads] = true
487
- # Increase request timeout to 6 minutes.
488
- config.start_options[:request][:timeout] = 360
489
- end
490
- ```
491
-
492
- See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a discussion on this topic.
493
-
494
493
  #### Concurrency
495
494
 
496
495
  `Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async).
@@ -604,17 +603,10 @@ $ slack chat postMessage --text="hello world" --channel="#general"
604
603
  {"ok":true,"channel":"...","ts":"...","message":{"text":"hello world","username":"bot","type":"message","subtype":"bot_message","ts":"..."}}
605
604
  ```
606
605
 
607
- #### Get Channel Id
608
-
609
- ```
610
- $ slack channels id --channel=#general
611
- {"ok":true,"channel":{"id":"C04KB5X4D"}}
612
- ```
613
-
614
606
  #### Get Channel Info
615
607
 
616
608
  ```
617
- $ slack channels info --channel=#general
609
+ $ slack conversations info --channel=#general
618
610
  {"ok":true,"channel":{"id":"C04KB5X4D","name":"general", ...}}
619
611
  ```
620
612
 
@@ -636,10 +628,20 @@ $ slack users list | jq '.members | map({(.id): .name})'
636
628
 
637
629
  See `slack help` for a complete command-line reference.
638
630
 
631
+ ## Enterprise Support
632
+
633
+ Available as part of the Tidelift Subscription.
634
+
635
+ The maintainers of slack-ruby-client are working with Tidelift to deliver commercial support and maintenance. Save time, reduce risk, and improve code health, while paying the maintainers of slack-ruby-client. Click [here](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-slack-ruby-client&utm_medium=referral&utm_campaign=enterprise) for more details.
636
+
639
637
  ## History
640
638
 
641
639
  This gem is based on [slack-ruby-gem](https://github.com/aki017/slack-ruby-gem), but it more clearly separates the Web and RTM APIs, is more thoroughly tested and is in active development.
642
640
 
641
+ ## Security
642
+
643
+ See [SECURITY](SECURITY.md).
644
+
643
645
  ## Contributing
644
646
 
645
647
  See [CONTRIBUTING](CONTRIBUTING.md).
data/RELEASING.md CHANGED
@@ -11,7 +11,7 @@ bundle install
11
11
  rake
12
12
  ```
13
13
 
14
- Check that the last build succeeded in [Travis CI](https://app.travis-ci.com/github/slack-ruby/slack-ruby-client) for all supported platforms.
14
+ Check that the last build succeeded in [GitHub Actions](https://github.com/slack-ruby/slack-ruby-client/actions) for all supported platforms.
15
15
 
16
16
  Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
17
17
 
@@ -21,7 +21,7 @@ Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
21
21
 
22
22
  Remove the line with "Your contribution here.", since there will be no more contributions to this release.
23
23
 
24
- In the "Stable Release" section of the README, change `**next**` to `**stable**` so users know that they are reading the documentation for a released version.
24
+ In the "Stable Release" section of the README, change `**next**` to `**stable**` and add the version number so users know that they are reading the documentation for a released version.
25
25
 
26
26
  ```
27
27
  ## Stable Release
data/SECURITY.md ADDED
@@ -0,0 +1,9 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Version 2.0 or newer is currently supported.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Tidelift acts as the security contact for this open-source project. To make a report, please email the security team at [security@tidelift.com](mailto:security@tidelift.com). Please do not create a public GitHub issue. See [tidelift.com/security](https://tidelift.com/security) for details and more options.
data/UPGRADING.md CHANGED
@@ -1,6 +1,34 @@
1
1
  Upgrading Slack-Ruby-Client
2
2
  ===========================
3
3
 
4
+ ### Upgrading to >= 2.0.0
5
+
6
+ [#416](https://github.com/slack-ruby/slack-ruby-client/pull/416) Removes default values for Faraday's SSL settings `ca_file` and `ca_path`.
7
+
8
+ If you previously relied on `OpenSSL::X509::DEFAULT_CERT_FILE` or `OpenSSL::X509::DEFAULT_CERT_DIR` to set these values you must now do so explicitly. E.g.:
9
+
10
+ ```ruby
11
+ Slack::Web::Client.configure do |config|
12
+ config.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE
13
+ config.ca_path = OpenSSL::X509::DEFAULT_CERT_DIR
14
+ end
15
+ ```
16
+
17
+ or
18
+
19
+ ```ruby
20
+ client = Slack::Web::Client.new(ca_file: OpenSSL::X509::DEFAULT_CERT_FILE, ca_path: OpenSSL::X509::DEFAULT_CERT_DIR)
21
+ ```
22
+
23
+ #### RealTime Stores
24
+
25
+ Slack has deprecated the `rtm.start` method and [replaced its response](https://api.slack.com/changelog/2021-10-rtm-start-to-stop) with that of `rtm.connect`, so it has been removed from the library along with the `start_method` configuration ([#419](https://github.com/slack-ruby/slack-ruby-client/pull/419)) and `Slack::RealTime::Stores::Starter` is now the default store.
26
+ If your app still relies on the old `rtm.start` behavior, you can achieve a similar result with `Slack::RealTime::Stores::Store`, which initializes itself using Web API methods (see [README](README.md#slackrealtimestoresstore)).
27
+
28
+ The names of the Store caches `channels` and `groups` have been changed to `public_channels` and `private_channels` to reflect their true meaning.
29
+ This is consistent with the [Slack Web API](https://api.slack.com/methods/conversations.list#arg_types), although [event types for private channels](https://api.slack.com/events?query=group) still use the term `group`.
30
+ In both cases, private channels consist of both [conversation types](https://api.slack.com/types/conversation) (`id: 'C...'', is_channel: true, is_group: false, is_private: true`) and [group types](https://api.slack.com/types/group) (`id: 'G...', is_channel: false, is_group: true, is_private: true`) depending whether the object was created before or after March 2021.
31
+
4
32
  ### Upgrading to >= 1.0.0
5
33
 
6
34
  #### Deprecated Methods
@@ -1,16 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'AdminAnalytics methods.'
5
- command 'admin_analytics' do |g|
6
- g.desc 'Retrieve analytics data for a given date, presented as a compressed JSON file'
7
- g.long_desc %( Retrieve analytics data for a given date, presented as a compressed JSON file )
8
- g.command 'getFile' do |c|
9
- c.flag 'type', desc: 'The type of analytics to retrieve. The options are currently limited to member (for grid member analytics) and public_channel (for public channel analytics).'
10
- c.flag 'date', desc: 'Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC.'
11
- c.flag 'metadata_only', desc: 'Retrieve metadata for the type of analytics indicated. Can be used only with type set to public_channel analytics. See detail below. Omit the date parameter when using this argument.'
12
- c.action do |_global_options, options, _args|
13
- puts JSON.dump($client.admin_analytics_getFile(options))
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminAnalytics methods.'
8
+ command 'admin_analytics' do |g|
9
+ g.desc 'Retrieve analytics data for a given date, presented as a compressed JSON file'
10
+ g.long_desc %( Retrieve analytics data for a given date, presented as a compressed JSON file )
11
+ g.command 'getFile' do |c|
12
+ c.flag 'type', desc: 'The type of analytics to retrieve. The options are currently limited to member (for grid member analytics) and public_channel (for public channel analytics).'
13
+ c.flag 'date', desc: 'Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC. Required unless metadata_only is set to true.'
14
+ c.flag 'metadata_only', desc: 'Retrieve metadata for the type of analytics indicated. Can be used only with type set to public_channel analytics. See detail below. Omit the date parameter when using this argument.'
15
+ c.action do |_global_options, options, _args|
16
+ puts JSON.dump(@client.admin_analytics_getFile(options))
17
+ end
18
+ end
19
+ end
14
20
  end
15
21
  end
16
22
  end
@@ -1,51 +1,57 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'AdminApps methods.'
5
- command 'admin_apps' do |g|
6
- g.desc 'Approve an app for installation on a workspace.'
7
- g.long_desc %( Approve an app for installation on a workspace. )
8
- g.command 'approve' do |c|
9
- c.flag 'app_id', desc: 'The id of the app to approve.'
10
- c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
11
- c.flag 'request_id', desc: 'The id of the request to approve.'
12
- c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
13
- c.action do |_global_options, options, _args|
14
- puts JSON.dump($client.admin_apps_approve(options))
15
- end
16
- end
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminApps methods.'
8
+ command 'admin_apps' do |g|
9
+ g.desc 'Approve an app for installation on a workspace.'
10
+ g.long_desc %( Approve an app for installation on a workspace. )
11
+ g.command 'approve' do |c|
12
+ c.flag 'app_id', desc: 'The id of the app to approve.'
13
+ c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
14
+ c.flag 'request_id', desc: 'The id of the request to approve.'
15
+ c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
16
+ c.action do |_global_options, options, _args|
17
+ puts JSON.dump(@client.admin_apps_approve(options))
18
+ end
19
+ end
17
20
 
18
- g.desc 'Clear an app resolution'
19
- g.long_desc %( Clear an app resolution )
20
- g.command 'clearResolution' do |c|
21
- c.flag 'app_id', desc: 'The id of the app whose resolution you want to clear/undo.'
22
- c.flag 'enterprise_id', desc: 'The enterprise to clear the app resolution from.'
23
- c.flag 'team_id', desc: 'The workspace to clear the app resolution from.'
24
- c.action do |_global_options, options, _args|
25
- puts JSON.dump($client.admin_apps_clearResolution(options))
26
- end
27
- end
21
+ g.desc 'Clear an app resolution'
22
+ g.long_desc %( Clear an app resolution )
23
+ g.command 'clearResolution' do |c|
24
+ c.flag 'app_id', desc: 'The id of the app whose resolution you want to clear/undo.'
25
+ c.flag 'enterprise_id', desc: 'The enterprise to clear the app resolution from.'
26
+ c.flag 'team_id', desc: 'The workspace to clear the app resolution from.'
27
+ c.action do |_global_options, options, _args|
28
+ puts JSON.dump(@client.admin_apps_clearResolution(options))
29
+ end
30
+ end
28
31
 
29
- g.desc 'Restrict an app for installation on a workspace.'
30
- g.long_desc %( Restrict an app for installation on a workspace. )
31
- g.command 'restrict' do |c|
32
- c.flag 'app_id', desc: 'The id of the app to restrict.'
33
- c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
34
- c.flag 'request_id', desc: 'The id of the request to restrict.'
35
- c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
36
- c.action do |_global_options, options, _args|
37
- puts JSON.dump($client.admin_apps_restrict(options))
38
- end
39
- end
32
+ g.desc 'Restrict an app for installation on a workspace.'
33
+ g.long_desc %( Restrict an app for installation on a workspace. )
34
+ g.command 'restrict' do |c|
35
+ c.flag 'app_id', desc: 'The id of the app to restrict.'
36
+ c.flag 'enterprise_id', desc: 'The ID of the enterprise to approve the app on.'
37
+ c.flag 'request_id', desc: 'The id of the request to restrict.'
38
+ c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
39
+ c.action do |_global_options, options, _args|
40
+ puts JSON.dump(@client.admin_apps_restrict(options))
41
+ end
42
+ end
40
43
 
41
- g.desc 'Uninstall an app from one or many workspaces, or an entire enterprise organization.'
42
- g.long_desc %( Uninstall an app from one or many workspaces, or an entire enterprise organization. )
43
- g.command 'uninstall' do |c|
44
- c.flag 'app_id', desc: 'The ID of the app to uninstall.'
45
- c.flag 'enterprise_id', desc: 'The enterprise to completely uninstall the application from (across all workspaces). With an org-level token, this or team_ids is required.'
46
- c.flag 'team_ids', desc: 'IDs of the teams to uninstall from (max 100). With an org-level token, this or enterprise_id is required.'
47
- c.action do |_global_options, options, _args|
48
- puts JSON.dump($client.admin_apps_uninstall(options))
44
+ g.desc 'Uninstall an app from one or many workspaces, or an entire enterprise organization.'
45
+ g.long_desc %( Uninstall an app from one or many workspaces, or an entire enterprise organization. )
46
+ g.command 'uninstall' do |c|
47
+ c.flag 'app_id', desc: 'The ID of the app to uninstall.'
48
+ c.flag 'enterprise_id', desc: 'The enterprise to completely uninstall the application from (across all workspaces). With an org-level token, this or team_ids is required.'
49
+ c.flag 'team_ids', desc: 'IDs of the teams to uninstall from (max 100). With an org-level token, this or enterprise_id is required.'
50
+ c.action do |_global_options, options, _args|
51
+ puts JSON.dump(@client.admin_apps_uninstall(options))
52
+ end
53
+ end
54
+ end
49
55
  end
50
56
  end
51
57
  end
@@ -1,17 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'AdminAppsApproved methods.'
5
- command 'admin_apps_approved' do |g|
6
- g.desc 'List approved apps for an org or workspace.'
7
- g.long_desc %( List approved apps for an org or workspace. )
8
- g.command 'list' do |c|
9
- c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
10
- c.flag 'enterprise_id', desc: '.'
11
- c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
12
- c.flag 'team_id', desc: '.'
13
- c.action do |_global_options, options, _args|
14
- puts JSON.dump($client.admin_apps_approved_list(options))
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminAppsApproved methods.'
8
+ command 'admin_apps_approved' do |g|
9
+ g.desc 'List approved apps for an org or workspace.'
10
+ g.long_desc %( List approved apps for an org or workspace. )
11
+ g.command 'list' do |c|
12
+ c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
13
+ c.flag 'enterprise_id', desc: '.'
14
+ c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
15
+ c.flag 'team_id', desc: '.'
16
+ c.action do |_global_options, options, _args|
17
+ puts JSON.dump(@client.admin_apps_approved_list(options))
18
+ end
19
+ end
20
+ end
15
21
  end
16
22
  end
17
23
  end
@@ -1,17 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'AdminAppsRequests methods.'
5
- command 'admin_apps_requests' do |g|
6
- g.desc 'List app requests for a team/workspace.'
7
- g.long_desc %( List app requests for a team/workspace. )
8
- g.command 'list' do |c|
9
- c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
10
- c.flag 'enterprise_id', desc: '.'
11
- c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
12
- c.flag 'team_id', desc: '.'
13
- c.action do |_global_options, options, _args|
14
- puts JSON.dump($client.admin_apps_requests_list(options))
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminAppsRequests methods.'
8
+ command 'admin_apps_requests' do |g|
9
+ g.desc 'Cancel app request for team'
10
+ g.long_desc %( Cancel app request for team )
11
+ g.command 'cancel' do |c|
12
+ c.flag 'request_id', desc: 'The id of the request to cancel.'
13
+ c.flag 'enterprise_id', desc: 'The ID of the enterprise where this request belongs.'
14
+ c.flag 'team_id', desc: 'The ID of the workspace where this request belongs.'
15
+ c.action do |_global_options, options, _args|
16
+ puts JSON.dump(@client.admin_apps_requests_cancel(options))
17
+ end
18
+ end
19
+
20
+ g.desc 'List app requests for a team/workspace.'
21
+ g.long_desc %( List app requests for a team/workspace. )
22
+ g.command 'list' do |c|
23
+ c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
24
+ c.flag 'enterprise_id', desc: '.'
25
+ c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
26
+ c.flag 'team_id', desc: '.'
27
+ c.action do |_global_options, options, _args|
28
+ puts JSON.dump(@client.admin_apps_requests_list(options))
29
+ end
30
+ end
31
+ end
15
32
  end
16
33
  end
17
34
  end
@@ -1,17 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'AdminAppsRestricted methods.'
5
- command 'admin_apps_restricted' do |g|
6
- g.desc 'List restricted apps for an org or workspace.'
7
- g.long_desc %( List restricted apps for an org or workspace. )
8
- g.command 'list' do |c|
9
- c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
10
- c.flag 'enterprise_id', desc: '.'
11
- c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
12
- c.flag 'team_id', desc: '.'
13
- c.action do |_global_options, options, _args|
14
- puts JSON.dump($client.admin_apps_restricted_list(options))
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminAppsRestricted methods.'
8
+ command 'admin_apps_restricted' do |g|
9
+ g.desc 'List restricted apps for an org or workspace.'
10
+ g.long_desc %( List restricted apps for an org or workspace. )
11
+ g.command 'list' do |c|
12
+ c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
13
+ c.flag 'enterprise_id', desc: '.'
14
+ c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
15
+ c.flag 'team_id', desc: '.'
16
+ c.action do |_global_options, options, _args|
17
+ puts JSON.dump(@client.admin_apps_restricted_list(options))
18
+ end
19
+ end
20
+ end
15
21
  end
16
22
  end
17
23
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Cli
6
+ class App
7
+ desc 'AdminAuditAnomalyAllow methods.'
8
+ command 'admin_audit_anomaly_allow' do |g|
9
+ g.desc 'API to allow enterprise grid admins to read the allow list of IP blocks and ASNs from the enterprise configuration.'
10
+ g.long_desc %( API to allow enterprise grid admins to read the allow list of IP blocks and ASNs from the enterprise configuration. )
11
+ g.command 'getItem' do |c|
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump(@client.admin_audit_anomaly_allow_getItem(options))
14
+ end
15
+ end
16
+
17
+ g.desc 'API to allow enterprise grid admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration.'
18
+ g.long_desc %( API to allow enterprise grid admins to write/overwrite the allow list of IP blocks and ASNs from the enterprise configuration. )
19
+ g.command 'updateItem' do |c|
20
+ c.flag 'trusted_asns', desc: 'allow list of Autonomous System Numbers (ASN) in the enterprise grid configuarion.'
21
+ c.flag 'trusted_cidr', desc: 'allow list of IPv4 addressses using cidr notation in the enterprise grid configuarion.'
22
+ c.action do |_global_options, options, _args|
23
+ puts JSON.dump(@client.admin_audit_anomaly_allow_updateItem(options))
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end