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
data/bin/commands/team.rb
CHANGED
@@ -7,6 +7,7 @@ command 'team' do |g|
|
|
7
7
|
g.long_desc %( Gets the access logs for the current team. )
|
8
8
|
g.command 'accessLogs' do |c|
|
9
9
|
c.flag 'before', desc: 'End of time range of logs to include in results (inclusive).'
|
10
|
+
c.flag 'team_id', desc: 'encoded team id to get logs from, required if org token is used.'
|
10
11
|
c.action do |_global_options, options, _args|
|
11
12
|
puts JSON.dump($client.team_accessLogs(options))
|
12
13
|
end
|
@@ -15,6 +16,7 @@ command 'team' do |g|
|
|
15
16
|
g.desc 'Gets billable users information for the current team.'
|
16
17
|
g.long_desc %( Gets billable users information for the current team. )
|
17
18
|
g.command 'billableInfo' do |c|
|
19
|
+
c.flag 'team_id', desc: 'encoded team id to get the billable information from, required if org token is used.'
|
18
20
|
c.flag 'user', desc: 'A user to retrieve the billable information for. Defaults to all users.'
|
19
21
|
c.action do |_global_options, options, _args|
|
20
22
|
puts JSON.dump($client.team_billableInfo(options))
|
@@ -36,6 +38,7 @@ command 'team' do |g|
|
|
36
38
|
c.flag 'app_id', desc: 'Filter logs to this Slack app. Defaults to all logs.'
|
37
39
|
c.flag 'change_type', desc: 'Filter logs with this change type. Defaults to all logs.'
|
38
40
|
c.flag 'service_id', desc: 'Filter logs to this service. Defaults to all logs.'
|
41
|
+
c.flag 'team_id', desc: 'encoded team id to get logs from, required if org token is used.'
|
39
42
|
c.flag 'user', desc: "Filter logs generated by this user's actions. Defaults to all logs."
|
40
43
|
c.action do |_global_options, options, _args|
|
41
44
|
puts JSON.dump($client.team_integrationLogs(options))
|
data/bin/commands/usergroups.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc "Get info on your team's User Groups."
|
5
5
|
command 'usergroups' do |g|
|
6
6
|
g.desc 'Create a User Group'
|
7
7
|
g.long_desc %( Create a User Group )
|
@@ -11,6 +11,7 @@ command 'usergroups' do |g|
|
|
11
11
|
c.flag 'description', desc: 'A short description of the User Group.'
|
12
12
|
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
|
13
13
|
c.flag 'include_count', desc: 'Include the number of users in each User Group.'
|
14
|
+
c.flag 'team_id', desc: 'Encoded team id where the user group has to be created, required if org token is used.'
|
14
15
|
c.action do |_global_options, options, _args|
|
15
16
|
puts JSON.dump($client.usergroups_create(options))
|
16
17
|
end
|
@@ -21,6 +22,7 @@ command 'usergroups' do |g|
|
|
21
22
|
g.command 'disable' do |c|
|
22
23
|
c.flag 'usergroup', desc: 'The encoded ID of the User Group to disable.'
|
23
24
|
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
25
|
+
c.flag 'team_id', desc: 'Encoded team id where the user group is, required if org token is used.'
|
24
26
|
c.action do |_global_options, options, _args|
|
25
27
|
puts JSON.dump($client.usergroups_disable(options))
|
26
28
|
end
|
@@ -31,6 +33,7 @@ command 'usergroups' do |g|
|
|
31
33
|
g.command 'enable' do |c|
|
32
34
|
c.flag 'usergroup', desc: 'The encoded ID of the User Group to enable.'
|
33
35
|
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
36
|
+
c.flag 'team_id', desc: 'Encoded team id where the user group is, required if org token is used.'
|
34
37
|
c.action do |_global_options, options, _args|
|
35
38
|
puts JSON.dump($client.usergroups_enable(options))
|
36
39
|
end
|
@@ -42,6 +45,7 @@ command 'usergroups' do |g|
|
|
42
45
|
c.flag 'include_count', desc: 'Include the number of users in each User Group.'
|
43
46
|
c.flag 'include_disabled', desc: 'Include disabled User Groups.'
|
44
47
|
c.flag 'include_users', desc: 'Include the list of users for each User Group.'
|
48
|
+
c.flag 'team_id', desc: 'encoded team id to list user groups in, required if org token is used.'
|
45
49
|
c.action do |_global_options, options, _args|
|
46
50
|
puts JSON.dump($client.usergroups_list(options))
|
47
51
|
end
|
@@ -56,6 +60,7 @@ command 'usergroups' do |g|
|
|
56
60
|
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
|
57
61
|
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
58
62
|
c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
|
63
|
+
c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
|
59
64
|
c.action do |_global_options, options, _args|
|
60
65
|
puts JSON.dump($client.usergroups_update(options))
|
61
66
|
end
|
@@ -8,6 +8,7 @@ command 'usergroups_users' do |g|
|
|
8
8
|
g.command 'list' do |c|
|
9
9
|
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
|
10
10
|
c.flag 'include_disabled', desc: 'Allow results that involve disabled User Groups.'
|
11
|
+
c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
|
11
12
|
c.action do |_global_options, options, _args|
|
12
13
|
puts JSON.dump($client.usergroups_users_list(options))
|
13
14
|
end
|
@@ -19,6 +20,7 @@ command 'usergroups_users' do |g|
|
|
19
20
|
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
|
20
21
|
c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the User Group.'
|
21
22
|
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
|
23
|
+
c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
|
22
24
|
c.action do |_global_options, options, _args|
|
23
25
|
puts JSON.dump($client.usergroups_users_update(options))
|
24
26
|
end
|
data/bin/commands/users.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
-
desc '
|
4
|
+
desc 'Get info on members of your Slack team.'
|
5
5
|
command 'users' do |g|
|
6
6
|
g.desc 'List conversations the calling user may access.'
|
7
7
|
g.long_desc %( List conversations the calling user may access. )
|
@@ -9,6 +9,7 @@ command 'users' do |g|
|
|
9
9
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
10
10
|
c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
|
11
11
|
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer no larger than 1000."
|
12
|
+
c.flag 'team_id', desc: 'encoded team id to list conversations in, required if org token is used.'
|
12
13
|
c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
|
13
14
|
c.flag 'user', desc: "Browse conversations by a specific user ID's membership. Non-public channels are restricted to those where the calling user shares membership."
|
14
15
|
c.action do |_global_options, options, _args|
|
@@ -65,7 +66,8 @@ command 'users' do |g|
|
|
65
66
|
g.command 'list' do |c|
|
66
67
|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
|
67
68
|
c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.'
|
68
|
-
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
|
69
|
+
c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors."
|
70
|
+
c.flag 'team_id', desc: 'encoded team id to list users in, required if org token is used.'
|
69
71
|
c.action do |_global_options, options, _args|
|
70
72
|
puts JSON.dump($client.users_list(options))
|
71
73
|
end
|
@@ -100,10 +102,10 @@ command 'users' do |g|
|
|
100
102
|
g.desc 'Set the user profile photo'
|
101
103
|
g.long_desc %( Set the user profile photo )
|
102
104
|
g.command 'setPhoto' do |c|
|
103
|
-
c.flag 'image', desc: 'File contents via multipart/form-data.'
|
104
105
|
c.flag 'crop_w', desc: 'Width/height of crop box (always square).'
|
105
106
|
c.flag 'crop_x', desc: 'X coordinate of top-left corner of crop box.'
|
106
107
|
c.flag 'crop_y', desc: 'Y coordinate of top-left corner of crop box.'
|
108
|
+
c.flag 'image', desc: 'File contents via multipart/form-data.'
|
107
109
|
c.action do |_global_options, options, _args|
|
108
110
|
puts JSON.dump($client.users_setPhoto(options))
|
109
111
|
end
|
@@ -3,18 +3,18 @@
|
|
3
3
|
|
4
4
|
desc 'UsersProfile methods.'
|
5
5
|
command 'users_profile' do |g|
|
6
|
-
g.desc "
|
7
|
-
g.long_desc %(
|
6
|
+
g.desc "Retrieve a user's profile information, including their custom status."
|
7
|
+
g.long_desc %( Retrieve a user's profile information, including their custom status. )
|
8
8
|
g.command 'get' do |c|
|
9
|
-
c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields.'
|
9
|
+
c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields. Using this parameter will heavily rate-limit your requests and is not recommended.'
|
10
10
|
c.flag 'user', desc: 'User to retrieve profile info for.'
|
11
11
|
c.action do |_global_options, options, _args|
|
12
12
|
puts JSON.dump($client.users_profile_get(options))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
g.desc
|
17
|
-
g.long_desc %( Set
|
16
|
+
g.desc "Set a user's profile information, including custom status."
|
17
|
+
g.long_desc %( Set a user's profile information, including custom status. )
|
18
18
|
g.command 'set' do |c|
|
19
19
|
c.flag 'name', desc: 'Name of a single key to set. Usable only if profile is not passed.'
|
20
20
|
c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash. At most 50 fields may be set. Each field name is limited to 255 characters.'
|
data/bin/commands/views.rb
CHANGED
@@ -37,7 +37,7 @@ command 'views' do |g|
|
|
37
37
|
g.desc 'Update an existing view.'
|
38
38
|
g.long_desc %( Update an existing view. )
|
39
39
|
g.command 'update' do |c|
|
40
|
-
c.flag 'view', desc: 'A view
|
40
|
+
c.flag 'view', desc: 'A view object. This must be a JSON-encoded string.'
|
41
41
|
c.flag 'external_id', desc: 'A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.'
|
42
42
|
c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
|
43
43
|
c.flag 'view_id', desc: 'A unique identifier of the view to be updated. Either view_id or external_id is required.'
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
desc 'Workflows methods.'
|
5
|
+
command 'workflows' do |g|
|
6
|
+
g.desc "Indicate that an app's step in a workflow completed execution."
|
7
|
+
g.long_desc %( Indicate that an app's step in a workflow completed execution. )
|
8
|
+
g.command 'stepCompleted' do |c|
|
9
|
+
c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
|
10
|
+
c.flag 'outputs', desc: 'Key-value object of outputs from your step. Keys of this object reflect the configured key properties of your outputs array from your workflow_step object.'
|
11
|
+
c.action do |_global_options, options, _args|
|
12
|
+
puts JSON.dump($client.workflows_stepCompleted(options))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
g.desc "Indicate that an app's step in a workflow failed to execute."
|
17
|
+
g.long_desc %( Indicate that an app's step in a workflow failed to execute. )
|
18
|
+
g.command 'stepFailed' do |c|
|
19
|
+
c.flag 'error', desc: 'A JSON-based object with a message property that should contain a human readable error message.'
|
20
|
+
c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
|
21
|
+
c.action do |_global_options, options, _args|
|
22
|
+
puts JSON.dump($client.workflows_stepFailed(options))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
g.desc 'Update the configuration for a workflow step.'
|
27
|
+
g.long_desc %( Update the configuration for a workflow step. )
|
28
|
+
g.command 'updateStep' do |c|
|
29
|
+
c.flag 'workflow_step_edit_id', desc: 'A context identifier provided with view_submission payloads used to call back to workflows.updateStep.'
|
30
|
+
c.flag 'inputs', desc: 'A JSON key-value map of inputs required from a user during configuration. This is the data your app expects to receive when the workflow step starts. Please note: the embedded variable format is set and replaced by the workflow system. You cannot create custom variables that will be replaced at runtime. Read more about variables in workflow steps here.'
|
31
|
+
c.flag 'outputs', desc: 'An JSON array of output objects used during step execution. This is the data your app agrees to provide when your workflow step was executed.'
|
32
|
+
c.flag 'step_image_url', desc: 'An optional field that can be used to override app image that is shown in the Workflow Builder.'
|
33
|
+
c.flag 'step_name', desc: 'An optional field that can be used to override the step name that is shown in the Workflow Builder.'
|
34
|
+
c.action do |_global_options, options, _args|
|
35
|
+
puts JSON.dump($client.workflows_updateStep(options))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/slack-ruby-client.rb
CHANGED
@@ -15,19 +15,22 @@ require 'json'
|
|
15
15
|
require 'logger'
|
16
16
|
begin
|
17
17
|
require 'picky'
|
18
|
-
rescue LoadError # rubocop:disable Lint/
|
18
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
19
19
|
# ignore, only used in users_search
|
20
20
|
end
|
21
21
|
begin
|
22
22
|
require 'openssl'
|
23
|
-
rescue LoadError # rubocop:disable Lint/
|
23
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
24
24
|
# Used in slack/web/config
|
25
25
|
end
|
26
26
|
require_relative 'slack/web/config'
|
27
27
|
require_relative 'slack/web/api/errors/slack_error'
|
28
28
|
require_relative 'slack/web/api/errors/too_many_requests_error'
|
29
29
|
require_relative 'slack/web/api/error'
|
30
|
+
require_relative 'slack/web/api/errors'
|
31
|
+
require_relative 'slack/web/api/errors/internal_error'
|
30
32
|
require_relative 'slack/web/faraday/response/raise_error'
|
33
|
+
require_relative 'slack/web/faraday/response/wrap_error'
|
31
34
|
require_relative 'slack/web/faraday/connection'
|
32
35
|
require_relative 'slack/web/faraday/request'
|
33
36
|
require_relative 'slack/web/api/mixins'
|
@@ -36,8 +39,6 @@ require_relative 'slack/web/pagination/cursor'
|
|
36
39
|
require_relative 'slack/web/client'
|
37
40
|
|
38
41
|
# RealTime API
|
39
|
-
require 'active_support'
|
40
|
-
require 'active_support/core_ext'
|
41
42
|
require_relative 'slack/real_time/concurrency'
|
42
43
|
require_relative 'slack/real_time/socket'
|
43
44
|
require_relative 'slack/real_time/api/message_id'
|
data/lib/slack/events/request.rb
CHANGED
@@ -19,13 +19,13 @@ module Slack
|
|
19
19
|
|
20
20
|
# Request timestamp.
|
21
21
|
def timestamp
|
22
|
-
@timestamp ||= http_request.
|
22
|
+
@timestamp ||= http_request.get_header('HTTP_X_SLACK_REQUEST_TIMESTAMP')
|
23
23
|
end
|
24
24
|
|
25
25
|
# The signature is created by combining the signing secret with the body of the request
|
26
26
|
# Slack is sending using a standard HMAC-SHA256 keyed hash.
|
27
27
|
def signature
|
28
|
-
@signature ||= http_request.
|
28
|
+
@signature ||= http_request.get_header('HTTP_X_SLACK_SIGNATURE')
|
29
29
|
end
|
30
30
|
|
31
31
|
# Signature version.
|
@@ -35,7 +35,11 @@ module Slack
|
|
35
35
|
|
36
36
|
# Request body.
|
37
37
|
def body
|
38
|
-
@body ||=
|
38
|
+
@body ||= begin
|
39
|
+
body = http_request.body.read
|
40
|
+
http_request.body.rewind
|
41
|
+
body
|
42
|
+
end
|
39
43
|
end
|
40
44
|
|
41
45
|
# Returns true if the signature coming from Slack has expired.
|
@@ -20,7 +20,6 @@ module Slack
|
|
20
20
|
attr_accessor :store
|
21
21
|
attr_accessor :url
|
22
22
|
attr_accessor(*Config::ATTRIBUTES)
|
23
|
-
attr_accessor :logger
|
24
23
|
|
25
24
|
protected :store_class, :store_class=
|
26
25
|
|
@@ -251,6 +250,8 @@ module Slack
|
|
251
250
|
end
|
252
251
|
|
253
252
|
def run_handlers(type, data)
|
253
|
+
return unless store.class.events
|
254
|
+
|
254
255
|
handlers = store.class.events[type.to_s]
|
255
256
|
handlers&.each do |handler|
|
256
257
|
store.instance_exec(data, &handler)
|
@@ -114,9 +114,7 @@ module Slack
|
|
114
114
|
|
115
115
|
def build_endpoint
|
116
116
|
endpoint = ::Async::IO::Endpoint.tcp(addr, port)
|
117
|
-
if secure?
|
118
|
-
endpoint = ::Async::IO::SSLEndpoint.new(endpoint, ssl_context: build_ssl_context)
|
119
|
-
end
|
117
|
+
endpoint = ::Async::IO::SSLEndpoint.new(endpoint, ssl_context: build_ssl_context) if secure?
|
120
118
|
endpoint
|
121
119
|
end
|
122
120
|
|
@@ -17,7 +17,8 @@ module Slack
|
|
17
17
|
logger
|
18
18
|
].freeze
|
19
19
|
|
20
|
-
attr_accessor(*Config::ATTRIBUTES)
|
20
|
+
attr_accessor(*Config::ATTRIBUTES - [:concurrency])
|
21
|
+
attr_writer :concurrency
|
21
22
|
|
22
23
|
def reset
|
23
24
|
self.websocket_ping = 30
|
@@ -37,19 +38,9 @@ module Slack
|
|
37
38
|
private
|
38
39
|
|
39
40
|
def detect_concurrency
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
rescue LoadError, NameError
|
44
|
-
false # could not be loaded, missing dependencies
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
raise(
|
49
|
-
NoConcurrencyError,
|
50
|
-
'Missing concurrency. Add async-websocket, faye-websocket ' \
|
51
|
-
'or celluloid-io to your Gemfile.'
|
52
|
-
)
|
41
|
+
Slack::RealTime::Concurrency.const_get(:Async)
|
42
|
+
rescue LoadError, NameError
|
43
|
+
raise NoConcurrencyError, 'Missing concurrency. Add async-websocket to your Gemfile.'
|
53
44
|
end
|
54
45
|
end
|
55
46
|
|
@@ -8,9 +8,9 @@ module Slack
|
|
8
8
|
|
9
9
|
def initialize(url, options = {})
|
10
10
|
@url = url
|
11
|
-
@options = options
|
11
|
+
@options = options.dup
|
12
12
|
@driver = nil
|
13
|
-
@logger = options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
|
13
|
+
@logger = @options.delete(:logger) || Slack::RealTime::Config.logger || Slack::Config.logger
|
14
14
|
@last_message_at = nil
|
15
15
|
end
|
16
16
|
|
data/lib/slack/version.rb
CHANGED
@@ -1,17 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This file was auto-generated by lib/tasks/web.rake
|
3
3
|
|
4
|
+
require_relative 'endpoints/admin_analytics'
|
4
5
|
require_relative 'endpoints/admin_apps'
|
6
|
+
require_relative 'endpoints/admin_apps_approved'
|
5
7
|
require_relative 'endpoints/admin_apps_requests'
|
8
|
+
require_relative 'endpoints/admin_apps_restricted'
|
9
|
+
require_relative 'endpoints/admin_barriers'
|
10
|
+
require_relative 'endpoints/admin_conversations'
|
11
|
+
require_relative 'endpoints/admin_conversations_ekm'
|
12
|
+
require_relative 'endpoints/admin_conversations_restrictAccess'
|
13
|
+
require_relative 'endpoints/admin_emoji'
|
14
|
+
require_relative 'endpoints/admin_inviteRequests'
|
15
|
+
require_relative 'endpoints/admin_inviteRequests_approved'
|
16
|
+
require_relative 'endpoints/admin_inviteRequests_denied'
|
17
|
+
require_relative 'endpoints/admin_teams'
|
18
|
+
require_relative 'endpoints/admin_teams_admins'
|
19
|
+
require_relative 'endpoints/admin_teams_owners'
|
20
|
+
require_relative 'endpoints/admin_teams_settings'
|
21
|
+
require_relative 'endpoints/admin_usergroups'
|
22
|
+
require_relative 'endpoints/admin_users'
|
6
23
|
require_relative 'endpoints/admin_users_session'
|
7
24
|
require_relative 'endpoints/api'
|
8
25
|
require_relative 'endpoints/apps'
|
26
|
+
require_relative 'endpoints/apps_connections'
|
27
|
+
require_relative 'endpoints/apps_event_authorizations'
|
9
28
|
require_relative 'endpoints/apps_permissions'
|
10
29
|
require_relative 'endpoints/apps_permissions_resources'
|
11
30
|
require_relative 'endpoints/apps_permissions_scopes'
|
12
31
|
require_relative 'endpoints/apps_permissions_users'
|
13
32
|
require_relative 'endpoints/auth'
|
33
|
+
require_relative 'endpoints/auth_teams'
|
14
34
|
require_relative 'endpoints/bots'
|
35
|
+
require_relative 'endpoints/calls'
|
36
|
+
require_relative 'endpoints/calls_participants'
|
15
37
|
require_relative 'endpoints/channels'
|
16
38
|
require_relative 'endpoints/chat'
|
17
39
|
require_relative 'endpoints/chat_scheduledMessages'
|
@@ -43,26 +65,50 @@ require_relative 'endpoints/users_admin'
|
|
43
65
|
require_relative 'endpoints/users_prefs'
|
44
66
|
require_relative 'endpoints/users_profile'
|
45
67
|
require_relative 'endpoints/views'
|
68
|
+
require_relative 'endpoints/workflows'
|
46
69
|
|
47
70
|
module Slack
|
48
71
|
module Web
|
49
72
|
module Api
|
50
73
|
module Endpoints
|
74
|
+
include Slack::Web::Api::Mixins::Conversations
|
51
75
|
include Slack::Web::Api::Mixins::Channels
|
52
76
|
include Slack::Web::Api::Mixins::Users
|
53
77
|
include Slack::Web::Api::Mixins::Groups
|
54
78
|
|
79
|
+
include AdminAnalytics
|
55
80
|
include AdminApps
|
81
|
+
include AdminAppsApproved
|
56
82
|
include AdminAppsRequests
|
83
|
+
include AdminAppsRestricted
|
84
|
+
include AdminBarriers
|
85
|
+
include AdminConversations
|
86
|
+
include AdminConversationsEkm
|
87
|
+
include AdminConversationsRestrictaccess
|
88
|
+
include AdminEmoji
|
89
|
+
include AdminInviterequests
|
90
|
+
include AdminInviterequestsApproved
|
91
|
+
include AdminInviterequestsDenied
|
92
|
+
include AdminTeams
|
93
|
+
include AdminTeamsAdmins
|
94
|
+
include AdminTeamsOwners
|
95
|
+
include AdminTeamsSettings
|
96
|
+
include AdminUsergroups
|
97
|
+
include AdminUsers
|
57
98
|
include AdminUsersSession
|
58
99
|
include Api
|
59
100
|
include Apps
|
101
|
+
include AppsConnections
|
102
|
+
include AppsEventAuthorizations
|
60
103
|
include AppsPermissions
|
61
104
|
include AppsPermissionsResources
|
62
105
|
include AppsPermissionsScopes
|
63
106
|
include AppsPermissionsUsers
|
64
107
|
include Auth
|
108
|
+
include AuthTeams
|
65
109
|
include Bots
|
110
|
+
include Calls
|
111
|
+
include CallsParticipants
|
66
112
|
include Channels
|
67
113
|
include Chat
|
68
114
|
include ChatScheduledmessages
|
@@ -94,6 +140,7 @@ module Slack
|
|
94
140
|
include UsersPrefs
|
95
141
|
include UsersProfile
|
96
142
|
include Views
|
143
|
+
include Workflows
|
97
144
|
end
|
98
145
|
end
|
99
146
|
end
|