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.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/integration_test.yml +45 -0
- data/.github/workflows/lint.yml +14 -0
- data/.github/workflows/pr_lint.yml +21 -0
- data/.github/workflows/test.yml +37 -0
- data/.gitignore +4 -3
- data/.rubocop.yml +6 -1
- data/.rubocop_todo.yml +88 -34
- data/.ruby-version +1 -0
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +6 -5
- data/Gemfile +13 -1
- data/Gemfile.danger +6 -0
- data/README.md +78 -76
- data/RELEASING.md +2 -2
- data/SECURITY.md +9 -0
- data/UPGRADING.md +28 -0
- data/bin/commands/admin_analytics.rb +16 -10
- data/bin/commands/admin_apps.rb +48 -42
- data/bin/commands/admin_apps_approved.rb +17 -11
- data/bin/commands/admin_apps_requests.rb +28 -11
- data/bin/commands/admin_apps_restricted.rb +17 -11
- data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
- data/bin/commands/admin_auth_policy.rb +37 -31
- data/bin/commands/admin_barriers.rb +44 -38
- data/bin/commands/admin_conversations.rb +221 -163
- data/bin/commands/admin_conversations_ekm.rb +17 -11
- data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
- data/bin/commands/admin_emoji.rb +50 -44
- data/bin/commands/admin_inviteRequests.rb +34 -28
- data/bin/commands/admin_inviteRequests_approved.rb +16 -10
- data/bin/commands/admin_inviteRequests_denied.rb +16 -10
- data/bin/commands/admin_roles.rb +46 -0
- data/bin/commands/admin_teams.rb +26 -20
- data/bin/commands/admin_teams_admins.rb +16 -10
- data/bin/commands/admin_teams_owners.rb +16 -10
- data/bin/commands/admin_teams_settings.rb +59 -53
- data/bin/commands/admin_usergroups.rb +45 -39
- data/bin/commands/admin_users.rb +91 -85
- data/bin/commands/admin_users_session.rb +72 -66
- data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
- data/bin/commands/api.rb +14 -8
- data/bin/commands/apps.rb +15 -9
- data/bin/commands/apps_connections.rb +13 -7
- data/bin/commands/apps_event_authorizations.rb +16 -10
- data/bin/commands/apps_manifest.rb +48 -41
- data/bin/commands/auth.rb +21 -15
- data/bin/commands/auth_teams.rb +16 -10
- data/bin/commands/bookmarks.rb +59 -0
- data/bin/commands/bots.rb +15 -9
- data/bin/commands/calls.rb +49 -43
- data/bin/commands/calls_participants.rb +24 -18
- data/bin/commands/chat.rb +150 -141
- data/bin/commands/chat_scheduledMessages.rb +19 -13
- data/bin/commands/conversations.rb +233 -225
- data/bin/commands/dialog.rb +15 -9
- data/bin/commands/dnd.rb +46 -40
- data/bin/commands/emoji.rb +14 -7
- data/bin/commands/files.rb +112 -83
- data/bin/commands/files_comments.rb +15 -9
- data/bin/commands/files_remote.rb +73 -67
- data/bin/commands/functions_workflows_steps.rb +22 -0
- data/bin/commands/functions_workflows_steps_responses.rb +22 -0
- data/bin/commands/migration.rb +16 -10
- data/bin/commands/oauth.rb +18 -12
- data/bin/commands/oauth_v2.rb +28 -22
- data/bin/commands/openid_connect.rb +26 -20
- data/bin/commands/pins.rb +33 -26
- data/bin/commands/reactions.rb +52 -46
- data/bin/commands/reminders.rb +53 -47
- data/bin/commands/rtm.rb +15 -24
- data/bin/commands/search.rb +43 -37
- data/bin/commands/stars.rb +38 -32
- data/bin/commands/team.rb +47 -38
- data/bin/commands/team_billing.rb +13 -7
- data/bin/commands/team_preferences.rb +13 -7
- data/bin/commands/team_profile.rb +14 -8
- data/bin/commands/tooling_tokens.rb +14 -8
- data/bin/commands/usergroups.rb +64 -58
- data/bin/commands/usergroups_users.rb +27 -21
- data/bin/commands/users.rb +111 -105
- data/bin/commands/users_admin.rb +28 -22
- data/bin/commands/users_prefs.rb +13 -7
- data/bin/commands/users_profile.rb +26 -20
- data/bin/commands/views.rb +47 -39
- data/bin/commands/workflows.rb +36 -30
- data/bin/slack +48 -43
- data/lib/slack/real_time/api/message.rb +3 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
- data/lib/slack/real_time/api/typing.rb +2 -1
- data/lib/slack/real_time/client.rb +10 -28
- data/lib/slack/real_time/config.rb +3 -3
- data/lib/slack/real_time/models/channel.rb +4 -0
- data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
- data/lib/slack/real_time/models.rb +2 -1
- data/lib/slack/real_time/stores/base.rb +25 -9
- data/lib/slack/real_time/stores/starter.rb +323 -309
- data/lib/slack/real_time/stores/store.rb +265 -198
- data/lib/slack/real_time/stores.rb +1 -7
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
- data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
- data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
- data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/calls.rb +5 -5
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +37 -31
- data/lib/slack/web/api/endpoints/conversations.rb +38 -34
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +1 -1
- data/lib/slack/web/api/endpoints/emoji.rb +2 -0
- data/lib/slack/web/api/endpoints/files.rb +45 -10
- data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
- data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
- data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
- data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +5 -3
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +0 -23
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +13 -1
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
- data/lib/slack/web/api/endpoints/users.rb +4 -4
- data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
- data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/views.rb +16 -11
- data/lib/slack/web/api/endpoints/workflows.rb +4 -4
- data/lib/slack/web/api/endpoints.rb +12 -0
- data/lib/slack/web/api/errors.rb +146 -8
- data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +2 -1
- data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
- data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
- data/lib/slack/web/api/patches/views.view-json.patch +55 -0
- data/lib/slack/web/api/templates/command.erb +18 -12
- data/lib/slack/web/api/templates/method.erb +1 -1
- data/lib/slack/web/config.rb +2 -2
- data/lib/slack/web/faraday/connection.rb +4 -4
- data/lib/slack/web/faraday/request.rb +2 -0
- data/lib/slack/web/faraday/response/raise_error.rb +2 -10
- data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
- data/lib/slack-ruby-client.rb +2 -1
- data/lib/tasks/real_time.rake +44 -24
- data/lib/tasks/web.rake +9 -8
- data/slack-ruby-client.gemspec +5 -14
- data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/slack/events/config_spec.rb +2 -0
- data/spec/slack/events/request_spec.rb +5 -1
- data/spec/slack/messages/formatting_spec.rb +10 -0
- data/spec/slack/real_time/api/message_spec.rb +1 -1
- data/spec/slack/real_time/api/ping_spec.rb +1 -1
- data/spec/slack/real_time/api/typing_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +91 -127
- data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
- data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
- data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
- data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
- data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
- data/spec/slack/real_time/stores/store_spec.rb +50 -0
- data/spec/slack/slack_spec.rb +5 -4
- data/spec/slack/version_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
- data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
- data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
- data/spec/slack/web/api/mixins/users_spec.rb +2 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
- data/spec/slack/web/client_spec.rb +39 -11
- data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
- data/spec/support/real_time/connected_client.rb +1 -1
- data/spec/support/real_time/loaded_client.rb +120 -0
- metadata +45 -197
- data/.travis.yml +0 -29
- data/bin/commands/admin_conversations_whitelist.rb +0 -37
- data/bin/commands/apps_permissions.rb +0 -23
- data/bin/commands/apps_permissions_resources.rb +0 -15
- data/bin/commands/apps_permissions_scopes.rb +0 -13
- data/bin/commands/apps_permissions_users.rb +0 -26
- data/bin/commands/channels.rb +0 -23
- data/bin/commands/groups.rb +0 -14
- data/bin/commands/im.rb +0 -6
- data/bin/commands/mpim.rb +0 -6
- data/bin/commands.rb +0 -66
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
- data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
- data/lib/slack/web/api/endpoints/channels.rb +0 -25
- data/lib/slack/web/api/endpoints/groups.rb +0 -13
- data/lib/slack/web/api/endpoints/im.rb +0 -13
- data/lib/slack/web/api/endpoints/mpim.rb +0 -13
- data/lib/slack/web/api/endpoints/presence.rb +0 -23
- data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
- data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
- data/lib/slack/web/api/templates/commands.erb +0 -6
- data/spec/fixtures/slack/web/rtm_start.yml +0 -815
- data/spec/slack/real_time/rtm_start_spec.rb +0 -14
- 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
|
-
[![
|
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
|
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::
|
41
|
-
|
42
|
-
|
43
|
-
- [
|
44
|
-
- [
|
45
|
-
|
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,
|
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
|
104
|
+
### Using an API Token
|
104
105
|
|
105
|
-
Although OAuth is recommended, you can
|
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
|
-
|
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
|
-
|
423
|
-
|
424
|
-
|
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.
|
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/
|
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
|
-
|
409
|
+
##### Caveats
|
432
410
|
|
433
|
-
|
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
|
-
|
421
|
+
#### RealTime Store
|
445
422
|
|
446
|
-
The RealTime client
|
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.
|
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
|
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 [
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
data/bin/commands/admin_apps.rb
CHANGED
@@ -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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|