slack-ruby-client 0.15.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -1
- data/.rubocop_todo.yml +75 -43
- data/.travis.yml +2 -4
- data/CHANGELOG.md +32 -0
- data/CONTRIBUTING.md +6 -13
- data/LICENSE.md +1 -1
- data/README.md +19 -36
- data/RELEASING.md +1 -1
- data/UPGRADING.md +56 -2
- data/bin/commands/admin_analytics.rb +16 -0
- data/bin/commands/admin_apps.rb +26 -2
- data/bin/commands/admin_apps_requests.rb +1 -0
- data/bin/commands/admin_auth_policy.rb +39 -0
- data/bin/commands/admin_barriers.rb +47 -0
- data/bin/commands/admin_conversations.rb +154 -2
- data/bin/commands/admin_conversations_ekm.rb +17 -0
- data/bin/commands/admin_conversations_restrictAccess.rb +3 -3
- data/bin/commands/admin_conversations_whitelist.rb +1 -1
- data/bin/commands/admin_emoji.rb +1 -1
- data/bin/commands/admin_teams.rb +1 -1
- data/bin/commands/admin_usergroups.rb +2 -2
- data/bin/commands/admin_users.rb +3 -2
- data/bin/commands/admin_users_session.rb +62 -0
- data/bin/commands/api.rb +0 -1
- data/bin/commands/apps_connections.rb +13 -0
- data/bin/commands/apps_event_authorizations.rb +16 -0
- data/bin/commands/apps_manifest.rb +51 -0
- data/bin/commands/auth_teams.rb +16 -0
- data/bin/commands/bots.rb +1 -0
- data/bin/commands/channels.rb +1 -155
- data/bin/commands/chat.rb +12 -7
- data/bin/commands/chat_scheduledMessages.rb +1 -0
- data/bin/commands/conversations.rb +71 -2
- data/bin/commands/dnd.rb +2 -0
- data/bin/commands/files.rb +6 -4
- data/bin/commands/files_remote.rb +2 -2
- data/bin/commands/groups.rb +1 -162
- data/bin/commands/im.rb +1 -63
- data/bin/commands/migration.rb +1 -0
- data/bin/commands/mpim.rb +1 -61
- data/bin/commands/oauth.rb +0 -13
- data/bin/commands/oauth_v2.rb +13 -1
- data/bin/commands/openid_connect.rb +27 -0
- data/bin/commands/pins.rb +2 -4
- data/bin/commands/reactions.rb +1 -0
- data/bin/commands/reminders.rb +6 -0
- data/bin/commands/rtm.rb +2 -2
- data/bin/commands/search.rb +4 -0
- data/bin/commands/stars.rb +7 -6
- data/bin/commands/team.rb +3 -0
- data/bin/commands/team_billing.rb +13 -0
- data/bin/commands/team_preferences.rb +13 -0
- data/bin/commands/tooling_tokens.rb +14 -0
- data/bin/commands/usergroups.rb +5 -0
- data/bin/commands/usergroups_users.rb +2 -0
- data/bin/commands/users.rb +4 -2
- data/bin/commands/users_profile.rb +5 -5
- data/bin/commands/views.rb +2 -2
- data/bin/commands/workflows.rb +38 -0
- data/bin/commands.rb +13 -9
- data/lib/slack/config.rb +1 -2
- data/lib/slack/events/request.rb +10 -4
- data/lib/slack/real_time/client.rb +6 -6
- data/lib/slack/real_time/concurrency/async.rb +6 -8
- data/lib/slack/real_time/concurrency.rb +0 -2
- data/lib/slack/real_time/config.rb +5 -14
- data/lib/slack/real_time/socket.rb +1 -2
- data/lib/slack/real_time/stores/base.rb +1 -6
- data/lib/slack/real_time/stores/starter.rb +6 -3
- data/lib/slack/real_time/stores/store.rb +5 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
- data/lib/slack/web/api/endpoints/admin_apps.rb +42 -6
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +4 -2
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +72 -0
- data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
- data/lib/slack/web/api/endpoints/admin_conversations.rb +233 -3
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_emoji.rb +10 -10
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_users.rb +23 -23
- data/lib/slack/web/api/endpoints/admin_users_session.rb +97 -3
- data/lib/slack/web/api/endpoints/api.rb +1 -3
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
- data/lib/slack/web/api/endpoints/apps_manifest.rb +75 -0
- data/lib/slack/web/api/endpoints/auth.rb +1 -1
- data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
- data/lib/slack/web/api/endpoints/bots.rb +3 -1
- data/lib/slack/web/api/endpoints/calls.rb +15 -15
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/channels.rb +0 -259
- data/lib/slack/web/api/endpoints/chat.rb +65 -55
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +4 -2
- data/lib/slack/web/api/endpoints/conversations.rb +134 -24
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +6 -3
- data/lib/slack/web/api/endpoints/files.rb +19 -15
- data/lib/slack/web/api/endpoints/files_comments.rb +1 -1
- data/lib/slack/web/api/endpoints/files_remote.rb +22 -22
- data/lib/slack/web/api/endpoints/groups.rb +0 -269
- data/lib/slack/web/api/endpoints/im.rb +0 -107
- data/lib/slack/web/api/endpoints/migration.rb +4 -2
- data/lib/slack/web/api/endpoints/mpim.rb +0 -102
- data/lib/slack/web/api/endpoints/oauth.rb +5 -27
- data/lib/slack/web/api/endpoints/oauth_v2.rb +24 -6
- data/lib/slack/web/api/endpoints/openid_connect.rb +42 -0
- data/lib/slack/web/api/endpoints/pins.rb +4 -9
- data/lib/slack/web/api/endpoints/reactions.rb +13 -11
- data/lib/slack/web/api/endpoints/reminders.rb +17 -5
- data/lib/slack/web/api/endpoints/rtm.rb +10 -10
- data/lib/slack/web/api/endpoints/search.rb +27 -13
- data/lib/slack/web/api/endpoints/stars.rb +11 -9
- data/lib/slack/web/api/endpoints/team.rb +11 -5
- data/lib/slack/web/api/endpoints/team_billing.rb +21 -0
- data/lib/slack/web/api/endpoints/team_preferences.rb +21 -0
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +24 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +26 -16
- data/lib/slack/web/api/endpoints/usergroups_users.rb +9 -5
- data/lib/slack/web/api/endpoints/users.rb +20 -18
- data/lib/slack/web/api/endpoints/users_profile.rb +7 -7
- data/lib/slack/web/api/endpoints/views.rb +13 -13
- data/lib/slack/web/api/endpoints/workflows.rb +61 -0
- data/lib/slack/web/api/endpoints.rb +26 -20
- data/lib/slack/web/api/errors/server_error.rb +37 -0
- data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -4
- data/lib/slack/web/api/errors.rb +394 -10
- data/lib/slack/web/api/mixins/conversations.id.rb +1 -3
- data/lib/slack/web/api/mixins/ids.id.rb +2 -2
- data/lib/slack/web/api/mixins/users.id.rb +1 -3
- data/lib/slack/web/api/mixins.rb +0 -2
- data/lib/slack/web/api/patches/chat.1.patch +6 -8
- data/lib/slack/web/api/templates/endpoints.erb +1 -2
- data/lib/slack/web/api/templates/method_spec.erb +1 -1
- data/lib/slack/web/config.rb +2 -0
- data/lib/slack/web/faraday/connection.rb +2 -2
- data/lib/slack/web/faraday/request.rb +2 -1
- data/lib/slack/web/faraday/response/raise_error.rb +12 -1
- data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
- data/lib/slack/web/pagination/cursor.rb +1 -5
- data/lib/slack-ruby-client.rb +2 -0
- data/lib/tasks/web.rake +11 -3
- data/slack-ruby-client.gemspec +2 -3
- data/spec/fixtures/slack/web/429_error.yml +50 -54
- data/spec/fixtures/slack/web/auth_test_error.yml +51 -18
- data/spec/fixtures/slack/web/auth_test_success.yml +50 -26
- data/spec/fixtures/slack/web/conversations_info.yml +167 -0
- data/spec/fixtures/slack/web/conversations_setTopic.yml +84 -0
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +172 -0
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +253 -0
- data/spec/fixtures/slack/web/paginated_users_list.yml +501 -69
- data/spec/fixtures/slack/web/rtm_connect.yml +267 -30
- data/spec/fixtures/slack/web/rtm_start.yml +771 -60
- data/spec/fixtures/slack/web/users_info.yml +153 -69
- data/spec/fixtures/slack/web/users_list.yml +102 -41
- data/spec/fixtures/slack/web/views_open_error.yml +49 -42
- data/spec/slack/events/request_spec.rb +13 -8
- data/spec/slack/real_time/client_spec.rb +35 -22
- data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
- data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
- data/spec/slack/real_time/event_handlers/bot_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/channel_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +5 -5
- data/spec/slack/real_time/event_handlers/user_spec.rb +2 -2
- data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
- data/spec/slack/real_time/rtm_start_spec.rb +1 -1
- data/spec/slack/slack_spec.rb +3 -1
- data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +10 -0
- data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +35 -0
- data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
- data/spec/slack/web/api/endpoints/{apps_permissions_scopes_spec.rb → admin_conversations_ekm_spec.rb} +1 -1
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +5 -5
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +85 -0
- data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +6 -6
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +10 -10
- data/spec/slack/web/api/endpoints/admin_teams_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +6 -6
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +28 -0
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +15 -23
- data/spec/slack/web/api/endpoints/{apps_permissions_resources_spec.rb → apps_connections_spec.rb} +1 -1
- data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +36 -0
- data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +4 -4
- data/spec/slack/web/api/endpoints/calls_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +4 -6
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -5
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
- data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
- data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
- data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +6 -3
- data/spec/slack/web/api/endpoints/openid_connect_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
- data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
- data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/team_billing_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/team_preferences_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
- data/spec/slack/web/api/error_spec.rb +5 -7
- data/spec/slack/web/api/errors/slack_error_spec.rb +21 -26
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +11 -9
- data/spec/slack/web/api/mixins/users_spec.rb +1 -1
- data/spec/slack/web/api/pagination/cursor_spec.rb +1 -3
- data/spec/slack/web/client_spec.rb +112 -16
- data/spec/slack/web/faraday/request_spec.rb +80 -0
- data/spec/slack/web/faraday/response/raise_error_spec.rb +8 -6
- data/spec/spec_helper.rb +1 -1
- data/spec/support/real_time/connected_client.rb +1 -7
- data/spec/support/vcr.rb +36 -1
- metadata +58 -155
- data/examples/hi_real_time/Gemfile +0 -6
- data/examples/hi_real_time/hi.gif +0 -0
- data/examples/hi_real_time/hi.rb +0 -41
- data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
- data/examples/hi_real_time_async_celluloid/Procfile +0 -2
- data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
- data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
- data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
- data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
- data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
- data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
- data/lib/slack/web/api/mixins/channels.id.json +0 -20
- data/lib/slack/web/api/mixins/channels.id.rb +0 -27
- data/lib/slack/web/api/mixins/groups.id.json +0 -20
- data/lib/slack/web/api/mixins/groups.id.rb +0 -27
- data/spec/fixtures/slack/web/503_error.yml +0 -14
- data/spec/fixtures/slack/web/channels_info.yml +0 -139
- data/spec/fixtures/slack/web/groups_info.yml +0 -43
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
- data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +0 -32
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +0 -19
- data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -101
- data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/im_spec.rb +0 -39
- data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -39
- data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
- data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
- data/spec/slack/web/api/mixins/channels_spec.rb +0 -43
- data/spec/slack/web/api/mixins/groups_spec.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fa18d8339ff27661d942ef4d0cee003ff8e1146db504063a736374c5f5bf940
|
4
|
+
data.tar.gz: fc3bca990c3ad938a23db950b2008932a29518363360ada378856e71f2c1b477
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 932b6be224f16a7873a24907074944eea9ac8fcb47e35f7f9ef876d11df396197771c44727738b63267e4da45cd5c2050084972844a76fa6134fc54e2a9aa0d6
|
7
|
+
data.tar.gz: 8a5904155cd7b3d52fbeca8c9a0887bca7eabe4bb4b668174aa4accb5cfefb7784ec91f3e3d9182fef44d6a994168b72c4530c36a74cf2d7564eec6a0e204ea5
|
data/.rubocop.yml
CHANGED
@@ -5,6 +5,8 @@ require:
|
|
5
5
|
- rubocop-rspec
|
6
6
|
|
7
7
|
AllCops:
|
8
|
+
TargetRubyVersion: 2.5
|
9
|
+
NewCops: enable
|
8
10
|
DisplayCopNames: true
|
9
11
|
Exclude:
|
10
12
|
- bin/**/*
|
@@ -18,7 +20,7 @@ Layout/EmptyLineAfterMagicComment:
|
|
18
20
|
Enabled: false
|
19
21
|
|
20
22
|
Metrics/BlockLength:
|
21
|
-
|
23
|
+
Enabled: false
|
22
24
|
|
23
25
|
Metrics/ClassLength:
|
24
26
|
Max: 250
|
@@ -32,6 +34,9 @@ Style/Documentation:
|
|
32
34
|
Style/ModuleFunction:
|
33
35
|
Enabled: false
|
34
36
|
|
37
|
+
RSpec/InstanceVariable:
|
38
|
+
Enabled: false
|
39
|
+
|
35
40
|
Naming/FileName:
|
36
41
|
Exclude:
|
37
42
|
- lib/slack-ruby-client.rb # Required to match gemspec name
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,29 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-12-21 14:31:33 UTC using RuboCop version 0.93.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'slack-ruby-client.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
Lint/ConstantDefinitionInBlock:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/tasks/real_time.rake'
|
20
|
+
|
21
|
+
# Offense count: 2
|
22
|
+
Lint/MissingSuper:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/slack/real_time/stores/starter.rb'
|
25
|
+
- 'lib/slack/real_time/stores/store.rb'
|
26
|
+
|
9
27
|
# Offense count: 1
|
10
28
|
# Cop supports --auto-correct.
|
11
29
|
Lint/NonDeterministicRequireOrder:
|
@@ -18,32 +36,30 @@ Lint/RedundantCopDisableDirective:
|
|
18
36
|
Exclude:
|
19
37
|
- 'lib/slack-ruby-client.rb'
|
20
38
|
|
21
|
-
# Offense count:
|
22
|
-
# Configuration parameters: AllowComments.
|
23
|
-
Lint/SuppressedException:
|
24
|
-
Exclude:
|
25
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
26
|
-
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
27
|
-
|
28
|
-
# Offense count: 11
|
39
|
+
# Offense count: 12
|
29
40
|
# Configuration parameters: IgnoredMethods.
|
30
41
|
Metrics/AbcSize:
|
31
|
-
Max:
|
42
|
+
Max: 48
|
32
43
|
|
33
|
-
# Offense count:
|
44
|
+
# Offense count: 4
|
34
45
|
# Configuration parameters: IgnoredMethods.
|
35
46
|
Metrics/CyclomaticComplexity:
|
36
|
-
Max:
|
47
|
+
Max: 14
|
37
48
|
|
38
|
-
# Offense count:
|
39
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
49
|
+
# Offense count: 12
|
50
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
|
40
51
|
Metrics/MethodLength:
|
41
52
|
Max: 32
|
42
53
|
|
43
54
|
# Offense count: 1
|
55
|
+
# Configuration parameters: CountKeywordArgs.
|
56
|
+
Metrics/ParameterLists:
|
57
|
+
Max: 6
|
58
|
+
|
59
|
+
# Offense count: 2
|
44
60
|
# Configuration parameters: IgnoredMethods.
|
45
61
|
Metrics/PerceivedComplexity:
|
46
|
-
Max:
|
62
|
+
Max: 16
|
47
63
|
|
48
64
|
# Offense count: 2
|
49
65
|
# Cop supports --auto-correct.
|
@@ -51,51 +67,36 @@ Performance/RegexpMatch:
|
|
51
67
|
Exclude:
|
52
68
|
- 'lib/tasks/web.rake'
|
53
69
|
|
54
|
-
# Offense count:
|
55
|
-
RSpec/AnyInstance:
|
56
|
-
Exclude:
|
57
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
58
|
-
|
59
|
-
# Offense count: 5
|
70
|
+
# Offense count: 3
|
60
71
|
# Cop supports --auto-correct.
|
61
72
|
RSpec/ContextMethod:
|
62
73
|
Exclude:
|
63
74
|
- 'spec/slack/messages/formatting_spec.rb'
|
64
|
-
- 'spec/slack/web/api/mixins/channels_spec.rb'
|
65
|
-
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
66
75
|
- 'spec/slack/web/api/mixins/users_spec.rb'
|
67
76
|
|
68
|
-
# Offense count:
|
77
|
+
# Offense count: 77
|
69
78
|
# Configuration parameters: Prefixes.
|
70
79
|
# Prefixes: when, with, without
|
71
80
|
RSpec/ContextWording:
|
72
81
|
Enabled: false
|
73
82
|
|
74
|
-
# Offense count:
|
83
|
+
# Offense count: 127
|
75
84
|
# Cop supports --auto-correct.
|
76
85
|
# Configuration parameters: AllowConsecutiveOneLiners.
|
77
86
|
RSpec/EmptyLineAfterExample:
|
78
87
|
Enabled: false
|
79
88
|
|
80
|
-
# Offense count:
|
89
|
+
# Offense count: 62
|
81
90
|
# Configuration parameters: Max.
|
82
91
|
RSpec/ExampleLength:
|
83
92
|
Enabled: false
|
84
93
|
|
85
|
-
# Offense count:
|
94
|
+
# Offense count: 16
|
86
95
|
# Configuration parameters: CustomTransform, IgnoreMethods.
|
87
96
|
RSpec/FilePath:
|
88
97
|
Enabled: false
|
89
98
|
|
90
|
-
# Offense count:
|
91
|
-
# Configuration parameters: AssignmentOnly.
|
92
|
-
RSpec/InstanceVariable:
|
93
|
-
Exclude:
|
94
|
-
- 'spec/integration/integration_spec.rb'
|
95
|
-
- 'spec/slack/real_time/client_spec.rb'
|
96
|
-
- 'spec/slack/slack_spec.rb'
|
97
|
-
|
98
|
-
# Offense count: 77
|
99
|
+
# Offense count: 65
|
99
100
|
# Configuration parameters: .
|
100
101
|
# SupportedStyles: have_received, receive
|
101
102
|
RSpec/MessageSpies:
|
@@ -105,25 +106,28 @@ RSpec/MessageSpies:
|
|
105
106
|
RSpec/MultipleExpectations:
|
106
107
|
Max: 5
|
107
108
|
|
108
|
-
# Offense count:
|
109
|
+
# Offense count: 3
|
110
|
+
# Configuration parameters: IgnoreSharedExamples.
|
111
|
+
RSpec/NamedSubject:
|
112
|
+
Exclude:
|
113
|
+
- 'spec/slack/web/api/mixins/conversations_list_spec.rb'
|
114
|
+
|
115
|
+
# Offense count: 48
|
109
116
|
RSpec/NestedGroups:
|
110
117
|
Max: 6
|
111
118
|
|
112
|
-
# Offense count:
|
119
|
+
# Offense count: 2
|
113
120
|
RSpec/SubjectStub:
|
114
121
|
Exclude:
|
115
|
-
- 'spec/slack/web/api/mixins/
|
116
|
-
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
122
|
+
- 'spec/slack/web/api/mixins/conversations_spec.rb'
|
117
123
|
- 'spec/slack/web/api/mixins/users_spec.rb'
|
118
124
|
|
119
|
-
# Offense count:
|
125
|
+
# Offense count: 12
|
120
126
|
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
121
127
|
RSpec/VerifiedDoubles:
|
122
128
|
Exclude:
|
123
129
|
- 'spec/slack/events/request_spec.rb'
|
124
130
|
- 'spec/slack/real_time/client_spec.rb'
|
125
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
126
|
-
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
127
131
|
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
|
128
132
|
- 'spec/support/real_time/connected_client.rb'
|
129
133
|
|
@@ -132,3 +136,31 @@ RSpec/VerifiedDoubles:
|
|
132
136
|
# SupportedStyles: annotated, template, unannotated
|
133
137
|
Style/FormatStringToken:
|
134
138
|
EnforcedStyle: unannotated
|
139
|
+
|
140
|
+
# Offense count: 6
|
141
|
+
# Cop supports --auto-correct.
|
142
|
+
Style/GlobalStdStream:
|
143
|
+
Exclude:
|
144
|
+
- 'lib/slack/logger.rb'
|
145
|
+
- 'lib/tasks/real_time.rake'
|
146
|
+
- 'spec/integration/integration_spec.rb'
|
147
|
+
- 'spec/slack/web/client_spec.rb'
|
148
|
+
|
149
|
+
# Offense count: 1
|
150
|
+
# Cop supports --auto-correct.
|
151
|
+
Style/MultilineTernaryOperator:
|
152
|
+
Exclude:
|
153
|
+
- 'spec/support/vcr.rb'
|
154
|
+
|
155
|
+
# Offense count: 1
|
156
|
+
# Configuration parameters: AllowedMethods.
|
157
|
+
# AllowedMethods: respond_to_missing?
|
158
|
+
Style/OptionalBooleanParameter:
|
159
|
+
Exclude:
|
160
|
+
- 'spec/support/queue_with_timeout.rb'
|
161
|
+
|
162
|
+
# Offense count: 1
|
163
|
+
# Cop supports --auto-correct.
|
164
|
+
Style/StringConcatenation:
|
165
|
+
Exclude:
|
166
|
+
- 'lib/tasks/real_time.rake'
|
data/.travis.yml
CHANGED
@@ -5,6 +5,8 @@ cache: bundler
|
|
5
5
|
rvm:
|
6
6
|
- 2.5.3
|
7
7
|
- 2.6.0
|
8
|
+
- 2.7.1
|
9
|
+
- 3.0.2
|
8
10
|
- ruby-head
|
9
11
|
- jruby-head
|
10
12
|
|
@@ -13,10 +15,6 @@ matrix:
|
|
13
15
|
- rvm: 2.4.1
|
14
16
|
script:
|
15
17
|
- bundle exec danger
|
16
|
-
- rvm: 2.4.1
|
17
|
-
env: CONCURRENCY=celluloid-io
|
18
|
-
- rvm: 2.4.1
|
19
|
-
env: CONCURRENCY=faye-websocket
|
20
18
|
- rvm: 2.5.3
|
21
19
|
env: CONCURRENCY=async-websocket
|
22
20
|
allow_failures:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
+
### 1.0.0 (2021/12/21)
|
2
|
+
|
3
|
+
* [#394](https://github.com/slack-ruby/slack-ruby-client/pull/394): Added support for Ruby 3.0 - [@dblock](https://github.com/dblock).
|
4
|
+
* [#394](https://github.com/slack-ruby/slack-ruby-client/pull/394): Upgraded to RuboCop 0.93.1 - [@dblock](https://github.com/dblock).
|
5
|
+
* [#393](https://github.com/slack-ruby/slack-ruby-client/pull/393): Removed deprecated `oauth_token`, and leftover traces of `channels` and `groups` APIs - [@dblock](https://github.com/dblock).
|
6
|
+
* [#393](https://github.com/slack-ruby/slack-ruby-client/pull/393): Added `admin_auth_policy_assignEntities`, `admin_auth_policy_getEntities` and `admin_auth_policy_removeEntities` `admin_conversations_disconnectShared`, `admin_users_session_clearSettings`, `admin_users_session_getSettings`, `admin_users_session_resetBulk`, `admin_users_session_setSettings`, `apps_manifest_create`, `apps_manifest_delete`, `apps_manifest_export`, `apps_manifest_update`, `apps_manifest_validate`, `conversations_acceptSharedInvite`, `conversations_approveSharedInvite`, `conversations_declineSharedInvite`, `conversations_inviteShared`, `conversations_listConnectInvites`, `oauth_v2_exchange`, `openid_connect_token`, `openid_connect_userInfo`, `team_billing_info`, `team_preferences_list`, `tooling_tokens_rotate` - [@dblock](https://github.com/dblock).
|
7
|
+
* [#386](https://github.com/slack-ruby/slack-ruby-client/pull/386): Gemspec: drop unused `test_files` directive - [@olleolleolle](https://github.com/olleolleolle).
|
8
|
+
* [#380](https://github.com/slack-ruby/slack-ruby-client/pull/380): Updates to server error classes and hierarchy - [@jmanian](https://github.com/jmanian).
|
9
|
+
* [#387](https://github.com/slack-ruby/slack-ruby-client/pull/387): Send token in Authorization header - [@chrisbloom7](https://github.com/chrisbloom7).
|
10
|
+
|
11
|
+
### 0.17.0 (2021/03/07)
|
12
|
+
|
13
|
+
* [#370](https://github.com/slack-ruby/slack-ruby-client/pull/370): Removed deprecated `im_`, `mpim_`, `channels_`, and `groups_` methods - [@dblock](https://github.com/dblock).
|
14
|
+
* [#368](https://github.com/slack-ruby/slack-ruby-client/pull/368): Removed `admin_conversations_whitelist` and `admin_conversations_disconnectShared` - [@dblock](https://github.com/dblock).
|
15
|
+
* [#359](https://github.com/slack-ruby/slack-ruby-client/pull/359): Handle non-JSON 500 errors - [@agrobbin](https://github.com/agrobbin).
|
16
|
+
* [#360](https://github.com/slack-ruby/slack-ruby-client/pull/360): Remove faye-websocket from the concurrency detection error message - [@dblock](https://github.com/dblock).
|
17
|
+
* [#369](https://github.com/slack-ruby/slack-ruby-client/pull/369): Support rack requests in `Slack::Events::Request` - [@wedgex](https://github.com/wedgex).
|
18
|
+
|
19
|
+
### 0.16.0 (2021/01/24)
|
20
|
+
|
21
|
+
* [#350](https://github.com/slack-ruby/slack-ruby-client/pull/350): Handle server errors such as timeouts & non-JSON responses - [@ojab](https://github.com/ojab).
|
22
|
+
* [#354](https://github.com/slack-ruby/slack-ruby-client/pull/354): Rewind body after checking request signature - [@sunny](https://github.com/sunny).
|
23
|
+
* [#355](https://github.com/slack-ruby/slack-ruby-client/pull/355), [#357](https://github.com/slack-ruby/slack-ruby-client/pull/357): Removed `celluloid-io` and `faye-websocket` support - [@wasabigeek](https://github.com/wasabigeek).
|
24
|
+
* [#356](https://github.com/slack-ruby/slack-ruby-client/pull/356): Added `admin_apps_clearResolution`, `admin_conversations_getCustomRetention`, `admin_conversations_removeCustomRetention`, `admin_conversations_setCustomRetention`, `admin_users_session_list` and `auth_teams_list` endpoints - [@dblock](https://github.com/dblock).
|
25
|
+
* [#348](https://github.com/slack-ruby/slack-ruby-client/pull/348): Added `admin_conversations_archive`, `admin_conversations_convertToPrivate`, `admin_conversations_create`, `admin_conversations_delete`, `admin_conversations_disconnectShared`, `admin_conversations_getConversationPrefs`, `admin_conversations_getTeams`, `admin_conversations_invite`, `admin_conversations_rename`, `admin_conversations_search`, `admin_conversations_setConversationPrefs`, `admin_conversations_unarchive`, `admin_conversations_ekm_listOriginalConnectedChannelInfo`, `admin_users_session_invalidate`, `apps_event_authorizations_list`, `conversations_mark`, `workflows_stepCompleted`, `workflows_stepFailed` and `workflows_updateStep` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
26
|
+
|
27
|
+
### 0.15.1 (2020/9/3)
|
28
|
+
|
29
|
+
* [#336](https://github.com/slack-ruby/slack-ruby-client/pull/336): Fix: handle nil events - [@pyama86](https://github.com/pyama86).
|
30
|
+
* [#339](https://github.com/slack-ruby/slack-ruby-client/pull/339): Fix: `channel_not_found` resolving channel IDs with 100+ channels - [@dblock](https://github.com/dblock).
|
31
|
+
* [#340](https://github.com/slack-ruby/slack-ruby-client/pull/340): Added `adapter` configuration setting to change the `Faraday` HTTP adapter - [@watsonjon](https://github.com/watsonjon).
|
32
|
+
|
1
33
|
### 0.15.0 (2020/7/26)
|
2
34
|
|
3
35
|
* [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
|
data/CONTRIBUTING.md
CHANGED
@@ -29,9 +29,9 @@ bundle exec rake
|
|
29
29
|
|
30
30
|
Sign up for Slack, create a private slack group for yourself.
|
31
31
|
|
32
|
-
Create a new
|
32
|
+
Create a new App under [https://api.slack.com/apps](https://api.slack.com/apps).
|
33
33
|
|
34
|
-
![](screenshots/
|
34
|
+
![](screenshots/create-app.png)
|
35
35
|
|
36
36
|
On the next screen, note the API token.
|
37
37
|
|
@@ -68,7 +68,7 @@ Make sure that `bundle exec rake` completes without errors.
|
|
68
68
|
Slack Web API is updated from https://github.com/slack-ruby/slack-api-ref, a maintained, machine-readable version of Slack API Docs, generated by scraping [api.slack.com](https://api.slack.com). To update the Web API from the latest definition run the following Rake task.
|
69
69
|
|
70
70
|
```
|
71
|
-
rake slack:api:update
|
71
|
+
bundle exec rake slack:api:update
|
72
72
|
```
|
73
73
|
|
74
74
|
#### Patching Slack Web API
|
@@ -89,16 +89,9 @@ The broad steps are:
|
|
89
89
|
##### Resolving Patch Errors
|
90
90
|
|
91
91
|
The auto-generated method files may drift overtime e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
|
92
|
-
1.
|
93
|
-
|
94
|
-
|
95
|
-
# puts "- patching #{patch}"
|
96
|
-
# system("git apply #{patch}") || raise('failed to apply patch')
|
97
|
-
# end
|
98
|
-
```
|
99
|
-
2. Run `rake slack:api:update` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
|
100
|
-
3. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
|
101
|
-
4. Continue with Step 2 [above](#patching-slack-web-api).
|
92
|
+
1. Run `rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
|
93
|
+
2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
|
94
|
+
3. Continue with Step 2 [above](#patching-slack-web-api).
|
102
95
|
|
103
96
|
|
104
97
|
### Write Documentation
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2015-
|
3
|
+
Copyright (c) 2015-2021 Daniel Doubrovkine, Artsy and Contributors
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -2,14 +2,14 @@ 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://travis-ci.
|
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)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/slack-ruby/slack-ruby-client/badges/gpa.svg)](https://codeclimate.com/github/slack-ruby/slack-ruby-client)
|
7
7
|
|
8
8
|
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).
|
9
9
|
|
10
10
|
![](slack.png)
|
11
11
|
|
12
|
-
|
12
|
+
# Table of Contents
|
13
13
|
|
14
14
|
- [Useful to Me?](#useful-to-me)
|
15
15
|
- [Stable Release](#stable-release)
|
@@ -47,8 +47,6 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
47
47
|
- [Large Team Considerations](#large-team-considerations)
|
48
48
|
- [Concurrency](#concurrency)
|
49
49
|
- [Async](#async)
|
50
|
-
- [Faye::Websocket with Eventmachine](#fayewebsocket-with-eventmachine)
|
51
|
-
- [Celluloid](#celluloid)
|
52
50
|
- [Events API](#events-api)
|
53
51
|
- [Configuring Slack::Events](#configuring-slackevents)
|
54
52
|
- [Verifying the Request Signature](#verifying-the-request-signature)
|
@@ -72,7 +70,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
72
70
|
|
73
71
|
## Stable Release
|
74
72
|
|
75
|
-
You're reading the documentation for the **
|
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.
|
76
74
|
|
77
75
|
## Installation
|
78
76
|
|
@@ -82,7 +80,7 @@ Add to Gemfile.
|
|
82
80
|
gem 'slack-ruby-client'
|
83
81
|
```
|
84
82
|
|
85
|
-
If you're going to be using the RealTime client, add
|
83
|
+
If you're going to be using the RealTime client, add `async-websocket`. See below for more information about concurrency.
|
86
84
|
|
87
85
|
```
|
88
86
|
gem 'async-websocket', '~> 0.8.0'
|
@@ -152,10 +150,10 @@ See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
|
|
152
150
|
|
153
151
|
##### List Channels
|
154
152
|
|
155
|
-
List channels with [
|
153
|
+
List channels with [conversations_list](https://api.slack.com/methods/conversations.list).
|
156
154
|
|
157
155
|
```ruby
|
158
|
-
channels = client.
|
156
|
+
channels = client.conversations_list.channels
|
159
157
|
|
160
158
|
general_channel = channels.detect { |c| c.name == 'general' }
|
161
159
|
```
|
@@ -177,14 +175,14 @@ client.files_upload(
|
|
177
175
|
|
178
176
|
##### Get Channel Info
|
179
177
|
|
180
|
-
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 `
|
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.
|
181
179
|
|
182
180
|
```ruby
|
183
|
-
client.
|
181
|
+
client.conversations_info(channel: 'C04KB5X4D') # calls conversations_info
|
184
182
|
```
|
185
183
|
|
186
184
|
```ruby
|
187
|
-
client.
|
185
|
+
client.conversations_info(channel: '#general') # calls conversations_list followed by conversations_info
|
188
186
|
```
|
189
187
|
|
190
188
|
##### Get User Info
|
@@ -240,11 +238,12 @@ timeout | Optional open/read timeout in seconds.
|
|
240
238
|
open_timeout | Optional connection open timeout in seconds.
|
241
239
|
default_page_size | Optional page size for paginated requests, default is _100_.
|
242
240
|
default_max_retries | Optional number of retries for paginated requests, default is _100_.
|
241
|
+
adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
|
243
242
|
|
244
243
|
You can also pass request options, including `timeout` and `open_timeout` into individual calls.
|
245
244
|
|
246
245
|
```ruby
|
247
|
-
client.
|
246
|
+
client.conversations_list(request: { timeout: 180 })
|
248
247
|
```
|
249
248
|
|
250
249
|
You can also control what proxy options are used by modifying the `http_proxy` environment variable per [Net::HTTP's documentation](https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html#class-Net::HTTP-label-Proxies).
|
@@ -325,7 +324,11 @@ If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a
|
|
325
324
|
|
326
325
|
##### Other Errors
|
327
326
|
|
328
|
-
|
327
|
+
When Slack is temporarily unavailable a subclass of `Slack::Web::Api::Errors::ServerError` will be raised and the original `Faraday::Error` will be accesible via `exception.cause`. (Starting with 0.18.0 this is no longer a subclass of `Slack::Web::Api::Errors::SlackError`.)
|
328
|
+
|
329
|
+
Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on non-json response (i.e. 200 OK with `Slack unavailable` HTML page) and `Slack::Web::Api::Errors::HttpRequestError` subclasses for connection failures (`Slack::Web::Api::Errors::TimeoutError` for read/open timeouts & `Slack::Web::Api::Errors::UnavailableError` for 5xx HTTP responses).
|
330
|
+
|
331
|
+
In any other case, a `Faraday::ClientError` will be raised.
|
329
332
|
|
330
333
|
### RealTime Client
|
331
334
|
|
@@ -490,7 +493,7 @@ See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a dis
|
|
490
493
|
|
491
494
|
#### Concurrency
|
492
495
|
|
493
|
-
`Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async)
|
496
|
+
`Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async).
|
494
497
|
|
495
498
|
```ruby
|
496
499
|
Slack::RealTime.configure do |config|
|
@@ -508,7 +511,7 @@ client.start_async
|
|
508
511
|
|
509
512
|
##### Async
|
510
513
|
|
511
|
-
|
514
|
+
Add `async-websocket` to your Gemfile.
|
512
515
|
|
513
516
|
```
|
514
517
|
gem 'async-websocket'
|
@@ -516,26 +519,6 @@ gem 'async-websocket'
|
|
516
519
|
|
517
520
|
See a fully working example in [examples/hi_real_time_async_async](examples/hi_real_time_async_async/hi.rb).
|
518
521
|
|
519
|
-
##### Faye::Websocket with Eventmachine
|
520
|
-
|
521
|
-
Add the following to your Gemfile.
|
522
|
-
|
523
|
-
```
|
524
|
-
gem 'faye-websocket'
|
525
|
-
```
|
526
|
-
|
527
|
-
See a fully working example in [examples/hi_real_time_async_eventmachine](examples/hi_real_time_async_eventmachine/hi.rb).
|
528
|
-
|
529
|
-
##### Celluloid
|
530
|
-
|
531
|
-
Add the following to your Gemfile.
|
532
|
-
|
533
|
-
```
|
534
|
-
gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io']
|
535
|
-
```
|
536
|
-
|
537
|
-
See a fully working example in [examples/hi_real_time_async_celluloid](examples/hi_real_time_async_celluloid/hi.rb).
|
538
|
-
|
539
522
|
### Events API
|
540
523
|
|
541
524
|
This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
|
@@ -663,6 +646,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
|
|
663
646
|
|
664
647
|
## Copyright and License
|
665
648
|
|
666
|
-
Copyright (c) 2015-
|
649
|
+
Copyright (c) 2015-2021, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
|
667
650
|
|
668
651
|
This project is licensed under the [MIT License](LICENSE.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://travis-ci.
|
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.
|
15
15
|
|
16
16
|
Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
|
17
17
|
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,62 @@
|
|
1
1
|
Upgrading Slack-Ruby-Client
|
2
2
|
===========================
|
3
3
|
|
4
|
+
### Upgrading to >= 1.0.0
|
5
|
+
|
6
|
+
#### Deprecated Methods
|
7
|
+
|
8
|
+
Slack has deprecated all `channel` and `group` methods, which have been removed from the library.
|
9
|
+
|
10
|
+
See [this announcement from Slack](https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api) for details.
|
11
|
+
|
12
|
+
#### Error Handling
|
13
|
+
|
14
|
+
As of 1.0.0 `Slack::Web::Api::Errors::ServerError` and its subclasses (introduced in 0.16.0) no longer extend `Slack::Web::Api::Errors::InternalError` or its parent `Slack::Web::Api::Errors::SlackError`. If you are rescuing `SlackError` or `InternalError` with the intention of including `ServerError` and its subclasses you should adjust your code to explicitly rescue `Slack::Web::Api::Errors::ServerError`.
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
# Before
|
18
|
+
begin
|
19
|
+
client.auth_test
|
20
|
+
rescue Slack::Web::Api::Errors::SlackError
|
21
|
+
# Includes all server errors
|
22
|
+
end
|
23
|
+
|
24
|
+
# After
|
25
|
+
begin
|
26
|
+
client.auth_test
|
27
|
+
rescue Slack::Web::Api::Errors::SlackError, Slack::Web::Api::Errors::ServerError
|
28
|
+
# Need to rescue the server errors separately from SlackError
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
Additionally the `initialize` method for `ParsingError`, `TimeoutError`, and `UnavailableError` have changed from `new(message, response)` to `new(response)`. The `message` is now built into the definition of these classes. If you are instantiating or raising these errors in your code (perhaps in tests) you will need to update your code.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
# Before
|
36
|
+
error = Slack::Web::Api::Errors::TimeoutError.new('timeout_error', response)
|
37
|
+
error.message
|
38
|
+
# => 'timeout_error'
|
39
|
+
|
40
|
+
# After
|
41
|
+
error = Slack::Web::Api::Errors::TimeoutError.new(response)
|
42
|
+
error.message
|
43
|
+
# => 'timeout_error'
|
44
|
+
```
|
45
|
+
|
46
|
+
### Upgrading to >= 0.16.0
|
47
|
+
|
48
|
+
#### Removed Celluloid and Faye-Websocket Concurrency Support
|
49
|
+
|
50
|
+
Concurrency support for `celluloid-io` and `faye-websocket` has been removed. If you are running a RealTime bot on Celluloid or Faye, you must upgrade to `async-websocket`. Please note that RealTime bots are deprecated by Slack, and we generally recommend you [migrate your classic, RealTime bot, to granular permissions](https://code.dblock.org/2020/11/30/migrating-classic-slack-ruby-bots-to-granular-permissions.html).
|
51
|
+
|
52
|
+
See [#338](https://github.com/slack-ruby/slack-ruby-client/issues/338) for more information.
|
53
|
+
|
54
|
+
#### Error Handling
|
55
|
+
|
56
|
+
As of 0.16.0 `Faraday::Error` exceptions sans `Faraday::ClientError` are wrapped into `Slack::Web::Api::Errors::ServerError`, so if you're rescuing `Faraday::Error` — you should adjust your code to use `Slack::Web::Api::Errors::ServerError` and use `exception.cause` if underlying `Faraday::Error` is needed.
|
57
|
+
|
58
|
+
See [README#other-errors](README.md#other-errors) and [#350](https://github.com/slack-ruby/slack-ruby-client/pull/350) for more information.
|
59
|
+
|
4
60
|
### Upgrading to >= 0.15.0
|
5
61
|
|
6
62
|
As of 0.15.0, `activesupport` is no longer required. Add `gem 'activesupport'` to your Gemfile if you required ActiveSupport via this library.
|
@@ -130,5 +186,3 @@ gem 'celluloid-io'
|
|
130
186
|
When in doubt, use `faye-websocket`.
|
131
187
|
|
132
188
|
See [#5](https://github.com/slack-ruby/slack-ruby-client/issues/5) for more information.
|
133
|
-
|
134
|
-
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
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))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/bin/commands/admin_apps.rb
CHANGED
@@ -7,21 +7,45 @@ command 'admin_apps' do |g|
|
|
7
7
|
g.long_desc %( Approve an app for installation on a workspace. )
|
8
8
|
g.command 'approve' do |c|
|
9
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.'
|
10
11
|
c.flag 'request_id', desc: 'The id of the request to approve.'
|
11
|
-
c.flag 'team_id', desc: '.'
|
12
|
+
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
|
12
13
|
c.action do |_global_options, options, _args|
|
13
14
|
puts JSON.dump($client.admin_apps_approve(options))
|
14
15
|
end
|
15
16
|
end
|
16
17
|
|
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
|
28
|
+
|
17
29
|
g.desc 'Restrict an app for installation on a workspace.'
|
18
30
|
g.long_desc %( Restrict an app for installation on a workspace. )
|
19
31
|
g.command 'restrict' do |c|
|
20
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.'
|
21
34
|
c.flag 'request_id', desc: 'The id of the request to restrict.'
|
22
|
-
c.flag 'team_id', desc: '.'
|
35
|
+
c.flag 'team_id', desc: 'The ID of the workspace to approve the app on.'
|
23
36
|
c.action do |_global_options, options, _args|
|
24
37
|
puts JSON.dump($client.admin_apps_restrict(options))
|
25
38
|
end
|
26
39
|
end
|
40
|
+
|
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))
|
49
|
+
end
|
50
|
+
end
|
27
51
|
end
|
@@ -7,6 +7,7 @@ command 'admin_apps_requests' do |g|
|
|
7
7
|
g.long_desc %( List app requests for a team/workspace. )
|
8
8
|
g.command 'list' do |c|
|
9
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: '.'
|
10
11
|
c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
|
11
12
|
c.flag 'team_id', desc: '.'
|
12
13
|
c.action do |_global_options, options, _args|
|