slack-ruby-client 2.2.0 → 2.3.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/dependabot.yml +6 -0
- data/.github/workflows/integration_test.yml +1 -1
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/pr_lint.yml +1 -1
- data/.github/workflows/test.yml +1 -1
- data/.github/workflows/update_api.yml +8 -3
- data/CHANGELOG.md +7 -0
- data/README.md +2 -2
- data/bin/commands/admin_apps_activities.rb +4 -4
- data/bin/commands/admin_apps_config.rb +2 -2
- data/bin/commands/admin_conversations.rb +2 -1
- data/bin/commands/admin_users.rb +2 -0
- data/bin/commands/chat.rb +9 -9
- data/bin/commands/conversations.rb +2 -1
- data/bin/commands/functions.rb +31 -0
- data/bin/commands/pins.rb +0 -1
- data/bin/commands/team.rb +2 -2
- data/bin/commands/usergroups.rb +10 -10
- data/bin/commands/usergroups_users.rb +8 -8
- data/lib/slack/events/request.rb +4 -2
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_apps_activities.rb +5 -5
- data/lib/slack/web/api/endpoints/admin_apps_config.rb +3 -3
- data/lib/slack/web/api/endpoints/admin_conversations.rb +3 -1
- data/lib/slack/web/api/endpoints/admin_functions_permissions.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_users.rb +4 -0
- data/lib/slack/web/api/endpoints/admin_workflows.rb +3 -3
- data/lib/slack/web/api/endpoints/apps_activities.rb +1 -1
- data/lib/slack/web/api/endpoints/chat.rb +21 -21
- data/lib/slack/web/api/endpoints/conversations.rb +3 -1
- data/lib/slack/web/api/endpoints/functions.rb +43 -0
- data/lib/slack/web/api/endpoints/openid_connect.rb +1 -1
- data/lib/slack/web/api/endpoints/pins.rb +0 -2
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +3 -3
- data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +6 -6
- data/lib/slack/web/api/endpoints/users.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/errors.rb +14 -0
- data/lib/slack/web/api/patches/.gitkeep +0 -0
- data/spec/slack/events/request_spec.rb +11 -0
- data/spec/slack/web/api/endpoints/chat_spec.rb +76 -4
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +2 -9
- data/spec/slack/web/api/endpoints/functions_spec.rb +28 -0
- metadata +7 -3
- data/lib/slack/web/api/patches/chat.attachments-blocks.patch +0 -21
|
@@ -33,7 +33,7 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
|
|
|
33
33
|
|
|
34
34
|
context 'text and user arguments' do
|
|
35
35
|
it 'requires text or attachments' do
|
|
36
|
-
expect { client.chat_postEphemeral(channel: 'channel') }.to(
|
|
36
|
+
expect { client.chat_postEphemeral(channel: 'channel', user: '123') }.to(
|
|
37
37
|
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
|
|
38
38
|
)
|
|
39
39
|
end
|
|
@@ -167,7 +167,7 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
|
|
|
167
167
|
context 'text, attachment and blocks arguments' do
|
|
168
168
|
it 'requires text, attachments, blocks or reply_broadcast' do
|
|
169
169
|
expect { client.chat_update(channel: 'channel', ts: ts) }.to(
|
|
170
|
-
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text
|
|
170
|
+
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
|
|
171
171
|
)
|
|
172
172
|
end
|
|
173
173
|
|
|
@@ -192,13 +192,6 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
|
|
|
192
192
|
end.not_to raise_error
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
-
it 'only reply_broadcast' do
|
|
196
|
-
expect(client).to receive(:post).with('chat.update', hash_including(reply_broadcast: true))
|
|
197
|
-
expect do
|
|
198
|
-
client.chat_update(channel: 'channel', ts: ts, reply_broadcast: true)
|
|
199
|
-
end.not_to raise_error
|
|
200
|
-
end
|
|
201
|
-
|
|
202
195
|
it 'all text, attachments and blocks' do
|
|
203
196
|
expect(client).to(
|
|
204
197
|
receive(:post)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
|
3
|
+
|
|
4
|
+
require 'spec_helper'
|
|
5
|
+
|
|
6
|
+
RSpec.describe Slack::Web::Api::Endpoints::Functions do
|
|
7
|
+
let(:client) { Slack::Web::Client.new }
|
|
8
|
+
context 'functions_completeError' do
|
|
9
|
+
it 'requires error' do
|
|
10
|
+
expect { client.functions_completeError(function_execution_id: %q[Fx12345ABCDE]) }.to raise_error ArgumentError, /Required arguments :error missing/
|
|
11
|
+
end
|
|
12
|
+
it 'requires function_execution_id' do
|
|
13
|
+
expect { client.functions_completeError(error: %q[]) }.to raise_error ArgumentError, /Required arguments :function_execution_id missing/
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
context 'functions_completeSuccess' do
|
|
17
|
+
it 'requires function_execution_id' do
|
|
18
|
+
expect { client.functions_completeSuccess(outputs: %q[{"customer_id": "U0BPQUNTA"}]) }.to raise_error ArgumentError, /Required arguments :function_execution_id missing/
|
|
19
|
+
end
|
|
20
|
+
it 'requires outputs' do
|
|
21
|
+
expect { client.functions_completeSuccess(function_execution_id: %q[Fx12345ABCDE]) }.to raise_error ArgumentError, /Required arguments :outputs missing/
|
|
22
|
+
end
|
|
23
|
+
it 'encodes outputs as json' do
|
|
24
|
+
expect(client).to receive(:post).with('functions.completeSuccess', {function_execution_id: %q[Fx12345ABCDE], outputs: %q[{"data":["data"]}]})
|
|
25
|
+
client.functions_completeSuccess(function_execution_id: %q[Fx12345ABCDE], outputs: {:data=>["data"]})
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slack-ruby-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Doubrovkine
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
|
89
89
|
files:
|
|
90
90
|
- ".coveralls.yml"
|
|
91
91
|
- ".github/FUNDING.yml"
|
|
92
|
+
- ".github/dependabot.yml"
|
|
92
93
|
- ".github/workflows/integration_test.yml"
|
|
93
94
|
- ".github/workflows/lint.yml"
|
|
94
95
|
- ".github/workflows/pr_lint.yml"
|
|
@@ -165,6 +166,7 @@ files:
|
|
|
165
166
|
- bin/commands/files.rb
|
|
166
167
|
- bin/commands/files_comments.rb
|
|
167
168
|
- bin/commands/files_remote.rb
|
|
169
|
+
- bin/commands/functions.rb
|
|
168
170
|
- bin/commands/functions_workflows_steps.rb
|
|
169
171
|
- bin/commands/functions_workflows_steps_responses.rb
|
|
170
172
|
- bin/commands/migration.rb
|
|
@@ -289,6 +291,7 @@ files:
|
|
|
289
291
|
- lib/slack/web/api/endpoints/files.rb
|
|
290
292
|
- lib/slack/web/api/endpoints/files_comments.rb
|
|
291
293
|
- lib/slack/web/api/endpoints/files_remote.rb
|
|
294
|
+
- lib/slack/web/api/endpoints/functions.rb
|
|
292
295
|
- lib/slack/web/api/endpoints/functions_workflows_steps.rb
|
|
293
296
|
- lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb
|
|
294
297
|
- lib/slack/web/api/endpoints/migration.rb
|
|
@@ -327,7 +330,7 @@ files:
|
|
|
327
330
|
- lib/slack/web/api/mixins/users.search.json
|
|
328
331
|
- lib/slack/web/api/mixins/users.search.rb
|
|
329
332
|
- lib/slack/web/api/options.rb
|
|
330
|
-
- lib/slack/web/api/patches
|
|
333
|
+
- lib/slack/web/api/patches/.gitkeep
|
|
331
334
|
- lib/slack/web/api/schema/group.json
|
|
332
335
|
- lib/slack/web/api/schema/method.json
|
|
333
336
|
- lib/slack/web/api/templates/command.erb
|
|
@@ -446,6 +449,7 @@ files:
|
|
|
446
449
|
- spec/slack/web/api/endpoints/files_comments_spec.rb
|
|
447
450
|
- spec/slack/web/api/endpoints/files_remote_spec.rb
|
|
448
451
|
- spec/slack/web/api/endpoints/files_spec.rb
|
|
452
|
+
- spec/slack/web/api/endpoints/functions_spec.rb
|
|
449
453
|
- spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb
|
|
450
454
|
- spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb
|
|
451
455
|
- spec/slack/web/api/endpoints/migration_spec.rb
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
|
|
2
|
-
index b49065a..bf202f1 100644
|
|
3
|
-
--- a/lib/slack/web/api/endpoints/chat.rb
|
|
4
|
-
+++ b/lib/slack/web/api/endpoints/chat.rb
|
|
5
|
-
@@ -122,7 +122,7 @@ module Slack
|
|
6
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
|
7
|
-
def chat_postEphemeral(options = {})
|
|
8
|
-
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
|
9
|
-
- raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
|
|
10
|
-
+ raise ArgumentError, 'At least one of :attachments, :blocks, :text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil?
|
|
11
|
-
raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
|
|
12
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
|
13
|
-
options = encode_options_as_json(options, %i[attachments blocks])
|
|
14
|
-
@@ -274,6 +274,7 @@ module Slack
|
|
15
|
-
def chat_update(options = {})
|
|
16
|
-
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
|
17
|
-
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
|
18
|
-
+ raise ArgumentError, 'At least one of :attachments, :blocks, :text, :reply_broadcast is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:reply_broadcast].nil?
|
|
19
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
|
20
|
-
options = encode_options_as_json(options, %i[attachments blocks metadata])
|
|
21
|
-
post('chat.update', options)
|