slack-ruby-client 2.6.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +4 -10
- data/.github/workflows/update_api.yml +1 -1
- data/.rubocop_todo.yml +58 -71
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +0 -9
- data/LICENSE.md +1 -1
- data/README.md +31 -220
- data/Rakefile +0 -1
- data/UPGRADING.md +4 -0
- data/bin/commands/admin_analytics.rb +1 -1
- data/bin/commands/admin_apps.rb +4 -4
- data/bin/commands/admin_apps_activities.rb +7 -7
- data/bin/commands/admin_apps_approved.rb +4 -4
- data/bin/commands/admin_apps_config.rb +3 -1
- data/bin/commands/admin_apps_requests.rb +5 -5
- data/bin/commands/admin_apps_restricted.rb +4 -4
- data/bin/commands/admin_audit_anomaly_allow.rb +6 -6
- data/bin/commands/admin_auth_policy.rb +5 -5
- data/bin/commands/admin_barriers.rb +3 -3
- data/bin/commands/admin_conversations.rb +15 -15
- data/bin/commands/admin_conversations_ekm.rb +2 -2
- data/bin/commands/admin_conversations_restrictAccess.rb +5 -5
- data/bin/commands/admin_emoji.rb +5 -5
- data/bin/commands/admin_functions.rb +1 -1
- data/bin/commands/admin_inviteRequests.rb +3 -3
- data/bin/commands/admin_inviteRequests_approved.rb +1 -1
- data/bin/commands/admin_inviteRequests_denied.rb +1 -1
- data/bin/commands/admin_roles.rb +3 -3
- data/bin/commands/admin_teams.rb +3 -3
- data/bin/commands/admin_teams_admins.rb +2 -2
- data/bin/commands/admin_teams_owners.rb +2 -2
- data/bin/commands/admin_teams_settings.rb +5 -5
- data/bin/commands/admin_usergroups.rb +4 -4
- data/bin/commands/admin_users.rb +12 -11
- data/bin/commands/admin_users_session.rb +6 -5
- data/bin/commands/admin_users_unsupportedVersions.rb +1 -1
- data/bin/commands/admin_workflows.rb +6 -6
- data/bin/commands/admin_workflows_collaborators.rb +2 -2
- data/bin/commands/apps_activities.rb +7 -7
- data/bin/commands/apps_auth_external.rb +1 -1
- data/bin/commands/apps_datastore.rb +12 -12
- data/bin/commands/apps_event_authorizations.rb +3 -3
- data/bin/commands/apps_manifest.rb +1 -1
- data/bin/commands/assistant_search.rb +18 -2
- data/bin/commands/assistant_threads.rb +2 -2
- data/bin/commands/auth.rb +1 -1
- data/bin/commands/auth_teams.rb +1 -1
- data/bin/commands/bookmarks.rb +6 -6
- data/bin/commands/calls.rb +5 -5
- data/bin/commands/canvases.rb +2 -2
- data/bin/commands/canvases_access.rb +1 -1
- data/bin/commands/chat.rb +23 -24
- data/bin/commands/conversations.rb +8 -8
- data/bin/commands/conversations_canvases.rb +1 -1
- data/bin/commands/conversations_externalInvitePermissions.rb +1 -1
- data/bin/commands/conversations_requestSharedInvite.rb +4 -4
- data/bin/commands/dnd.rb +1 -1
- data/bin/commands/files.rb +5 -5
- data/bin/commands/files_remote.rb +1 -1
- data/bin/commands/functions.rb +1 -1
- data/bin/commands/functions_distributions_permissions.rb +15 -15
- data/bin/commands/functions_workflows_steps.rb +2 -2
- data/bin/commands/functions_workflows_steps_responses.rb +2 -2
- data/bin/commands/migration.rb +2 -2
- data/bin/commands/oauth_v2.rb +1 -1
- data/bin/commands/openid_connect.rb +1 -1
- data/bin/commands/reactions.rb +3 -3
- data/bin/commands/reminders.rb +2 -2
- data/bin/commands/rtm.rb +15 -0
- data/bin/commands/search.rb +4 -4
- data/bin/commands/slackLists.rb +37 -0
- data/bin/commands/slackLists_access.rb +34 -0
- data/bin/commands/slackLists_download.rb +31 -0
- data/bin/commands/slackLists_items.rb +76 -0
- data/bin/commands/team.rb +1 -1
- data/bin/commands/team_externalTeams.rb +4 -4
- data/bin/commands/usergroups.rb +10 -10
- data/bin/commands/usergroups_users.rb +5 -5
- data/bin/commands/users.rb +1 -1
- data/bin/commands/users_discoverableContacts.rb +1 -1
- data/bin/commands/views.rb +4 -4
- data/bin/commands/workflows_featured.rb +50 -0
- data/bin/commands/workflows_triggers_permissions.rb +7 -7
- data/examples/files_upload_v2/files_upload_v2.rb +8 -0
- data/lib/slack/events/request.rb +1 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_apps_activities.rb +14 -14
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +5 -7
- data/lib/slack/web/api/endpoints/admin_apps_config.rb +6 -3
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +7 -9
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +5 -7
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +14 -14
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +27 -28
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +4 -4
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +11 -12
- data/lib/slack/web/api/endpoints/admin_emoji.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_functions.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_roles.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_teams.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +3 -4
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -3
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +12 -13
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_users.rb +27 -25
- data/lib/slack/web/api/endpoints/admin_users_session.rb +12 -9
- data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_workflows.rb +12 -12
- data/lib/slack/web/api/endpoints/admin_workflows_collaborators.rb +6 -6
- data/lib/slack/web/api/endpoints/apps_activities.rb +14 -14
- data/lib/slack/web/api/endpoints/apps_auth_external.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_datastore.rb +8 -15
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +0 -3
- data/lib/slack/web/api/endpoints/apps_manifest.rb +5 -5
- data/lib/slack/web/api/endpoints/assistant_search.rb +28 -3
- data/lib/slack/web/api/endpoints/assistant_threads.rb +6 -6
- data/lib/slack/web/api/endpoints/auth.rb +1 -1
- data/lib/slack/web/api/endpoints/auth_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/bookmarks.rb +14 -14
- data/lib/slack/web/api/endpoints/calls.rb +10 -10
- data/lib/slack/web/api/endpoints/canvases.rb +4 -4
- data/lib/slack/web/api/endpoints/canvases_access.rb +3 -3
- data/lib/slack/web/api/endpoints/chat.rb +53 -55
- data/lib/slack/web/api/endpoints/conversations.rb +16 -16
- data/lib/slack/web/api/endpoints/conversations_canvases.rb +1 -1
- data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +3 -3
- data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +8 -8
- data/lib/slack/web/api/endpoints/dnd.rb +2 -2
- data/lib/slack/web/api/endpoints/files.rb +11 -11
- data/lib/slack/web/api/endpoints/files_remote.rb +2 -2
- data/lib/slack/web/api/endpoints/functions.rb +3 -3
- data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +24 -24
- data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +4 -4
- data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +4 -4
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/openid_connect.rb +2 -2
- data/lib/slack/web/api/endpoints/reactions.rb +6 -6
- data/lib/slack/web/api/endpoints/reminders.rb +4 -4
- data/lib/slack/web/api/endpoints/rtm.rb +23 -0
- data/lib/slack/web/api/endpoints/search.rb +8 -8
- data/lib/slack/web/api/endpoints/slackLists.rb +52 -0
- data/lib/slack/web/api/endpoints/slackLists_access.rb +47 -0
- data/lib/slack/web/api/endpoints/slackLists_download.rb +40 -0
- data/lib/slack/web/api/endpoints/slackLists_items.rb +116 -0
- data/lib/slack/web/api/endpoints/team.rb +3 -3
- data/lib/slack/web/api/endpoints/team_externalTeams.rb +8 -8
- data/lib/slack/web/api/endpoints/usergroups.rb +18 -18
- data/lib/slack/web/api/endpoints/usergroups_users.rb +8 -8
- data/lib/slack/web/api/endpoints/users.rb +2 -2
- data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +0 -1
- data/lib/slack/web/api/endpoints/views.rb +9 -9
- data/lib/slack/web/api/endpoints/workflows_featured.rb +69 -0
- data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +15 -15
- data/lib/slack/web/api/endpoints.rb +10 -2
- data/lib/slack/web/api/errors.rb +88 -46
- data/lib/slack/web/api/helpers/files.rb +32 -22
- data/lib/slack/web/api/mixins/conversations.id.rb +14 -3
- data/lib/slack/web/api/mixins/users.id.rb +7 -3
- data/lib/slack/web/faraday/response/raise_error.rb +20 -2
- data/lib/slack-ruby-client.rb +0 -12
- data/lib/tasks/update.rake +0 -1
- data/lib/tasks/web.rake +0 -4
- data/slack-ruby-client.gemspec +1 -1
- metadata +19 -38
- data/.github/workflows/integration_test.yml +0 -45
- data/bin/commands/workflows.rb +0 -44
- data/examples/hi_real_time_and_web/Gemfile +0 -6
- data/examples/hi_real_time_and_web/hi.gif +0 -0
- data/examples/hi_real_time_and_web/hi.rb +0 -28
- data/examples/hi_real_time_async_async/Gemfile +0 -7
- data/examples/hi_real_time_async_async/Procfile +0 -2
- data/examples/hi_real_time_async_async/hi.rb +0 -41
- data/lib/slack/real_time/api/message.rb +0 -23
- data/lib/slack/real_time/api/message_id.rb +0 -15
- data/lib/slack/real_time/api/ping.rb +0 -19
- data/lib/slack/real_time/api/schema/event.json +0 -23
- data/lib/slack/real_time/api/templates/event_handler.erb +0 -8
- data/lib/slack/real_time/api/typing.rb +0 -20
- data/lib/slack/real_time/client.rb +0 -271
- data/lib/slack/real_time/concurrency/async.rb +0 -142
- data/lib/slack/real_time/concurrency.rb +0 -8
- data/lib/slack/real_time/config.rb +0 -62
- data/lib/slack/real_time/models/base.rb +0 -11
- data/lib/slack/real_time/models/bot.rb +0 -9
- data/lib/slack/real_time/models/channel.rb +0 -13
- data/lib/slack/real_time/models/im.rb +0 -9
- data/lib/slack/real_time/models/mpim.rb +0 -9
- data/lib/slack/real_time/models/team.rb +0 -9
- data/lib/slack/real_time/models/user.rb +0 -9
- data/lib/slack/real_time/models.rb +0 -9
- data/lib/slack/real_time/socket.rb +0 -118
- data/lib/slack/real_time/stores/base.rb +0 -47
- data/lib/slack/real_time/stores/starter.rb +0 -449
- data/lib/slack/real_time/stores/store.rb +0 -624
- data/lib/slack/real_time/stores.rb +0 -5
- data/lib/slack/web/api/endpoints/workflows.rb +0 -63
- data/lib/tasks/real_time.rake +0 -81
@@ -13,6 +13,8 @@ module Slack
|
|
13
13
|
# Name of the file being uploaded.
|
14
14
|
# @option params [string] :content
|
15
15
|
# File contents via a POST variable.
|
16
|
+
# @option params [Array<Hash>] :files
|
17
|
+
# Array of file objects with :filename, :content, and optionally :title, :alt_txt, :snippet_type.
|
16
18
|
# @option params [string] :alt_txt
|
17
19
|
# Description of image for screen-reader.
|
18
20
|
# @option params [string] :snippet_type
|
@@ -32,8 +34,16 @@ module Slack
|
|
32
34
|
# Never use a reply's ts value; use its parent instead.
|
33
35
|
# Also make sure to provide only one channel when using 'thread_ts'.
|
34
36
|
def files_upload_v2(params = {})
|
35
|
-
|
36
|
-
|
37
|
+
files_to_upload = if params[:files] && params[:files].is_a?(Array)
|
38
|
+
params[:files]
|
39
|
+
else
|
40
|
+
[params.slice(:filename, :content, :title, :alt_txt, :snippet_type)]
|
41
|
+
end
|
42
|
+
|
43
|
+
files_to_upload.each_with_index do |file, index|
|
44
|
+
%i[filename content].each do |param|
|
45
|
+
raise ArgumentError, "Required argument :#{param} missing in file (#{index})" if file[param].nil?
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
channel_params = %i[channel channels channel_id].map { |param| params[param] }.compact
|
@@ -53,31 +63,31 @@ module Slack
|
|
53
63
|
complete_upload_request_params[:channel_id] = params[:channel_id]
|
54
64
|
end
|
55
65
|
|
56
|
-
|
57
|
-
|
66
|
+
uploaded_files = files_to_upload.map do |file|
|
67
|
+
content = file[:content]
|
68
|
+
title = file[:title] || file[:filename]
|
58
69
|
|
59
|
-
|
60
|
-
|
70
|
+
upload_url_request_params = file.slice(:filename, :alt_txt, :snippet_type)
|
71
|
+
upload_url_request_params[:length] = content.bytesize
|
61
72
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
file_id = get_upload_url_response[:file_id]
|
73
|
+
get_upload_url_response = files_getUploadURLExternal(upload_url_request_params)
|
74
|
+
upload_url = get_upload_url_response[:upload_url]
|
75
|
+
file_id = get_upload_url_response[:file_id]
|
66
76
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
+
::Faraday::Connection.new(upload_url, options) do |connection|
|
78
|
+
connection.request :multipart
|
79
|
+
connection.request :url_encoded
|
80
|
+
connection.use ::Slack::Web::Faraday::Response::WrapError
|
81
|
+
connection.response :logger, logger if logger
|
82
|
+
connection.adapter adapter
|
83
|
+
end.post do |request|
|
84
|
+
request.body = content
|
85
|
+
end
|
77
86
|
|
78
|
-
|
79
|
-
|
87
|
+
{ id: file_id, title: title }
|
88
|
+
end
|
80
89
|
|
90
|
+
complete_upload_request_params[:files] = uploaded_files.to_json
|
81
91
|
files_completeUploadExternal(complete_upload_request_params)
|
82
92
|
end
|
83
93
|
end
|
@@ -12,12 +12,18 @@ module Slack
|
|
12
12
|
#
|
13
13
|
# @option options [channel] :channel
|
14
14
|
# Channel to get ID for, prefixed with #.
|
15
|
+
# @option options [string] :team_id
|
16
|
+
# The team id to search for channels in, required if token belongs to org-wide app.
|
17
|
+
# This field will be ignored if the API call is sent using a workspace-level token.
|
18
|
+
# @option options [boolean] :id_exclude_archived
|
19
|
+
# Set to true to exclude archived channels from the search
|
15
20
|
# @option options [integer] :id_limit
|
16
21
|
# The page size used for conversations_list calls required to find the channel's ID
|
22
|
+
# @option options [string] :id_types
|
23
|
+
# The types of conversations to use when searching for the ID. A comma-separated list
|
24
|
+
# containing one or more of public_channel, private_channel, mpim, im
|
17
25
|
def conversations_id(options = {})
|
18
26
|
name = options[:channel]
|
19
|
-
limit = options.fetch(:id_limit, Slack::Web.config.conversations_id_page_size)
|
20
|
-
|
21
27
|
raise ArgumentError, 'Required arguments :channel missing' if name.nil?
|
22
28
|
|
23
29
|
id_for(
|
@@ -26,7 +32,12 @@ module Slack
|
|
26
32
|
prefix: '#',
|
27
33
|
enum_method: :conversations_list,
|
28
34
|
list_method: :channels,
|
29
|
-
options: {
|
35
|
+
options: {
|
36
|
+
team_id: options.fetch(:team_id, nil),
|
37
|
+
exclude_archived: options.fetch(:id_exclude_archived, nil),
|
38
|
+
limit: options.fetch(:id_limit, Slack::Web.config.conversations_id_page_size),
|
39
|
+
types: options.fetch(:id_types, nil)
|
40
|
+
}.compact
|
30
41
|
)
|
31
42
|
end
|
32
43
|
end
|
@@ -12,12 +12,13 @@ module Slack
|
|
12
12
|
#
|
13
13
|
# @option options [user] :user
|
14
14
|
# User to get ID for, prefixed with '@'.
|
15
|
+
# @option options [string] :team_id
|
16
|
+
# The team id to search for users in, required if token belongs to org-wide app.
|
17
|
+
# This field will be ignored if the API call is sent using a workspace-level token.
|
15
18
|
# @option options [integer] :id_limit
|
16
19
|
# The page size used for users_list calls required to find the user's ID
|
17
20
|
def users_id(options = {})
|
18
21
|
name = options[:user]
|
19
|
-
limit = options.fetch(:id_limit, Slack::Web.config.users_id_page_size)
|
20
|
-
|
21
22
|
raise ArgumentError, 'Required arguments :user missing' if name.nil?
|
22
23
|
|
23
24
|
id_for(
|
@@ -26,7 +27,10 @@ module Slack
|
|
26
27
|
prefix: '@',
|
27
28
|
enum_method: :users_list,
|
28
29
|
list_method: :members,
|
29
|
-
options: {
|
30
|
+
options: {
|
31
|
+
team_id: options.fetch(:team_id, nil),
|
32
|
+
limit: options.fetch(:id_limit, Slack::Web.config.users_id_page_size)
|
33
|
+
}.compact
|
30
34
|
)
|
31
35
|
end
|
32
36
|
end
|
@@ -5,7 +5,7 @@ module Slack
|
|
5
5
|
module Response
|
6
6
|
class RaiseError < ::Faraday::Middleware
|
7
7
|
def on_complete(env)
|
8
|
-
raise Slack::Web::Api::Errors::TooManyRequestsError, env.response if env.status == 429
|
8
|
+
raise Slack::Web::Api::Errors::TooManyRequestsError, redact_response(env.response) if env.status == 429
|
9
9
|
|
10
10
|
return unless env.success?
|
11
11
|
|
@@ -16,7 +16,25 @@ module Slack
|
|
16
16
|
error_message = body['error'] || body['errors'].map { |message| message['error'] }.join(',')
|
17
17
|
error_class = Slack::Web::Api::Errors::ERROR_CLASSES[error_message]
|
18
18
|
error_class ||= Slack::Web::Api::Errors::SlackError
|
19
|
-
raise error_class.new(error_message, env.response)
|
19
|
+
raise error_class.new(error_message, redact_response(env.response))
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def redact_response(response)
|
25
|
+
return response unless response&.env
|
26
|
+
|
27
|
+
redacted_env = response.env.dup
|
28
|
+
|
29
|
+
# redact Authorization header if it exists
|
30
|
+
if redacted_env[:request_headers]&.key?('Authorization')
|
31
|
+
redacted_env[:request_headers] = redacted_env[:request_headers].dup
|
32
|
+
redacted_env[:request_headers]['Authorization'] = '[REDACTED]'
|
33
|
+
end
|
34
|
+
|
35
|
+
redacted_response = ::Faraday::Response.new(redacted_env)
|
36
|
+
redacted_response.env[:response] = redacted_response
|
37
|
+
redacted_response
|
20
38
|
end
|
21
39
|
end
|
22
40
|
end
|
data/lib/slack-ruby-client.rb
CHANGED
@@ -42,18 +42,6 @@ require_relative 'slack/web/api/helpers'
|
|
42
42
|
require_relative 'slack/web/pagination/cursor'
|
43
43
|
require_relative 'slack/web/client'
|
44
44
|
|
45
|
-
# RealTime API
|
46
|
-
require_relative 'slack/real_time/concurrency'
|
47
|
-
require_relative 'slack/real_time/socket'
|
48
|
-
require_relative 'slack/real_time/api/message_id'
|
49
|
-
require_relative 'slack/real_time/api/ping'
|
50
|
-
require_relative 'slack/real_time/api/message'
|
51
|
-
require_relative 'slack/real_time/api/typing'
|
52
|
-
require_relative 'slack/real_time/models'
|
53
|
-
require_relative 'slack/real_time/stores'
|
54
|
-
require_relative 'slack/real_time/config'
|
55
|
-
require_relative 'slack/real_time/client'
|
56
|
-
|
57
45
|
# Events API
|
58
46
|
require_relative 'slack/events/config'
|
59
47
|
require_relative 'slack/events/request'
|
data/lib/tasks/update.rake
CHANGED
data/lib/tasks/web.rake
CHANGED
@@ -33,10 +33,6 @@ namespace :slack do
|
|
33
33
|
parsed = JSON.parse(File.read(path))
|
34
34
|
parsed['undocumented'] = true if path =~ /undocumented/
|
35
35
|
JSON::Validator.validate(method_schema, parsed, insert_defaults: true)
|
36
|
-
if parsed['deprecated'] && parsed['deprecation']['deprecation_warning'] =~ /It will stop functioning in February 2021/
|
37
|
-
next
|
38
|
-
end
|
39
|
-
|
40
36
|
result[prefix][name] = parsed
|
41
37
|
end
|
42
38
|
|
data/slack-ruby-client.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.homepage = 'http://github.com/slack-ruby/slack-ruby-client'
|
18
18
|
s.licenses = ['MIT']
|
19
19
|
s.summary = 'Slack Web and RealTime API client.'
|
20
|
-
s.add_dependency 'faraday', '>= 2.0'
|
20
|
+
s.add_dependency 'faraday', '>= 2.0.1'
|
21
21
|
s.add_dependency 'faraday-mashify'
|
22
22
|
s.add_dependency 'faraday-multipart'
|
23
23
|
s.add_dependency 'gli'
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
|
+
autorequire:
|
8
9
|
bindir: bin
|
9
10
|
cert_chain: []
|
10
|
-
date: 2025-
|
11
|
+
date: 2025-09-22 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: faraday
|
@@ -15,14 +16,14 @@ dependencies:
|
|
15
16
|
requirements:
|
16
17
|
- - ">="
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
19
|
+
version: 2.0.1
|
19
20
|
type: :runtime
|
20
21
|
prerelease: false
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
22
23
|
requirements:
|
23
24
|
- - ">="
|
24
25
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
26
|
+
version: 2.0.1
|
26
27
|
- !ruby/object:Gem::Dependency
|
27
28
|
name: faraday-mashify
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +94,7 @@ dependencies:
|
|
93
94
|
- - ">="
|
94
95
|
- !ruby/object:Gem::Version
|
95
96
|
version: '0'
|
97
|
+
description:
|
96
98
|
email: dblock@dblock.org
|
97
99
|
executables:
|
98
100
|
- slack
|
@@ -102,7 +104,6 @@ files:
|
|
102
104
|
- ".coveralls.yml"
|
103
105
|
- ".github/FUNDING.yml"
|
104
106
|
- ".github/dependabot.yml"
|
105
|
-
- ".github/workflows/integration_test.yml"
|
106
107
|
- ".github/workflows/lint.yml"
|
107
108
|
- ".github/workflows/pr_lint.yml"
|
108
109
|
- ".github/workflows/test.yml"
|
@@ -200,6 +201,10 @@ files:
|
|
200
201
|
- bin/commands/reminders.rb
|
201
202
|
- bin/commands/rtm.rb
|
202
203
|
- bin/commands/search.rb
|
204
|
+
- bin/commands/slackLists.rb
|
205
|
+
- bin/commands/slackLists_access.rb
|
206
|
+
- bin/commands/slackLists_download.rb
|
207
|
+
- bin/commands/slackLists_items.rb
|
203
208
|
- bin/commands/stars.rb
|
204
209
|
- bin/commands/team.rb
|
205
210
|
- bin/commands/team_billing.rb
|
@@ -215,19 +220,13 @@ files:
|
|
215
220
|
- bin/commands/users_prefs.rb
|
216
221
|
- bin/commands/users_profile.rb
|
217
222
|
- bin/commands/views.rb
|
218
|
-
- bin/commands/
|
223
|
+
- bin/commands/workflows_featured.rb
|
219
224
|
- bin/commands/workflows_triggers_permissions.rb
|
220
225
|
- bin/slack
|
221
226
|
- examples/files_upload_v2/.env.example
|
222
227
|
- examples/files_upload_v2/Gemfile
|
223
228
|
- examples/files_upload_v2/README.md
|
224
229
|
- examples/files_upload_v2/files_upload_v2.rb
|
225
|
-
- examples/hi_real_time_and_web/Gemfile
|
226
|
-
- examples/hi_real_time_and_web/hi.gif
|
227
|
-
- examples/hi_real_time_and_web/hi.rb
|
228
|
-
- examples/hi_real_time_async_async/Gemfile
|
229
|
-
- examples/hi_real_time_async_async/Procfile
|
230
|
-
- examples/hi_real_time_async_async/hi.rb
|
231
230
|
- examples/hi_web/Gemfile
|
232
231
|
- examples/hi_web/hi.gif
|
233
232
|
- examples/hi_web/hi.rb
|
@@ -245,29 +244,6 @@ files:
|
|
245
244
|
- lib/slack/logger.rb
|
246
245
|
- lib/slack/messages/formatting.rb
|
247
246
|
- lib/slack/messages/message.rb
|
248
|
-
- lib/slack/real_time/api/message.rb
|
249
|
-
- lib/slack/real_time/api/message_id.rb
|
250
|
-
- lib/slack/real_time/api/ping.rb
|
251
|
-
- lib/slack/real_time/api/schema/event.json
|
252
|
-
- lib/slack/real_time/api/templates/event_handler.erb
|
253
|
-
- lib/slack/real_time/api/typing.rb
|
254
|
-
- lib/slack/real_time/client.rb
|
255
|
-
- lib/slack/real_time/concurrency.rb
|
256
|
-
- lib/slack/real_time/concurrency/async.rb
|
257
|
-
- lib/slack/real_time/config.rb
|
258
|
-
- lib/slack/real_time/models.rb
|
259
|
-
- lib/slack/real_time/models/base.rb
|
260
|
-
- lib/slack/real_time/models/bot.rb
|
261
|
-
- lib/slack/real_time/models/channel.rb
|
262
|
-
- lib/slack/real_time/models/im.rb
|
263
|
-
- lib/slack/real_time/models/mpim.rb
|
264
|
-
- lib/slack/real_time/models/team.rb
|
265
|
-
- lib/slack/real_time/models/user.rb
|
266
|
-
- lib/slack/real_time/socket.rb
|
267
|
-
- lib/slack/real_time/stores.rb
|
268
|
-
- lib/slack/real_time/stores/base.rb
|
269
|
-
- lib/slack/real_time/stores/starter.rb
|
270
|
-
- lib/slack/real_time/stores/store.rb
|
271
247
|
- lib/slack/utils/security.rb
|
272
248
|
- lib/slack/version.rb
|
273
249
|
- lib/slack/web/api/endpoints.rb
|
@@ -347,6 +323,10 @@ files:
|
|
347
323
|
- lib/slack/web/api/endpoints/reminders.rb
|
348
324
|
- lib/slack/web/api/endpoints/rtm.rb
|
349
325
|
- lib/slack/web/api/endpoints/search.rb
|
326
|
+
- lib/slack/web/api/endpoints/slackLists.rb
|
327
|
+
- lib/slack/web/api/endpoints/slackLists_access.rb
|
328
|
+
- lib/slack/web/api/endpoints/slackLists_download.rb
|
329
|
+
- lib/slack/web/api/endpoints/slackLists_items.rb
|
350
330
|
- lib/slack/web/api/endpoints/stars.rb
|
351
331
|
- lib/slack/web/api/endpoints/team.rb
|
352
332
|
- lib/slack/web/api/endpoints/team_billing.rb
|
@@ -362,7 +342,7 @@ files:
|
|
362
342
|
- lib/slack/web/api/endpoints/users_prefs.rb
|
363
343
|
- lib/slack/web/api/endpoints/users_profile.rb
|
364
344
|
- lib/slack/web/api/endpoints/views.rb
|
365
|
-
- lib/slack/web/api/endpoints/
|
345
|
+
- lib/slack/web/api/endpoints/workflows_featured.rb
|
366
346
|
- lib/slack/web/api/endpoints/workflows_triggers_permissions.rb
|
367
347
|
- lib/slack/web/api/error.rb
|
368
348
|
- lib/slack/web/api/errors.rb
|
@@ -397,7 +377,6 @@ files:
|
|
397
377
|
- lib/slack/web/pagination/cursor.rb
|
398
378
|
- lib/slack_ruby_client.rb
|
399
379
|
- lib/tasks/git.rake
|
400
|
-
- lib/tasks/real_time.rake
|
401
380
|
- lib/tasks/update.rake
|
402
381
|
- lib/tasks/web.rake
|
403
382
|
- slack-ruby-client.gemspec
|
@@ -408,6 +387,7 @@ licenses:
|
|
408
387
|
metadata:
|
409
388
|
rubygems_mfa_required: 'true'
|
410
389
|
changelog_uri: https://github.com/slack-ruby/slack-ruby-client/blob/master/CHANGELOG.md
|
390
|
+
post_install_message:
|
411
391
|
rdoc_options: []
|
412
392
|
require_paths:
|
413
393
|
- lib
|
@@ -422,7 +402,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
422
402
|
- !ruby/object:Gem::Version
|
423
403
|
version: 1.3.6
|
424
404
|
requirements: []
|
425
|
-
rubygems_version: 3.
|
405
|
+
rubygems_version: 3.5.16
|
406
|
+
signing_key:
|
426
407
|
specification_version: 4
|
427
408
|
summary: Slack Web and RealTime API client.
|
428
409
|
test_files: []
|
@@ -1,45 +0,0 @@
|
|
1
|
-
name: Integration Tests
|
2
|
-
on: push
|
3
|
-
jobs:
|
4
|
-
check-slack-api-token:
|
5
|
-
runs-on: ubuntu-latest
|
6
|
-
outputs:
|
7
|
-
SLACK_API_TOKEN_EXISTS: ${{ steps.check-slack-api-token.outputs.SLACK_API_TOKEN_EXISTS }}
|
8
|
-
steps:
|
9
|
-
- name: Check for SLACK_API_TOKEN availability
|
10
|
-
id: check-slack-api-token
|
11
|
-
shell: bash
|
12
|
-
run: |
|
13
|
-
if [ "${{ secrets.SLACK_API_TOKEN }}" != '' ]; then
|
14
|
-
echo "SLACK_API_TOKEN_EXISTS=true" >> $GITHUB_OUTPUT;
|
15
|
-
else
|
16
|
-
echo "SLACK_API_TOKEN_EXISTS=false" >> $GITHUB_OUTPUT;
|
17
|
-
fi
|
18
|
-
|
19
|
-
test:
|
20
|
-
runs-on: ubuntu-latest
|
21
|
-
needs: [check-slack-api-token]
|
22
|
-
if: needs.check-slack-api-token.outputs.SLACK_API_TOKEN_EXISTS == 'true'
|
23
|
-
strategy:
|
24
|
-
matrix:
|
25
|
-
entry:
|
26
|
-
- { ruby: 2.7, concurrency: async-websocket }
|
27
|
-
name: test (ruby=${{ matrix.entry.ruby }}, concurrency=${{ matrix.entry.concurrency || 'none' }})
|
28
|
-
steps:
|
29
|
-
- name: Checkout
|
30
|
-
uses: actions/checkout@v4
|
31
|
-
- name: Set up Ruby
|
32
|
-
uses: ruby/setup-ruby@v1
|
33
|
-
with:
|
34
|
-
ruby-version: ${{ matrix.entry.ruby }}
|
35
|
-
bundler-cache: true
|
36
|
-
- name: Run Tests
|
37
|
-
env:
|
38
|
-
CONCURRENCY: ${{ matrix.entry.concurrency }}
|
39
|
-
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
|
40
|
-
RACK_ENV: test
|
41
|
-
SPEC: "--pattern spec/**/integration/*_spec.rb"
|
42
|
-
SPEC_OPTS: "--pattern spec/**/integration/*_spec.rb"
|
43
|
-
run: |
|
44
|
-
bundle install
|
45
|
-
bundle exec rake
|
data/bin/commands/workflows.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
module Slack
|
5
|
-
module Cli
|
6
|
-
class App
|
7
|
-
desc 'Workflows methods.'
|
8
|
-
command 'workflows' do |g|
|
9
|
-
g.desc "Indicate that an app's step in a workflow completed execution."
|
10
|
-
g.long_desc %( Indicate that an app's step in a workflow completed execution. )
|
11
|
-
g.command 'stepCompleted' do |c|
|
12
|
-
c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
|
13
|
-
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.'
|
14
|
-
c.action do |_global_options, options, _args|
|
15
|
-
puts JSON.dump(@client.workflows_stepCompleted(options))
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
g.desc "Indicate that an app's step in a workflow failed to execute."
|
20
|
-
g.long_desc %( Indicate that an app's step in a workflow failed to execute. )
|
21
|
-
g.command 'stepFailed' do |c|
|
22
|
-
c.flag 'error', desc: 'A JSON-based object with a message property that should contain a human readable error message.'
|
23
|
-
c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
|
24
|
-
c.action do |_global_options, options, _args|
|
25
|
-
puts JSON.dump(@client.workflows_stepFailed(options))
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
g.desc 'Update the configuration for a workflow step.'
|
30
|
-
g.long_desc %( Update the configuration for a workflow step. )
|
31
|
-
g.command 'updateStep' do |c|
|
32
|
-
c.flag 'workflow_step_edit_id', desc: 'A context identifier provided with view_submission payloads used to call back to workflows.updateStep.'
|
33
|
-
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.'
|
34
|
-
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.'
|
35
|
-
c.flag 'step_image_url', desc: 'An optional field that can be used to override app image that is shown in the Workflow Builder.'
|
36
|
-
c.flag 'step_name', desc: 'An optional field that can be used to override the step name that is shown in the Workflow Builder.'
|
37
|
-
c.action do |_global_options, options, _args|
|
38
|
-
puts JSON.dump(@client.workflows_updateStep(options))
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
Binary file
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'slack-ruby-client'
|
3
|
-
|
4
|
-
Slack.configure do |config|
|
5
|
-
config.token = ENV['SLACK_API_TOKEN']
|
6
|
-
raise 'Missing ENV[SLACK_API_TOKEN]!' unless config.token
|
7
|
-
end
|
8
|
-
|
9
|
-
client = Slack::RealTime::Client.new
|
10
|
-
|
11
|
-
client.on :hello do
|
12
|
-
puts(
|
13
|
-
"Successfully connected, welcome '#{client.self.name}' " \
|
14
|
-
"to the '#{client.team.name}' team at https://#{client.team.domain}.slack.com."
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
client.on :message do |data|
|
19
|
-
puts data
|
20
|
-
case data.text
|
21
|
-
when 'bot hi'
|
22
|
-
client.web_client.chat_postMessage channel: data.channel, text: "Hi <@#{data.user}>!"
|
23
|
-
when /^bot/
|
24
|
-
client.web_client.chat_postMessage channel: data.channel, text: "Sorry <@#{data.user}>, what?"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
client.start!
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'slack-ruby-client'
|
3
|
-
require 'async'
|
4
|
-
|
5
|
-
raise 'Missing ENV[SLACK_API_TOKENS]!' unless ENV.key?('SLACK_API_TOKENS')
|
6
|
-
|
7
|
-
$stdout.sync = true
|
8
|
-
logger = Logger.new($stdout)
|
9
|
-
logger.level = Logger::DEBUG
|
10
|
-
|
11
|
-
threads = []
|
12
|
-
|
13
|
-
ENV['SLACK_API_TOKENS'].split.each do |token|
|
14
|
-
logger.info "Starting #{token[0..12]} ..."
|
15
|
-
|
16
|
-
client = Slack::RealTime::Client.new(token: token)
|
17
|
-
|
18
|
-
client.on :hello do
|
19
|
-
logger.info(
|
20
|
-
"Successfully connected, welcome '#{client.self.name}' to " \
|
21
|
-
"the '#{client.team.name}' team at https://#{client.team.domain}.slack.com."
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
client.on :message do |data|
|
26
|
-
logger.info data
|
27
|
-
|
28
|
-
client.typing channel: data.channel
|
29
|
-
|
30
|
-
case data.text
|
31
|
-
when /hi/
|
32
|
-
client.message channel: data.channel, text: "Hi <@#{data.user}>!"
|
33
|
-
else
|
34
|
-
client.message channel: data.channel, text: "Sorry <@#{data.user}>, what?"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
threads << client.start_async
|
39
|
-
end
|
40
|
-
|
41
|
-
threads.each(&:join)
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Slack
|
3
|
-
module RealTime
|
4
|
-
module Api
|
5
|
-
module Message
|
6
|
-
#
|
7
|
-
# Sends a message to a channel.
|
8
|
-
#
|
9
|
-
# @option options [channel] :channel
|
10
|
-
# Channel to send message to. Can be a public channel, private group or IM channel.
|
11
|
-
# Can be an encoded ID, or a name.
|
12
|
-
# @option options [Object] :text
|
13
|
-
# Text of the message to send. See below for an explanation of formatting.
|
14
|
-
def message(options = {})
|
15
|
-
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
16
|
-
raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
|
17
|
-
|
18
|
-
send_json({ type: 'message', id: next_id }.merge(options))
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module Slack
|
3
|
-
module RealTime
|
4
|
-
module Api
|
5
|
-
module Ping
|
6
|
-
#
|
7
|
-
# Clients should try to quickly detect disconnections, even in idle periods, so that users
|
8
|
-
# can easily tell the
|
9
|
-
# difference between being disconnected and everyone being quiet. Not all web browsers
|
10
|
-
# support the WebSocket
|
11
|
-
# ping spec, so the RTM protocol also supports ping/pong messages.
|
12
|
-
#
|
13
|
-
def ping(options = {})
|
14
|
-
send_json({ type: 'ping', id: next_id }.merge(options))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "object",
|
3
|
-
"required": [
|
4
|
-
"name",
|
5
|
-
"desc"
|
6
|
-
],
|
7
|
-
"properties": {
|
8
|
-
"name": {
|
9
|
-
"type": "string"
|
10
|
-
},
|
11
|
-
"desc": {
|
12
|
-
"type": "string"
|
13
|
-
},
|
14
|
-
"long_desc": {
|
15
|
-
"type": "string"
|
16
|
-
},
|
17
|
-
"example": {
|
18
|
-
"type": "object",
|
19
|
-
"default": {}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|