slack-ruby-client 0.14.5 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.rubocop.yml +11 -3
- data/.rubocop_todo.yml +61 -23
- data/.travis.yml +1 -5
- data/CHANGELOG.md +43 -4
- data/CONTRIBUTING.md +17 -6
- data/Dangerfile +1 -1
- data/Gemfile +1 -2
- data/LICENSE.md +1 -1
- data/README.md +86 -52
- data/UPGRADING.md +20 -2
- data/bin/commands.rb +23 -0
- data/bin/commands/admin_analytics.rb +16 -0
- data/bin/commands/admin_apps.rb +15 -2
- data/bin/commands/admin_apps_approved.rb +17 -0
- data/bin/commands/admin_apps_restricted.rb +17 -0
- data/bin/commands/admin_barriers.rb +47 -0
- data/bin/commands/admin_conversations.rb +159 -0
- data/bin/commands/admin_conversations_ekm.rb +17 -0
- data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
- data/bin/commands/admin_conversations_whitelist.rb +37 -0
- data/bin/commands/admin_emoji.rb +54 -0
- data/bin/commands/admin_inviteRequests.rb +36 -0
- data/bin/commands/admin_inviteRequests_approved.rb +16 -0
- data/bin/commands/admin_inviteRequests_denied.rb +16 -0
- data/bin/commands/admin_teams.rb +27 -0
- data/bin/commands/admin_teams_admins.rb +16 -0
- data/bin/commands/admin_teams_owners.rb +16 -0
- data/bin/commands/admin_teams_settings.rb +64 -0
- data/bin/commands/admin_usergroups.rb +48 -0
- data/bin/commands/admin_users.rb +97 -0
- data/bin/commands/admin_users_session.rb +22 -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/auth_teams.rb +16 -0
- data/bin/commands/bots.rb +1 -0
- data/bin/commands/calls.rb +52 -0
- data/bin/commands/calls_participants.rb +25 -0
- data/bin/commands/channels.rb +1 -155
- data/bin/commands/chat.rb +14 -12
- data/bin/commands/chat_scheduledMessages.rb +1 -0
- data/bin/commands/conversations.rb +15 -4
- data/bin/commands/dnd.rb +3 -1
- data/bin/commands/files.rb +7 -5
- data/bin/commands/files_remote.rb +3 -3
- 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 +1 -1
- data/bin/commands/pins.rb +0 -2
- data/bin/commands/reactions.rb +1 -0
- data/bin/commands/search.rb +4 -1
- data/bin/commands/team.rb +3 -0
- data/bin/commands/usergroups.rb +6 -1
- data/bin/commands/usergroups_users.rb +2 -0
- data/bin/commands/users.rb +5 -3
- data/bin/commands/users_profile.rb +5 -5
- data/bin/commands/views.rb +1 -1
- data/bin/commands/workflows.rb +38 -0
- data/lib/slack-ruby-client.rb +5 -4
- data/lib/slack/events/request.rb +7 -3
- data/lib/slack/messages/message.rb +0 -4
- data/lib/slack/real_time/client.rb +2 -1
- data/lib/slack/real_time/concurrency.rb +0 -2
- data/lib/slack/real_time/concurrency/async.rb +1 -3
- data/lib/slack/real_time/config.rb +5 -14
- data/lib/slack/real_time/models/base.rb +0 -4
- data/lib/slack/real_time/socket.rb +2 -2
- data/lib/slack/real_time/stores/base.rb +3 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +47 -0
- data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
- data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
- data/lib/slack/web/api/endpoints/admin_conversations.rb +246 -0
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
- data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
- data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
- data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
- data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
- data/lib/slack/web/api/endpoints/api.rb +0 -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/auth_teams.rb +33 -0
- data/lib/slack/web/api/endpoints/bots.rb +2 -0
- data/lib/slack/web/api/endpoints/calls.rb +83 -0
- data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
- data/lib/slack/web/api/endpoints/channels.rb +1 -245
- data/lib/slack/web/api/endpoints/chat.rb +23 -19
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -1
- data/lib/slack/web/api/endpoints/conversations.rb +37 -19
- data/lib/slack/web/api/endpoints/dnd.rb +4 -0
- data/lib/slack/web/api/endpoints/files.rb +8 -4
- data/lib/slack/web/api/endpoints/files_remote.rb +4 -4
- data/lib/slack/web/api/endpoints/groups.rb +0 -253
- data/lib/slack/web/api/endpoints/im.rb +0 -101
- data/lib/slack/web/api/endpoints/migration.rb +2 -0
- data/lib/slack/web/api/endpoints/mpim.rb +0 -96
- data/lib/slack/web/api/endpoints/oauth.rb +1 -4
- data/lib/slack/web/api/endpoints/pins.rb +3 -8
- data/lib/slack/web/api/endpoints/reactions.rb +5 -3
- data/lib/slack/web/api/endpoints/search.rb +6 -0
- data/lib/slack/web/api/endpoints/stars.rb +2 -2
- data/lib/slack/web/api/endpoints/team.rb +6 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
- data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
- data/lib/slack/web/api/endpoints/users.rb +7 -5
- data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
- data/lib/slack/web/api/endpoints/views.rb +1 -1
- data/lib/slack/web/api/endpoints/workflows.rb +61 -0
- data/lib/slack/web/api/errors.rb +848 -0
- data/lib/slack/web/api/errors/internal_error.rb +14 -0
- data/lib/slack/web/api/errors/slack_error.rb +12 -0
- data/lib/slack/web/api/mixins.rb +1 -0
- data/lib/slack/web/api/mixins/channels.id.rb +1 -3
- data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
- data/lib/slack/web/api/mixins/groups.id.rb +1 -3
- data/lib/slack/web/api/mixins/ids.id.rb +3 -5
- data/lib/slack/web/api/mixins/users.id.rb +1 -3
- data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +26 -24
- data/lib/slack/web/api/templates/endpoints.erb +1 -0
- data/lib/slack/web/api/templates/errors.erb +20 -0
- data/lib/slack/web/api/templates/method.erb +4 -1
- data/lib/slack/web/api/templates/method_spec.erb +1 -1
- data/lib/slack/web/client.rb +1 -1
- data/lib/slack/web/config.rb +2 -0
- data/lib/slack/web/faraday/connection.rb +23 -20
- data/lib/slack/web/faraday/response/raise_error.rb +16 -2
- data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
- data/lib/slack/web/pagination/cursor.rb +2 -2
- data/lib/tasks/real_time.rake +1 -1
- data/lib/tasks/web.rake +21 -4
- data/slack-ruby-client.gemspec +5 -5
- data/spec/fixtures/slack/web/channels_info.yml +108 -15
- data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
- data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
- data/spec/fixtures/slack/web/views_open_error.yml +76 -0
- data/spec/slack/events/request_spec.rb +13 -8
- data/spec/slack/real_time/client_spec.rb +18 -1
- 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/rtm_connect_spec.rb +1 -1
- data/spec/slack/real_time/rtm_start_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
- data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
- data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +93 -0
- data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
- data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
- data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
- data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
- 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 +24 -0
- data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
- 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/im_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -14
- 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/usergroups_users_spec.rb +2 -2
- data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
- data/spec/slack/web/api/errors/slack_error_spec.rb +22 -0
- data/spec/slack/web/api/mixins/channels_spec.rb +1 -1
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
- data/spec/slack/web/api/mixins/groups_spec.rb +1 -1
- data/spec/slack/web/api/mixins/users_spec.rb +1 -1
- data/spec/slack/web/client_spec.rb +121 -0
- data/spec/slack/web/faraday/response/raise_error_spec.rb +33 -9
- data/spec/support/vcr.rb +4 -0
- metadata +145 -55
- 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/patches/chat.1.text-attachments-required.patch +0 -13
- data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
- data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
- data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
- 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/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/views_spec.rb +0 -29
- data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 568ad92dd27f6edd04fc00905af2a928c9f03f2d08105637b9ffc9f01319eaa3
|
4
|
+
data.tar.gz: 579f9004c9b1b9e3608bb2b59e55f0d09f0dbcba6761ad8035e367d4b9f06f4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab4943fb7a0bf3e1a75141943ee97324dfded3c6e5d691fc1ffa939c43c82f105f4763fed7496f45a1bf1b2b119ffeefa272df484d0e46bcb6f000cbd0906a78
|
7
|
+
data.tar.gz: '0857c64cf4544b3c0b744662ba38f94daad70b38069334a7b59beb4cf0999a47c9ec19e225a899f01e9cfd6c2336823e26b97ba0fce1ebbd498585952fec305d'
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [dblock]
|
data/.rubocop.yml
CHANGED
@@ -11,19 +11,27 @@ AllCops:
|
|
11
11
|
- vendor/**/*
|
12
12
|
- lib/slack/web/api/slack-api-ref/**/*
|
13
13
|
- lib/slack/web/api/endpoints/* # Auto-generated
|
14
|
+
- lib/slack/web/api/errors.rb # Auto-generated
|
14
15
|
- spec/slack/web/api/endpoints/* # Auto-generated
|
16
|
+
|
15
17
|
Layout/EmptyLineAfterMagicComment:
|
16
18
|
Enabled: false
|
19
|
+
|
17
20
|
Metrics/BlockLength:
|
18
|
-
|
21
|
+
Enabled: false
|
22
|
+
|
19
23
|
Metrics/ClassLength:
|
20
24
|
Max: 250
|
21
|
-
|
22
|
-
|
25
|
+
|
26
|
+
Layout/LineLength:
|
27
|
+
Max: 128
|
28
|
+
|
23
29
|
Style/Documentation:
|
24
30
|
Enabled: false
|
31
|
+
|
25
32
|
Style/ModuleFunction:
|
26
33
|
Enabled: false
|
34
|
+
|
27
35
|
Naming/FileName:
|
28
36
|
Exclude:
|
29
37
|
- lib/slack-ruby-client.rb # Required to match gemspec name
|
data/.rubocop_todo.yml
CHANGED
@@ -1,24 +1,30 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-08-24 10:08:11 -0400 using RuboCop version 0.82.0.
|
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:
|
10
|
-
#
|
11
|
-
Lint/
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
Lint/NonDeterministicRequireOrder:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/spec_helper.rb'
|
14
|
+
|
15
|
+
# Offense count: 2
|
16
|
+
# Cop supports --auto-correct.
|
17
|
+
Lint/RedundantCopDisableDirective:
|
12
18
|
Exclude:
|
13
|
-
- 'lib/slack
|
14
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
15
|
-
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
19
|
+
- 'lib/slack-ruby-client.rb'
|
16
20
|
|
17
|
-
# Offense count:
|
21
|
+
# Offense count: 11
|
22
|
+
# Configuration parameters: IgnoredMethods.
|
18
23
|
Metrics/AbcSize:
|
19
24
|
Max: 39
|
20
25
|
|
21
|
-
# Offense count:
|
26
|
+
# Offense count: 2
|
27
|
+
# Configuration parameters: IgnoredMethods.
|
22
28
|
Metrics/CyclomaticComplexity:
|
23
29
|
Max: 9
|
24
30
|
|
@@ -28,31 +34,53 @@ Metrics/MethodLength:
|
|
28
34
|
Max: 32
|
29
35
|
|
30
36
|
# Offense count: 1
|
37
|
+
# Configuration parameters: CountKeywordArgs.
|
38
|
+
Metrics/ParameterLists:
|
39
|
+
Max: 6
|
40
|
+
|
41
|
+
# Offense count: 1
|
42
|
+
# Configuration parameters: IgnoredMethods.
|
31
43
|
Metrics/PerceivedComplexity:
|
32
44
|
Max: 9
|
33
45
|
|
34
|
-
# Offense count:
|
35
|
-
|
46
|
+
# Offense count: 2
|
47
|
+
# Cop supports --auto-correct.
|
48
|
+
Performance/RegexpMatch:
|
49
|
+
Exclude:
|
50
|
+
- 'lib/tasks/web.rake'
|
51
|
+
|
52
|
+
# Offense count: 5
|
53
|
+
# Cop supports --auto-correct.
|
54
|
+
RSpec/ContextMethod:
|
36
55
|
Exclude:
|
37
|
-
- 'spec/slack/
|
56
|
+
- 'spec/slack/messages/formatting_spec.rb'
|
57
|
+
- 'spec/slack/web/api/mixins/channels_spec.rb'
|
58
|
+
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
59
|
+
- 'spec/slack/web/api/mixins/users_spec.rb'
|
38
60
|
|
39
|
-
# Offense count:
|
61
|
+
# Offense count: 72
|
40
62
|
# Configuration parameters: Prefixes.
|
41
63
|
# Prefixes: when, with, without
|
42
64
|
RSpec/ContextWording:
|
43
65
|
Enabled: false
|
44
66
|
|
45
|
-
# Offense count:
|
67
|
+
# Offense count: 131
|
68
|
+
# Cop supports --auto-correct.
|
69
|
+
# Configuration parameters: AllowConsecutiveOneLiners.
|
70
|
+
RSpec/EmptyLineAfterExample:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
# Offense count: 66
|
46
74
|
# Configuration parameters: Max.
|
47
75
|
RSpec/ExampleLength:
|
48
76
|
Enabled: false
|
49
77
|
|
50
|
-
# Offense count:
|
78
|
+
# Offense count: 18
|
51
79
|
# Configuration parameters: CustomTransform, IgnoreMethods.
|
52
80
|
RSpec/FilePath:
|
53
81
|
Enabled: false
|
54
82
|
|
55
|
-
# Offense count:
|
83
|
+
# Offense count: 14
|
56
84
|
# Configuration parameters: AssignmentOnly.
|
57
85
|
RSpec/InstanceVariable:
|
58
86
|
Exclude:
|
@@ -60,25 +88,31 @@ RSpec/InstanceVariable:
|
|
60
88
|
- 'spec/slack/real_time/client_spec.rb'
|
61
89
|
- 'spec/slack/slack_spec.rb'
|
62
90
|
|
63
|
-
# Offense count:
|
91
|
+
# Offense count: 77
|
64
92
|
# Configuration parameters: .
|
65
93
|
# SupportedStyles: have_received, receive
|
66
94
|
RSpec/MessageSpies:
|
67
95
|
EnforcedStyle: receive
|
68
96
|
|
69
|
-
# Offense count:
|
70
|
-
# Configuration parameters: AggregateFailuresByDefault.
|
97
|
+
# Offense count: 95
|
71
98
|
RSpec/MultipleExpectations:
|
72
99
|
Max: 5
|
73
100
|
|
74
|
-
# Offense count:
|
101
|
+
# Offense count: 2
|
102
|
+
# Configuration parameters: IgnoreSharedExamples.
|
103
|
+
RSpec/NamedSubject:
|
104
|
+
Exclude:
|
105
|
+
- 'spec/slack/web/api/mixins/conversations_list_spec.rb'
|
106
|
+
|
107
|
+
# Offense count: 37
|
75
108
|
RSpec/NestedGroups:
|
76
109
|
Max: 6
|
77
110
|
|
78
|
-
# Offense count:
|
111
|
+
# Offense count: 4
|
79
112
|
RSpec/SubjectStub:
|
80
113
|
Exclude:
|
81
114
|
- 'spec/slack/web/api/mixins/channels_spec.rb'
|
115
|
+
- 'spec/slack/web/api/mixins/conversations_spec.rb'
|
82
116
|
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
83
117
|
- 'spec/slack/web/api/mixins/users_spec.rb'
|
84
118
|
|
@@ -88,7 +122,11 @@ RSpec/VerifiedDoubles:
|
|
88
122
|
Exclude:
|
89
123
|
- 'spec/slack/events/request_spec.rb'
|
90
124
|
- 'spec/slack/real_time/client_spec.rb'
|
91
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
92
|
-
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
93
125
|
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
|
94
126
|
- 'spec/support/real_time/connected_client.rb'
|
127
|
+
|
128
|
+
# Offense count: 4
|
129
|
+
# Configuration parameters: .
|
130
|
+
# SupportedStyles: annotated, template, unannotated
|
131
|
+
Style/FormatStringToken:
|
132
|
+
EnforcedStyle: unannotated
|
data/.travis.yml
CHANGED
@@ -3,9 +3,9 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.3.8
|
7
6
|
- 2.5.3
|
8
7
|
- 2.6.0
|
8
|
+
- 2.7.1
|
9
9
|
- ruby-head
|
10
10
|
- jruby-head
|
11
11
|
|
@@ -14,10 +14,6 @@ matrix:
|
|
14
14
|
- rvm: 2.4.1
|
15
15
|
script:
|
16
16
|
- bundle exec danger
|
17
|
-
- rvm: 2.4.1
|
18
|
-
env: CONCURRENCY=celluloid-io
|
19
|
-
- rvm: 2.4.1
|
20
|
-
env: CONCURRENCY=faye-websocket
|
21
17
|
- rvm: 2.5.3
|
22
18
|
env: CONCURRENCY=async-websocket
|
23
19
|
allow_failures:
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,48 @@
|
|
1
|
+
### 0.17.0 (2021/03/07)
|
2
|
+
|
3
|
+
* [#370](https://github.com/slack-ruby/slack-ruby-client/pull/370): Removed deprecated `im_`, `mpim_`, `channels_`, and `groups_` methods - [@dblock](https://github.com/dblock).
|
4
|
+
* [#368](https://github.com/slack-ruby/slack-ruby-client/pull/368): Removed `admin_conversations_whitelist` and `admin_conversations_disconnectShared` - [@dblock](https://github.com/dblock).
|
5
|
+
* [#359](https://github.com/slack-ruby/slack-ruby-client/pull/359): Handle non-JSON 500 errors - [@agrobbin](https://github.com/agrobbin).
|
6
|
+
* [#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).
|
7
|
+
* [#369](https://github.com/slack-ruby/slack-ruby-client/pull/369): Support rack requests in `Slack::Events::Request` - [@wedgex](https://github.com/wedgex).
|
8
|
+
|
9
|
+
### 0.16.0 (2021/01/24)
|
10
|
+
|
11
|
+
* [#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).
|
12
|
+
* [#354](https://github.com/slack-ruby/slack-ruby-client/pull/354): Rewind body after checking request signature - [@sunny](https://github.com/sunny).
|
13
|
+
* [#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).
|
14
|
+
* [#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).
|
15
|
+
* [#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).
|
16
|
+
|
17
|
+
### 0.15.1 (2020/9/3)
|
18
|
+
|
19
|
+
* [#336](https://github.com/slack-ruby/slack-ruby-client/pull/336): Fix: handle nil events - [@pyama86](https://github.com/pyama86).
|
20
|
+
* [#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).
|
21
|
+
* [#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).
|
22
|
+
|
23
|
+
### 0.15.0 (2020/7/26)
|
24
|
+
|
25
|
+
* [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
|
26
|
+
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
|
27
|
+
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Upgrade slack-ruby-danger, rubocop, rubocop-rspec and rubocop-performance - [@dblock](https://github.com/dblock).
|
28
|
+
* [#327](https://github.com/slack-ruby/slack-ruby-client/pull/327), [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Added `admin_conversations_whitelist`, `admin_usergroups`, `calls` and `calls_participants` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
29
|
+
* [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
|
30
|
+
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
|
31
|
+
* [#331](https://github.com/slack-ruby/slack-ruby-client/pull/331): Use `conversations_list` instead of deprecated `channels_list`. Added `admin_conversations_restrictAccess_addGroup`, `admin_conversations_restrictAccess_listGroups` and `admin_conversations_restrictAccess_removeGroup` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
32
|
+
|
33
|
+
### 0.14.6 (2020/3/28)
|
34
|
+
|
35
|
+
* [#305](https://github.com/slack-ruby/slack-ruby-client/pull/305): Added `admin_inviteRequests_approve`, `admin_inviteRequests_deny`, `admin_inviteRequests_list`, `admin_inviteRequests_approved_list`, `admin_inviteRequests_denied_list`, `admin_teams_create`, `admin_teams_list`, `admin_teams_admins_list`, `admin_teams_owners_list`, `admin_teams_settings`, `admin_teams_settings_setIcon`, `admin_teams_settings_setName`, `admin_teams_settings_setDescription`, `admin_users_assign`, `admin_users_invite`, `admin_users_remove`, `admin_users_setAdmin`, `admin_users_setOwner` and `admin_users_setRegular` endpoints - [@manuelmeurer](https://github.com/manuelmeurer).
|
36
|
+
* [#311](https://github.com/slack-ruby/slack-ruby-client/pull/311): Made Web API `response_metadata` more accessible in errors - [@jmanian](https://github.com/jmanian).
|
37
|
+
* [#312](https://github.com/slack-ruby/slack-ruby-client/pull/312): Added specific error classes for Web API - [@jmanian](https://github.com/jmanian).
|
38
|
+
* [#313](https://github.com/slack-ruby/slack-ruby-client/pull/313): Added `admin_teams_settings_info`, `admin_users_list`, `admin_users_setExpiration`, `admin_apps_approved_list`, `admin_apps_restricted_list`, `admin_conversations_setTeams`, `admin_emoji_add`, `admin_emoji_addAlias`, `admin_emoji_list`, `admin_emoji_remove` and `admin_emoji_rename` endpoints - [@dblock](https://github.com/dblock).
|
39
|
+
|
1
40
|
### 0.14.5 (2019/12/23)
|
2
41
|
|
3
42
|
* [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
|
4
43
|
* [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk).
|
5
|
-
* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298):
|
6
|
-
* [#
|
44
|
+
* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Added `admin_apps`, `admin_app_requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
|
45
|
+
* [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth_v2_access` and `views_publish` endpoints - [@jwright](https://github.com/jwright).
|
7
46
|
* [#309](https://github.com/slack-ruby/slack-ruby-client/pull/309): Stop ping on `inactive_account` and `invalid_auth` - [@dblock](https://github.com/dblock).
|
8
47
|
|
9
48
|
### 0.14.4 (2019/7/28)
|
@@ -167,8 +206,8 @@
|
|
167
206
|
### 0.7.1 (2016/5/2)
|
168
207
|
|
169
208
|
* [#82](https://github.com/slack-ruby/slack-ruby-client/pull/82): Fix `usergroups.users.{list,update}` and `files.comments.{add,edit,delete}` APIs - [@masatomo](https://github.com/masatomo).
|
170
|
-
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73):
|
171
|
-
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69):
|
209
|
+
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Added a `closed` event - [@rkadyb](https://github.com/rkadyb).
|
210
|
+
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Added attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
|
172
211
|
* [#85](https://github.com/slack-ruby/slack-ruby-client/issues/85): Compatibility with WebMock 2.0 - [@dblock](https://github.com/dblock).
|
173
212
|
* Added `as_user` to `chat_delete` Web API - [@dblock](https://github.com/dblock).
|
174
213
|
* Added `reminders_add`, `reminders_complete`, `reminders_delete`, `reminders_info` and `reminders_list` to Web API - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
@@ -75,13 +75,24 @@ rake slack:api:update
|
|
75
75
|
|
76
76
|
Sometimes it's necessary to patch auto-generated Slack Web API methods. For example, we want to help clients with calling `to_json` on the `attachments` parameter sent to `chat_postMessage`. See [#20](https://github.com/slack-ruby/slack-ruby-client/issues/20).
|
77
77
|
|
78
|
-
|
78
|
+
The broad steps are:
|
79
|
+
1. Run `rake slack:api:update` to check that existing patches are still valid.
|
80
|
+
- If you run into a `failed to apply patch` error, the auto-generated methods likely drifted from the last patch. Follow the steps [below](#resolving-patch-errors).
|
81
|
+
- This may add new methods if the API has updated, please split them up into multiple PRs if so.
|
82
|
+
2. Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb`.
|
83
|
+
3. Generate a patch:
|
84
|
+
```
|
85
|
+
git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
|
86
|
+
```
|
87
|
+
4. Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
88
|
+
|
89
|
+
##### Resolving Patch Errors
|
90
|
+
|
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. 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).
|
79
95
|
|
80
|
-
```
|
81
|
-
git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
|
82
|
-
```
|
83
|
-
|
84
|
-
Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
85
96
|
|
86
97
|
### Write Documentation
|
87
98
|
|
data/Dangerfile
CHANGED
data/Gemfile
CHANGED
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
@@ -20,17 +20,22 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
20
20
|
- [Using the Legacy API Token](#using-the-legacy-api-token)
|
21
21
|
- [Global Settings](#global-settings)
|
22
22
|
- [Web Client](#web-client)
|
23
|
-
- [
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
23
|
+
- [Web Client Examples](#web-client-examples)
|
24
|
+
- [Test Auth](#test-auth)
|
25
|
+
- [Send Messages](#send-messages)
|
26
|
+
- [List Channels](#list-channels)
|
27
|
+
- [Upload a File](#upload-a-file)
|
28
|
+
- [Get Channel Info](#get-channel-info)
|
29
|
+
- [Get User Info](#get-user-info)
|
30
|
+
- [Search for a User](#search-for-a-user)
|
31
|
+
- [Other](#other)
|
31
32
|
- [Web Client Options](#web-client-options)
|
32
33
|
- [Pagination Support](#pagination-support)
|
34
|
+
- [Character Encoding](#character-encoding)
|
33
35
|
- [Error Handling](#error-handling)
|
36
|
+
- [Slack Errors](#slack-errors)
|
37
|
+
- [Rate Limiting](#rate-limiting)
|
38
|
+
- [Other Errors](#other-errors)
|
34
39
|
- [RealTime Client](#realtime-client)
|
35
40
|
- [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
|
36
41
|
- [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
|
@@ -42,8 +47,6 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
42
47
|
- [Large Team Considerations](#large-team-considerations)
|
43
48
|
- [Concurrency](#concurrency)
|
44
49
|
- [Async](#async)
|
45
|
-
- [Faye::Websocket with Eventmachine](#fayewebsocket-with-eventmachine)
|
46
|
-
- [Celluloid](#celluloid)
|
47
50
|
- [Events API](#events-api)
|
48
51
|
- [Configuring Slack::Events](#configuring-slackevents)
|
49
52
|
- [Verifying the Request Signature](#verifying-the-request-signature)
|
@@ -67,7 +70,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
67
70
|
|
68
71
|
## Stable Release
|
69
72
|
|
70
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.
|
73
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.17.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
71
74
|
|
72
75
|
## Installation
|
73
76
|
|
@@ -77,7 +80,7 @@ Add to Gemfile.
|
|
77
80
|
gem 'slack-ruby-client'
|
78
81
|
```
|
79
82
|
|
80
|
-
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.
|
81
84
|
|
82
85
|
```
|
83
86
|
gem 'async-websocket', '~> 0.8.0'
|
@@ -122,14 +125,18 @@ logger | An optional logger, defaults to `::Logger.new(STDOUT)` at `Logger
|
|
122
125
|
|
123
126
|
The Slack Web API allows you to build applications that interact with Slack.
|
124
127
|
|
125
|
-
####
|
128
|
+
#### Web Client Examples
|
129
|
+
|
130
|
+
Here are some examples of how to use the web client with the Web API.
|
131
|
+
|
132
|
+
##### Test Auth
|
126
133
|
|
127
134
|
```ruby
|
128
135
|
client = Slack::Web::Client.new
|
129
136
|
client.auth_test
|
130
137
|
```
|
131
138
|
|
132
|
-
|
139
|
+
##### Send Messages
|
133
140
|
|
134
141
|
Send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
|
135
142
|
|
@@ -141,17 +148,17 @@ See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
|
|
141
148
|
|
142
149
|
![](examples/hi_web/hi.gif)
|
143
150
|
|
144
|
-
|
151
|
+
##### List Channels
|
145
152
|
|
146
|
-
List channels with [
|
153
|
+
List channels with [conversations_list](https://api.slack.com/methods/conversations.list).
|
147
154
|
|
148
155
|
```ruby
|
149
|
-
channels = client.
|
156
|
+
channels = client.conversations_list.channels
|
150
157
|
|
151
158
|
general_channel = channels.detect { |c| c.name == 'general' }
|
152
159
|
```
|
153
160
|
|
154
|
-
|
161
|
+
##### Upload a File
|
155
162
|
|
156
163
|
Upload a file with [files_upload](https://api.slack.com/methods/files.upload).
|
157
164
|
|
@@ -166,19 +173,19 @@ client.files_upload(
|
|
166
173
|
)
|
167
174
|
```
|
168
175
|
|
169
|
-
|
176
|
+
##### Get Channel Info
|
170
177
|
|
171
|
-
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.
|
172
179
|
|
173
180
|
```ruby
|
174
|
-
client.
|
181
|
+
client.conversations_info(channel: 'C04KB5X4D') # calls conversations_info
|
175
182
|
```
|
176
183
|
|
177
184
|
```ruby
|
178
|
-
client.
|
185
|
+
client.conversations_info(channel: '#general') # calls conversations_list followed by conversations_info
|
179
186
|
```
|
180
187
|
|
181
|
-
|
188
|
+
##### Get User Info
|
182
189
|
|
183
190
|
You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API and the `users_id` method called invokes `users_list` in order to locate the user ID.
|
184
191
|
|
@@ -190,7 +197,7 @@ client.users_info(user: 'U092BDCLV') # calls users_info
|
|
190
197
|
client.users_info(user: '@dblock') # calls users_list followed by users_info
|
191
198
|
```
|
192
199
|
|
193
|
-
|
200
|
+
##### Search for a User
|
194
201
|
|
195
202
|
Constructs an in-memory index of users and searches it. If you want to use this functionality, add the [picky](https://github.com/floere/picky) gem to your project's Gemfile.
|
196
203
|
|
@@ -198,7 +205,7 @@ Constructs an in-memory index of users and searches it. If you want to use this
|
|
198
205
|
client.users_search(user: 'dblock')
|
199
206
|
```
|
200
207
|
|
201
|
-
|
208
|
+
##### Other
|
202
209
|
|
203
210
|
Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
|
204
211
|
|
@@ -231,11 +238,12 @@ timeout | Optional open/read timeout in seconds.
|
|
231
238
|
open_timeout | Optional connection open timeout in seconds.
|
232
239
|
default_page_size | Optional page size for paginated requests, default is _100_.
|
233
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`.
|
234
242
|
|
235
243
|
You can also pass request options, including `timeout` and `open_timeout` into individual calls.
|
236
244
|
|
237
245
|
```ruby
|
238
|
-
client.
|
246
|
+
client.conversations_list(request: { timeout: 180 })
|
239
247
|
```
|
240
248
|
|
241
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).
|
@@ -268,13 +276,59 @@ end
|
|
268
276
|
all_members # many thousands of team members retrieved 10 at a time
|
269
277
|
```
|
270
278
|
|
279
|
+
#### Character Encoding
|
280
|
+
|
281
|
+
Note that Slack expects `text` to be UTF-8 encoded. If your messages appear with text such as `BAD+11` in Slack, check `text.encoding` and `.encode(Encoding::UTF_8)` your messages before sending them to Slack.
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
text = 'characters such as "Ñ", "Á", "É"'
|
285
|
+
text.encoding
|
286
|
+
=> #<Encoding:UTF-8>
|
287
|
+
client.chat_postMessage(channel: '#general', text: text, as_user: true)
|
288
|
+
# renders 'characters such as "Ñ", "Á", "É"' in Slack
|
289
|
+
|
290
|
+
text = text.encode(Encoding::ISO_8859_1)
|
291
|
+
text.encoding
|
292
|
+
# => #<Encoding:ISO-8859-1>
|
293
|
+
client.chat_postMessage(channel: '#general', text: text, as_user: true)
|
294
|
+
# renders 'characters such as "BAD+11", "", "BAD+9"' in Slack
|
295
|
+
```
|
296
|
+
|
271
297
|
#### Error Handling
|
272
298
|
|
273
|
-
|
299
|
+
##### Slack Errors
|
300
|
+
|
301
|
+
If Slack returns an error for the request, then an error will be raised. The error class is specific to the type of error that Slack returns. For instance if Slack returns `account_inactive` then the error will be `Slack::Web::Api::Errors::AccountInactive`. This allows you to handle certain types of errors as needed:
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
rescue Slack::Web::Api::Errors::AccountInactive => e
|
305
|
+
# deal with inactive account
|
306
|
+
end
|
307
|
+
```
|
308
|
+
|
309
|
+
All of these errors inherit from `Slack::Web::Api::Errors::SlackError`, so you can handle or silence all errors if necessary:
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
rescue Slack::Web::Api::Errors::SlackError => e
|
313
|
+
# capture all Slack errors
|
314
|
+
end
|
315
|
+
```
|
316
|
+
|
317
|
+
If there's a new error type that is not yet known by this library, then it will raise `Slack::Web::Api::Errors::SlackError`. (Update the Web API if you find that errors are missing — see [CONTRIBUTING](CONTRIBUTING.md).)
|
318
|
+
|
319
|
+
In all of these cases the error message contains the error code, which is also accessible with `slack_error.error`. In case of multiple errors, the error message contains the error codes separated by commas, or they are accessible as an array with `slack_error.errors`. The original response is also accessible using the `response` attribute. The `response_metadata` is accessible with `slack_error.response_metadata`.
|
320
|
+
|
321
|
+
##### Rate Limiting
|
322
|
+
|
323
|
+
If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead. (This does not inherit from `Slack::Web::Api::Errors::SlackError`.)
|
324
|
+
|
325
|
+
##### Other Errors
|
274
326
|
|
275
|
-
|
327
|
+
In case of Slack temporarily unavailability a `Slack::Web::Api::Errors::ServerError` (`Slack::Web::Api::Errors::SlackError` subclass) subclasses will be raised and original `Faraday::Error` will be accesible via `exception.cause`.
|
276
328
|
|
277
|
-
|
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.
|
278
332
|
|
279
333
|
### RealTime Client
|
280
334
|
|
@@ -439,7 +493,7 @@ See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a dis
|
|
439
493
|
|
440
494
|
#### Concurrency
|
441
495
|
|
442
|
-
`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).
|
443
497
|
|
444
498
|
```ruby
|
445
499
|
Slack::RealTime.configure do |config|
|
@@ -457,7 +511,7 @@ client.start_async
|
|
457
511
|
|
458
512
|
##### Async
|
459
513
|
|
460
|
-
|
514
|
+
Add `async-websocket` to your Gemfile.
|
461
515
|
|
462
516
|
```
|
463
517
|
gem 'async-websocket'
|
@@ -465,26 +519,6 @@ gem 'async-websocket'
|
|
465
519
|
|
466
520
|
See a fully working example in [examples/hi_real_time_async_async](examples/hi_real_time_async_async/hi.rb).
|
467
521
|
|
468
|
-
##### Faye::Websocket with Eventmachine
|
469
|
-
|
470
|
-
Add the following to your Gemfile.
|
471
|
-
|
472
|
-
```
|
473
|
-
gem 'faye-websocket'
|
474
|
-
```
|
475
|
-
|
476
|
-
See a fully working example in [examples/hi_real_time_async_eventmachine](examples/hi_real_time_async_eventmachine/hi.rb).
|
477
|
-
|
478
|
-
##### Celluloid
|
479
|
-
|
480
|
-
Add the following to your Gemfile.
|
481
|
-
|
482
|
-
```
|
483
|
-
gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io']
|
484
|
-
```
|
485
|
-
|
486
|
-
See a fully working example in [examples/hi_real_time_async_celluloid](examples/hi_real_time_async_celluloid/hi.rb).
|
487
|
-
|
488
522
|
### Events API
|
489
523
|
|
490
524
|
This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
|
@@ -612,6 +646,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
|
|
612
646
|
|
613
647
|
## Copyright and License
|
614
648
|
|
615
|
-
Copyright (c) 2015-
|
649
|
+
Copyright (c) 2015-2021, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
|
616
650
|
|
617
651
|
This project is licensed under the [MIT License](LICENSE.md).
|