From f24270065fec02f4a47ef369d0a6de3b57bd3543 Mon Sep 17 00:00:00 2001 From: slack-ruby-ci-bot Date: Mon, 13 Jul 2026 23:33:12 +0000 Subject: [PATCH] Update API from slack-api-ref@784d1d4 (2026-07-13) --- CHANGELOG.md | 1 + bin/commands/entity.rb | 27 ++++++++ bin/commands/files.rb | 3 + lib/slack/web/api/endpoints/chat.rb | 8 +-- lib/slack/web/api/endpoints/entity.rb | 48 +++++++++++++++ lib/slack/web/api/endpoints/files.rb | 6 ++ lib/slack/web/api/errors.rb | 8 +++ lib/slack/web/api/slack-api-ref | 2 +- spec/slack/web/api/endpoints/chat_spec.rb | 68 +++++++++++++-------- spec/slack/web/api/endpoints/entity_spec.rb | 13 ++++ 10 files changed, 155 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a60b654..ed831c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 3.2.1 (Next) +* [#590](https://github.com/slack-ruby/slack-ruby-client/pull/590): Update API from [slack-api-ref@784d1d4](https://github.com/slack-ruby/slack-api-ref/commit/784d1d4) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. ### 3.2.0 (2026/07/05) diff --git a/bin/commands/entity.rb b/bin/commands/entity.rb index 057fa48f..12db731c 100644 --- a/bin/commands/entity.rb +++ b/bin/commands/entity.rb @@ -6,6 +6,33 @@ module Cli class App desc 'Entity methods.' command 'entity' do |g| + g.desc 'Acknowledge a comment mutation (edit, delete, or post) on a work object entity. Apps call this endpoint to confirm they have processed a comment action, and the backend emits a dedicated RTM event to the user.' + g.long_desc %( Acknowledge a comment mutation (edit, delete, or post) on a work object entity. Apps call this endpoint to confirm they have processed a comment action, and the backend emits a dedicated RTM event to the user. ) + g.command 'acknowledgeCommentAction' do |c| + c.flag 'trigger_id', desc: 'A reference to the original user action that initiated the comment mutation.' + c.flag 'comment', desc: 'The full comment data. Required for edit and post actions. See the comment schema for the full list of properties.' + c.flag 'error', desc: 'Error message if the action failed in the app. When present, signals that the mutation could not be completed.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.entity_acknowledgeCommentAction(options)) + end + end + + g.desc 'Provide comments for work objects. Apps call this endpoint to send per-user flexpane comment data to the client.' + g.long_desc %( Provide comments for work objects. Apps call this endpoint to send per-user flexpane comment data to the client. ) + g.command 'presentComments' do |c| + c.flag 'comments', desc: 'Array of comments to present to the user. See the comment schema for the full list of properties.' + c.flag 'cursor', desc: 'App supplied cursor used for pagination, will be sent in the next request for comments.' + c.flag 'can_post_comment', desc: 'Indicates whether the user has permissions to post comments.' + c.flag 'trigger_id', desc: 'A reference to the original user action that initiated the request.' + c.flag 'delete_action_id', desc: 'The block action id that will be sent when a delete request is initiated for a comment.' + c.flag 'user_auth_required', desc: 'Set to true (or 1) to indicate that the user must authenticate to see the comments data.' + c.flag 'user_auth_url', desc: 'A custom URL to which users are directed for authentication if required.' + c.flag 'error', desc: '' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.entity_presentComments(options)) + end + end + g.desc 'Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client.' g.long_desc %( Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client. ) g.command 'presentDetails' do |c| diff --git a/bin/commands/files.rb b/bin/commands/files.rb index 15d99716..2c53f83c 100644 --- a/bin/commands/files.rb +++ b/bin/commands/files.rb @@ -15,6 +15,9 @@ class App c.flag 'channels', desc: 'Comma-separated string of channel IDs or user IDs where the file will be shared.' c.flag 'initial_comment', desc: 'The message text introducing the file in specified channels.' c.flag 'blocks', desc: 'A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the initial_comment field is provided, the blocks field is ignored.' + c.flag 'username', desc: "Set your bot's user name for the file share message. Requires the chat:write.customize scope." + c.flag 'icon_url', desc: 'URL to an image to use as the icon for the file share message. Requires the chat:write.customize scope.' + c.flag 'icon_emoji', desc: 'Emoji to use as the icon for the file share message. Overrides icon_url. Requires the chat:write.customize scope.' c.action do |_global_options, options, _args| puts JSON.dump(@client.files_completeUploadExternal(options)) end diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 01149859..541dcd91 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -147,7 +147,7 @@ def chat_postEphemeral(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? raise ArgumentError, 'Required arguments :user missing' if options[:user].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:markdown_text].nil? - raise ArgumentError, ':text, :markdown_text are mutually exclusive' if !options[:text].nil? && !options[:markdown_text].nil? + raise ArgumentError, 'Exactly one of :text, :markdown_text is required' unless options[:text].nil? ^ options[:markdown_text].nil? options = options.merge(user: users_id(options)['user']['id']) if options[:user] options = encode_options_as_json(options, %i[attachments blocks]) post('chat.postEphemeral', options) @@ -197,7 +197,7 @@ def chat_postEphemeral(options = {}) def chat_postMessage(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:markdown_text].nil? - raise ArgumentError, ':text, :markdown_text are mutually exclusive' if !options[:text].nil? && !options[:markdown_text].nil? + raise ArgumentError, 'Exactly one of :text, :markdown_text is required' unless options[:text].nil? ^ options[:markdown_text].nil? options = encode_options_as_json(options, %i[attachments blocks metadata]) post('chat.postMessage', options) end @@ -239,7 +239,7 @@ def chat_scheduleMessage(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? raise ArgumentError, 'Required arguments :post_at missing' if options[:post_at].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:markdown_text].nil? - raise ArgumentError, ':text, :markdown_text are mutually exclusive' if !options[:text].nil? && !options[:markdown_text].nil? + raise ArgumentError, 'Exactly one of :text, :markdown_text is required' unless options[:text].nil? ^ options[:markdown_text].nil? options = encode_options_as_json(options, %i[attachments blocks metadata]) post('chat.scheduleMessage', options) end @@ -365,7 +365,7 @@ def chat_update(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:markdown_text].nil? - raise ArgumentError, ':text, :markdown_text are mutually exclusive' if !options[:text].nil? && !options[:markdown_text].nil? + raise ArgumentError, 'Exactly one of :text, :markdown_text is required' unless options[:text].nil? ^ options[:markdown_text].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] options = encode_options_as_json(options, %i[attachments unfurled_attachments blocks metadata]) post('chat.update', options) diff --git a/lib/slack/web/api/endpoints/entity.rb b/lib/slack/web/api/endpoints/entity.rb index 91dcc29e..7e48984a 100644 --- a/lib/slack/web/api/endpoints/entity.rb +++ b/lib/slack/web/api/endpoints/entity.rb @@ -6,6 +6,54 @@ module Web module Api module Endpoints module Entity + # + # Acknowledge a comment mutation (edit, delete, or post) on a work object entity. Apps call this endpoint to confirm they have processed a comment action, and the backend emits a dedicated RTM event to the user. + # + # @option options [string] :trigger_id + # A reference to the original user action that initiated the comment mutation. + # @option options [object] :comment + # The full comment data. Required for edit and post actions. See the comment schema for the full list of properties. + # @option options [string] :error + # Error message if the action failed in the app. When present, signals that the mutation could not be completed. + # @see https://api.slack.com/methods/entity.acknowledgeCommentAction + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/entity/entity.acknowledgeCommentAction.json + def entity_acknowledgeCommentAction(options = {}) + raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil? + post('entity.acknowledgeCommentAction', options) + end + + # + # Provide comments for work objects. Apps call this endpoint to send per-user flexpane comment data to the client. + # + # @option options [array] :comments + # Array of comments to present to the user. See the comment schema for the full list of properties. + # @option options [string] :cursor + # App supplied cursor used for pagination, will be sent in the next request for comments. + # @option options [boolean] :can_post_comment + # Indicates whether the user has permissions to post comments. + # @option options [string] :trigger_id + # A reference to the original user action that initiated the request. + # @option options [string] :delete_action_id + # The block action id that will be sent when a delete request is initiated for a comment. + # @option options [boolean] :user_auth_required + # Set to true (or 1) to indicate that the user must authenticate to see the comments data. + # @option options [string] :user_auth_url + # A custom URL to which users are directed for authentication if required. + # @option options [Object] :error + # @see https://api.slack.com/methods/entity.presentComments + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/entity/entity.presentComments.json + def entity_presentComments(options = {}) + raise ArgumentError, 'Required arguments :comments missing' if options[:comments].nil? + raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil? + if block_given? + Pagination::Cursor.new(self, :entity_presentComments, options).each do |page| + yield page + end + else + post('entity.presentComments', options) + end + end + # # Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client. # diff --git a/lib/slack/web/api/endpoints/files.rb b/lib/slack/web/api/endpoints/files.rb index 86e7c1b1..13a18895 100644 --- a/lib/slack/web/api/endpoints/files.rb +++ b/lib/slack/web/api/endpoints/files.rb @@ -21,6 +21,12 @@ module Files # The message text introducing the file in specified channels. # @option options [string] :blocks # A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the initial_comment field is provided, the blocks field is ignored. + # @option options [string] :username + # Set your bot's user name for the file share message. Requires the chat:write.customize scope. + # @option options [string] :icon_url + # URL to an image to use as the icon for the file share message. Requires the chat:write.customize scope. + # @option options [string] :icon_emoji + # Emoji to use as the icon for the file share message. Overrides icon_url. Requires the chat:write.customize scope. # @see https://api.slack.com/methods/files.completeUploadExternal # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json def files_completeUploadExternal(options = {}) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index dec42f5c..ccae2f2d 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -411,6 +411,7 @@ class InvalidScheduledMessageId < SlackError; end class InvalidSchema < SlackError; end class InvalidScopes < SlackError; end class InvalidSearchChannelType < SlackError; end + class InvalidSenderSchema < SlackError; end class InvalidSetting < SlackError; end class InvalidShortcutType < SlackError; end class InvalidSort < SlackError; end @@ -495,6 +496,7 @@ class MetadataNotAvailable < SlackError; end class MetadataOnlyDoesNotSupportDate < SlackError; end class MetadataTooLarge < SlackError; end class MethodDeprecated < SlackError; end + class MethodNotFound < SlackError; end class MethodNotSupported < SlackError; end class MethodNotSupportedForChannelType < SlackError; end class MigrationInProgress < SlackError; end @@ -503,6 +505,8 @@ class MissingArgs < SlackError; end class MissingArgument < SlackError; end class MissingArguments < SlackError; end class MissingChannel < SlackError; end + class MissingCommentData < SlackError; end + class MissingDeleteActionId < SlackError; end class MissingDialog < SlackError; end class MissingDuration < SlackError; end class MissingFileData < SlackError; end @@ -1212,6 +1216,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_schema' => InvalidSchema, 'invalid_scopes' => InvalidScopes, 'invalid_search_channel_type' => InvalidSearchChannelType, + 'invalid_sender_schema' => InvalidSenderSchema, 'invalid_setting' => InvalidSetting, 'invalid_shortcut_type' => InvalidShortcutType, 'invalid_sort' => InvalidSort, @@ -1296,6 +1301,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'metadata_only_does_not_support_date' => MetadataOnlyDoesNotSupportDate, 'metadata_too_large' => MetadataTooLarge, 'method_deprecated' => MethodDeprecated, + 'method_not_found' => MethodNotFound, 'method_not_supported' => MethodNotSupported, 'method_not_supported_for_channel_type' => MethodNotSupportedForChannelType, 'migration_in_progress' => MigrationInProgress, @@ -1304,6 +1310,8 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'missing_argument' => MissingArgument, 'missing_arguments' => MissingArguments, 'missing_channel' => MissingChannel, + 'missing_comment_data' => MissingCommentData, + 'missing_delete_action_id' => MissingDeleteActionId, 'missing_dialog' => MissingDialog, 'missing_duration' => MissingDuration, 'missing_file_data' => MissingFileData, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 784d1d42..266a444a 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 784d1d4212a1ab31b1f7aaf575cb585fa429577a +Subproject commit 266a444abff5a8462b58911ffda69d55da15fd98 diff --git a/spec/slack/web/api/endpoints/chat_spec.rb b/spec/slack/web/api/endpoints/chat_spec.rb index 2184c5e6..d8c7284d 100644 --- a/spec/slack/web/api/endpoints/chat_spec.rb +++ b/spec/slack/web/api/endpoints/chat_spec.rb @@ -93,7 +93,8 @@ expect(client).to receive(:post).with('chat.postEphemeral', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) - expect { client.chat_postEphemeral(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postEphemeral', {text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]) @@ -101,13 +102,17 @@ expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) - expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) - expect { client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postEphemeral', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) - expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) end - it 'does not allow both text and markdown_text' do + it 'requires one of text, markdown_text' do + expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /Exactly one of/ expect(client).to receive(:post).with('chat.postEphemeral', {text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]) @@ -115,7 +120,7 @@ expect(client).to receive(:post).with('chat.postEphemeral', {markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]) - expect { client.chat_postEphemeral(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /mutually exclusive/ + expect { client.chat_postEphemeral(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /Exactly one of/ end it 'encodes attachments, blocks as json' do expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[{"data":["data"]}], channel: %q[], text: %q[Hello world], user: %q[U0BPQUNTA], blocks: %q[{"data":["data"]}]}) @@ -156,7 +161,8 @@ expect(client).to receive(:post).with('chat.postMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[]}) client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[]) - expect { client.chat_postMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postMessage', {text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[]}) client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[]) @@ -164,13 +170,17 @@ expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[]}) client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[]) - expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) - expect { client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) - expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[]) end - it 'does not allow both text and markdown_text' do + it 'requires one of text, markdown_text' do + expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /Exactly one of/ expect(client).to receive(:post).with('chat.postMessage', {text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]}) client.chat_postMessage(text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) @@ -178,7 +188,7 @@ expect(client).to receive(:post).with('chat.postMessage', {markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]}) client.chat_postMessage(markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) - expect { client.chat_postMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /mutually exclusive/ + expect { client.chat_postMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /Exactly one of/ end it 'encodes attachments, blocks, metadata as json' do expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[{"data":["data"]}], channel: %q[], text: %q[Hello world], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) @@ -222,7 +232,8 @@ expect(client).to receive(:post).with('chat.scheduleMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) - expect { client.chat_scheduleMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.scheduleMessage', {text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) + client.chat_scheduleMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]) @@ -230,13 +241,17 @@ expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) - expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) + client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) - expect { client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.scheduleMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) + client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) - expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) + client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) end - it 'does not allow both text and markdown_text' do + it 'requires one of text, markdown_text' do + expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /Exactly one of/ expect(client).to receive(:post).with('chat.scheduleMessage', {text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]) @@ -244,7 +259,7 @@ expect(client).to receive(:post).with('chat.scheduleMessage', {markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]) - expect { client.chat_scheduleMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /mutually exclusive/ + expect { client.chat_scheduleMessage(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /Exactly one of/ end it 'encodes attachments, blocks, metadata as json' do expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[{"data":["data"]}], channel: %q[], post_at: %q[299876400], text: %q[Hello world], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) @@ -314,7 +329,8 @@ expect(client).to receive(:post).with('chat.update', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) - expect { client.chat_update(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.update', {text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) + client.chat_update(text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]) @@ -322,13 +338,17 @@ expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) - expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) + client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) - expect { client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.update', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) + client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) - expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /mutually exclusive/ + expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) + client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) end - it 'does not allow both text and markdown_text' do + it 'requires one of text, markdown_text' do + expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Exactly one of/ expect(client).to receive(:post).with('chat.update', {text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(text: %q[Hello world], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]) @@ -336,7 +356,7 @@ expect(client).to receive(:post).with('chat.update', {markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]) - expect { client.chat_update(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /mutually exclusive/ + expect { client.chat_update(text: %q[Hello world], markdown_text: %q[**This is bold text**], attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Exactly one of/ end it 'encodes attachments, unfurled_attachments, blocks, metadata as json' do expect(client).to receive(:post).with('chat.update', {attachments: %q[{"data":["data"]}], channel: %q[], text: %q[Hello world], ts: %q["1405894322.002768"], unfurled_attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) diff --git a/spec/slack/web/api/endpoints/entity_spec.rb b/spec/slack/web/api/endpoints/entity_spec.rb index ad7dd194..8e74e3cb 100644 --- a/spec/slack/web/api/endpoints/entity_spec.rb +++ b/spec/slack/web/api/endpoints/entity_spec.rb @@ -5,6 +5,19 @@ RSpec.describe Slack::Web::Api::Endpoints::Entity do let(:client) { Slack::Web::Client.new } + context 'entity_acknowledgeCommentAction' do + it 'requires trigger_id' do + expect { client.entity_acknowledgeCommentAction }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ + end + end + context 'entity_presentComments' do + it 'requires comments' do + expect { client.entity_presentComments(trigger_id: %q[]) }.to raise_error ArgumentError, /Required arguments :comments missing/ + end + it 'requires trigger_id' do + expect { client.entity_presentComments(comments: %q[]) }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ + end + end context 'entity_presentDetails' do it 'requires trigger_id' do expect { client.entity_presentDetails }.to raise_error ArgumentError, /Required arguments :trigger_id missing/