diff --git a/CHANGELOG.md b/CHANGELOG.md index b57ba437..cf2f9bb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 3.1.1 (Next) +* [#578](https://github.com/slack-ruby/slack-ruby-client/pull/578): Update API from [slack-api-ref@3275786](https://github.com/slack-ruby/slack-api-ref/commit/3275786) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. ### 3.1.0 (2025/11/15) diff --git a/bin/commands/admin_users.rb b/bin/commands/admin_users.rb index 28857d0f..62ab78d3 100644 --- a/bin/commands/admin_users.rb +++ b/bin/commands/admin_users.rb @@ -71,10 +71,10 @@ class App end end - g.desc 'Set an existing regular user or owner to be a workspace admin.' - g.long_desc %( Set an existing regular user or owner to be a workspace admin. ) + g.desc 'Set an existing regular user or owner to be a workspace or org admin.' + g.long_desc %( Set an existing regular user or owner to be a workspace or org admin. ) g.command 'setAdmin' do |c| - c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' + c.flag 'team_id', desc: 'The ID of the workspace or organization.' c.flag 'user_id', desc: 'The ID of the user to designate as an admin.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_users_setAdmin(options)) @@ -92,11 +92,11 @@ class App end end - g.desc 'Set an existing regular user or admin to be a workspace owner.' - g.long_desc %( Set an existing regular user or admin to be a workspace owner. ) + g.desc 'Set an existing regular user or admin to be a workspace or org owner.' + g.long_desc %( Set an existing regular user or admin to be a workspace or org owner. ) g.command 'setOwner' do |c| - c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' - c.flag 'user_id', desc: 'Id of the user to promote to owner.' + c.flag 'team_id', desc: 'The ID of the workspace or organization.' + c.flag 'user_id', desc: 'ID of the user to promote to owner.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_users_setOwner(options)) end @@ -105,7 +105,7 @@ class App g.desc 'Set an existing guest user, admin user, or owner to be a regular user.' g.long_desc %( Set an existing guest user, admin user, or owner to be a regular user. ) g.command 'setRegular' do |c| - c.flag 'team_id', desc: 'The ID (T1234) of the workspace.' + c.flag 'team_id', desc: 'The ID of the workspace or organization.' c.flag 'user_id', desc: 'The ID of the user to designate as a regular user.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_users_setRegular(options)) diff --git a/bin/commands/admin_workflows_triggers_types_permissions.rb b/bin/commands/admin_workflows_triggers_types_permissions.rb index 9c0a56da..4dc3ee86 100644 --- a/bin/commands/admin_workflows_triggers_types_permissions.rb +++ b/bin/commands/admin_workflows_triggers_types_permissions.rb @@ -6,10 +6,10 @@ module Cli class App desc 'AdminWorkflowsTriggersTypesPermissions methods.' command 'admin_workflows_triggers_types_permissions' do |g| - g.desc 'list the permissions for using each trigger type' - g.long_desc %( list the permissions for using each trigger type ) + g.desc 'List the permissions for using each trigger type.' + g.long_desc %( List the permissions for using each trigger type. ) g.command 'lookup' do |c| - c.flag 'trigger_type_ids', desc: 'The trigger types IDs for which to get the permissions.' + c.flag 'trigger_type_ids', desc: 'The trigger type IDs for which to get the permissions.' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_workflows_triggers_types_permissions_lookup(options)) end @@ -21,6 +21,7 @@ class App c.flag 'id', desc: 'The trigger type ID for which to set the permissions.' c.flag 'visibility', desc: 'The function visibility.' c.flag 'user_ids', desc: 'List of user IDs to allow for named_entities visibility.' + c.flag 'permissions', desc: '' c.action do |_global_options, options, _args| puts JSON.dump(@client.admin_workflows_triggers_types_permissions_set(options)) end diff --git a/bin/commands/assistant_threads.rb b/bin/commands/assistant_threads.rb index 128d5c4b..b1d8d9c6 100644 --- a/bin/commands/assistant_threads.rb +++ b/bin/commands/assistant_threads.rb @@ -11,8 +11,8 @@ class App g.command 'setStatus' do |c| c.flag 'channel_id', desc: 'Channel ID containing the assistant thread.' c.flag 'thread_ts', desc: 'Message timestamp of the thread of where to set the status.' - c.flag 'status', desc: "Status of the specified bot user, e.g. 'is thinking...'." - c.flag 'loading_messages', desc: 'The list of messages to rotate through as a loading indicator.' + c.flag 'status', desc: "Status of the specified bot user, e.g., 'is thinking...'. A two minute timeout applies, which will cause the status to be removed if no message has been sent." + c.flag 'loading_messages', desc: 'The list of messages to rotate through as a loading indicator. Maximum of 10 messages.' c.action do |_global_options, options, _args| puts JSON.dump(@client.assistant_threads_setStatus(options)) end diff --git a/bin/commands/chat.rb b/bin/commands/chat.rb index 90f8d58d..faac8334 100644 --- a/bin/commands/chat.rb +++ b/bin/commands/chat.rb @@ -103,7 +103,7 @@ class App c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message.' c.flag 'link_names', desc: 'Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.' c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters.' - c.flag 'metadata', desc: 'JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.' + c.flag 'metadata', desc: 'JSON object with event_type and event_payload fields, presented as a URL-encoded string. You can also provide Work Object entity metadata using this parameter. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.' c.flag 'mrkdwn', desc: 'Disable Slack markup parsing by setting to false. Enabled by default.' c.flag 'parse', desc: 'Change how messages are treated. See below.' c.flag 'reply_broadcast', desc: 'Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.' @@ -142,7 +142,7 @@ class App g.desc 'Starts a new streaming conversation.' g.long_desc %( Starts a new streaming conversation. ) g.command 'startStream' do |c| - c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or DM.' + c.flag 'channel', desc: 'An encoded ID that represents a channel thread or DM.' c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. Limit this field to 12,000 characters.' c.flag 'thread_ts', desc: "Provide another message's ts value to reply to. Streamed messages should always be replies to a user request." c.flag 'recipient_user_id', desc: 'The encoded ID of the user to receive the streaming text. Required when streaming to channels.' @@ -177,7 +177,7 @@ class App c.flag 'user_auth_blocks', desc: 'Provide a JSON based array of structured blocks presented as URL-encoded string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.' c.flag 'unfurl_id', desc: 'The ID of the link to unfurl. Both unfurl_id and source must be provided together, or channel and ts must be provided together.' c.flag 'source', desc: 'The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation.' - c.flag 'metadata', desc: 'JSON object with entity_type and entity_payload fields, presented as a URL-encoded string. Either unfurls or metadata must be provided.' + c.flag 'metadata', desc: 'JSON object with an entities field providing an array of Work Object entities. Either unfurls or metadata must be provided.' c.action do |_global_options, options, _args| puts JSON.dump(@client.chat_unfurl(options)) end diff --git a/lib/slack/web/api/endpoints/admin_users.rb b/lib/slack/web/api/endpoints/admin_users.rb index 1825990e..34dd07de 100644 --- a/lib/slack/web/api/endpoints/admin_users.rb +++ b/lib/slack/web/api/endpoints/admin_users.rb @@ -115,10 +115,10 @@ def admin_users_remove(options = {}) end # - # Set an existing regular user or owner to be a workspace admin. + # Set an existing regular user or owner to be a workspace or org admin. # # @option options [Object] :team_id - # The ID (T1234) of the workspace. + # The ID of the workspace or organization. # @option options [string] :user_id # The ID of the user to designate as an admin. # @see https://api.slack.com/methods/admin.users.setAdmin @@ -147,12 +147,12 @@ def admin_users_setExpiration(options = {}) end # - # Set an existing regular user or admin to be a workspace owner. + # Set an existing regular user or admin to be a workspace or org owner. # # @option options [Object] :team_id - # The ID (T1234) of the workspace. + # The ID of the workspace or organization. # @option options [Object] :user_id - # Id of the user to promote to owner. + # ID of the user to promote to owner. # @see https://api.slack.com/methods/admin.users.setOwner # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.setOwner.json def admin_users_setOwner(options = {}) @@ -165,7 +165,7 @@ def admin_users_setOwner(options = {}) # Set an existing guest user, admin user, or owner to be a regular user. # # @option options [Object] :team_id - # The ID (T1234) of the workspace. + # The ID of the workspace or organization. # @option options [string] :user_id # The ID of the user to designate as a regular user. # @see https://api.slack.com/methods/admin.users.setRegular diff --git a/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb b/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb index 5bf8cd80..ebf17218 100644 --- a/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +++ b/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb @@ -7,10 +7,10 @@ module Api module Endpoints module AdminWorkflowsTriggersTypesPermissions # - # list the permissions for using each trigger type + # List the permissions for using each trigger type. # # @option options [array] :trigger_type_ids - # The trigger types IDs for which to get the permissions. + # The trigger type IDs for which to get the permissions. # @see https://api.slack.com/methods/admin.workflows.triggers.types.permissions.lookup # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.triggers.types.permissions/admin.workflows.triggers.types.permissions.lookup.json def admin_workflows_triggers_types_permissions_lookup(options = {}) @@ -27,11 +27,11 @@ def admin_workflows_triggers_types_permissions_lookup(options = {}) # The function visibility. # @option options [array] :user_ids # List of user IDs to allow for named_entities visibility. + # @option options [object] :permissions # @see https://api.slack.com/methods/admin.workflows.triggers.types.permissions.set # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.workflows.triggers.types.permissions/admin.workflows.triggers.types.permissions.set.json def admin_workflows_triggers_types_permissions_set(options = {}) raise ArgumentError, 'Required arguments :id missing' if options[:id].nil? - raise ArgumentError, 'Required arguments :visibility missing' if options[:visibility].nil? post('admin.workflows.triggers.types.permissions.set', options) end end diff --git a/lib/slack/web/api/endpoints/assistant_threads.rb b/lib/slack/web/api/endpoints/assistant_threads.rb index e45d0825..2f44c823 100644 --- a/lib/slack/web/api/endpoints/assistant_threads.rb +++ b/lib/slack/web/api/endpoints/assistant_threads.rb @@ -14,9 +14,9 @@ module AssistantThreads # @option options [string] :thread_ts # Message timestamp of the thread of where to set the status. # @option options [string] :status - # Status of the specified bot user, e.g. 'is thinking...'. + # Status of the specified bot user, e.g., 'is thinking...'. A two minute timeout applies, which will cause the status to be removed if no message has been sent. # @option options [array] :loading_messages - # The list of messages to rotate through as a loading indicator. + # The list of messages to rotate through as a loading indicator. Maximum of 10 messages. # @see https://api.slack.com/methods/assistant.threads.setStatus # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.threads/assistant.threads.setStatus.json def assistant_threads_setStatus(options = {}) diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 2a75caf1..7ccf3cea 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -144,7 +144,8 @@ def chat_meMessage(options = {}) 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 is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].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, '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) @@ -172,7 +173,7 @@ def chat_postEphemeral(options = {}) # @option options [string] :markdown_text # Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters. # @option options [string] :metadata - # JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + # JSON object with event_type and event_payload fields, presented as a URL-encoded string. You can also provide Work Object entity metadata using this parameter. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. # @option options [boolean] :mrkdwn # Disable Slack markup parsing by setting to false. Enabled by default. # @option options [string] :parse @@ -193,7 +194,8 @@ def chat_postEphemeral(options = {}) # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json def chat_postMessage(options = {}) raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? - raise ArgumentError, 'At least one of :attachments, :blocks, :text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].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, '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 @@ -234,7 +236,8 @@ def chat_postMessage(options = {}) 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 is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].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, '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 @@ -243,7 +246,7 @@ def chat_scheduleMessage(options = {}) # Starts a new streaming conversation. # # @option options [channel] :channel - # An encoded ID that represents a channel, private group, or DM. + # An encoded ID that represents a channel thread or DM. # @option options [string] :markdown_text # Accepts message text formatted in markdown. Limit this field to 12,000 characters. # @option options [string] :thread_ts @@ -306,7 +309,7 @@ def chat_stopStream(options = {}) # @option options [enum] :source # The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation. # @option options [string] :metadata - # JSON object with entity_type and entity_payload fields, presented as a URL-encoded string. Either unfurls or metadata must be provided. + # JSON object with an entities field providing an array of Work Object entities. Either unfurls or metadata must be provided. # @see https://api.slack.com/methods/chat.unfurl # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.unfurl.json def chat_unfurl(options = {}) @@ -347,7 +350,8 @@ def chat_unfurl(options = {}) 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 is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].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, '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 blocks metadata]) post('chat.update', options) diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 7b7ce336..7e4e4e94 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -265,9 +265,11 @@ class FileChannelRenameError < SlackError; end class FileCommentNotFound < SlackError; end class FileDeleted < SlackError; end class FileDeletingDisabled < SlackError; end + class FileIsDeleted < SlackError; end class FileNotFound < SlackError; end class FileNotShared < SlackError; end class FileNotYetAvailable < SlackError; end + class FileShareLimitReached < SlackError; end class FileUnderReview < SlackError; end class FileUpdateFailed < SlackError; end class FileUploadSizeRestricted < SlackError; end @@ -359,6 +361,7 @@ class InvalidOptionId < SlackError; end class InvalidOrgId < SlackError; end class InvalidParameters < SlackError; end class InvalidParentType < SlackError; end + class InvalidPermissionSet < SlackError; end class InvalidPermissionType < SlackError; end class InvalidPermissions < SlackError; end class InvalidPhoneNumber < SlackError; end @@ -446,11 +449,13 @@ class ListsDisabledUserTeam < SlackError; end class MalwareDetected < SlackError; end class ManagedChannelNotSupported < SlackError; end class MarkdownTextConflict < SlackError; end + class MaxFileSharingExceeded < SlackError; end class MemberAnalyticsDisabled < SlackError; end class MemberLimitExceeded < SlackError; end class MessageLimitExceeded < SlackError; end class MessageNotFound < SlackError; end class MessageNotInStreamingState < SlackError; end + class MessageNotOwnedByBot < SlackError; end class MessageTooLong < SlackError; end class MessagesTabDisabled < SlackError; end class MessagingProcessingFailed < SlackError; end @@ -612,6 +617,7 @@ class RequestAlreadyResolved < SlackError; end class RequestIdOrAppIdIsRequired < SlackError; end class RequestIdRequiredForCustomIntegrations < SlackError; end class RequestTimeout < SlackError; end + class RequiredVisibility < SlackError; end class ReservedName < SlackError; end class ResizedButStillTooLarge < SlackError; end class RestrictedAction < SlackError; end @@ -651,6 +657,7 @@ class TargetTeamNotOnOrg < SlackError; end class TeamAddedToOrg < SlackError; end class TeamIdOrOrgRequired < SlackError; end class TeamIdRequiredForEnterprise < SlackError; end + class TeamLimitExceeded < SlackError; end class TeamNotConnected < SlackError; end class TeamNotFound < SlackError; end class TeamNotOnEnterprise < SlackError; end @@ -698,6 +705,7 @@ class UnableToDelete < SlackError; end class UnableToFetchCustomEmojis < SlackError; end class UnableToLinkIdpGroupAndChannel < SlackError; end class UnableToProcessPostRequest < SlackError; end + class UnableToShareFiles < SlackError; end class UnableToUnlinkIdpGroupAndChannel < SlackError; end class UnableToUpdateExistingSessions < SlackError; end class UneditableColumn < SlackError; end @@ -1013,9 +1021,11 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'file_comment_not_found' => FileCommentNotFound, 'file_deleted' => FileDeleted, 'file_deleting_disabled' => FileDeletingDisabled, + 'file_is_deleted' => FileIsDeleted, 'file_not_found' => FileNotFound, 'file_not_shared' => FileNotShared, 'file_not_yet_available' => FileNotYetAvailable, + 'file_share_limit_reached' => FileShareLimitReached, 'file_under_review' => FileUnderReview, 'file_update_failed' => FileUpdateFailed, 'file_upload_size_restricted' => FileUploadSizeRestricted, @@ -1107,6 +1117,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_org_id' => InvalidOrgId, 'invalid_parameters' => InvalidParameters, 'invalid_parent_type' => InvalidParentType, + 'invalid_permission_set' => InvalidPermissionSet, 'invalid_permission_type' => InvalidPermissionType, 'invalid_permissions' => InvalidPermissions, 'invalid_phone_number' => InvalidPhoneNumber, @@ -1194,11 +1205,13 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'malware_detected' => MalwareDetected, 'managed_channel_not_supported' => ManagedChannelNotSupported, 'markdown_text_conflict' => MarkdownTextConflict, + 'max_file_sharing_exceeded' => MaxFileSharingExceeded, 'member_analytics_disabled' => MemberAnalyticsDisabled, 'member_limit_exceeded' => MemberLimitExceeded, 'message_limit_exceeded' => MessageLimitExceeded, 'message_not_found' => MessageNotFound, 'message_not_in_streaming_state' => MessageNotInStreamingState, + 'message_not_owned_by_bot' => MessageNotOwnedByBot, 'message_too_long' => MessageTooLong, 'messages_tab_disabled' => MessagesTabDisabled, 'messaging_processing_failed' => MessagingProcessingFailed, @@ -1360,6 +1373,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'request_id_or_app_id_is_required' => RequestIdOrAppIdIsRequired, 'request_id_required_for_custom_integrations' => RequestIdRequiredForCustomIntegrations, 'request_timeout' => RequestTimeout, + 'required_visibility' => RequiredVisibility, 'reserved_name' => ReservedName, 'resized_but_still_too_large' => ResizedButStillTooLarge, 'restricted_action' => RestrictedAction, @@ -1399,6 +1413,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'team_added_to_org' => TeamAddedToOrg, 'team_id_or_org_required' => TeamIdOrOrgRequired, 'team_id_required_for_enterprise' => TeamIdRequiredForEnterprise, + 'team_limit_exceeded' => TeamLimitExceeded, 'team_not_connected' => TeamNotConnected, 'team_not_found' => TeamNotFound, 'team_not_on_enterprise' => TeamNotOnEnterprise, @@ -1446,6 +1461,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'unable_to_fetch_custom_emojis' => UnableToFetchCustomEmojis, 'unable_to_link_idp_group_and_channel' => UnableToLinkIdpGroupAndChannel, 'unable_to_process_post_request' => UnableToProcessPostRequest, + 'unable_to_share_files' => UnableToShareFiles, 'unable_to_unlink_idp_group_and_channel' => UnableToUnlinkIdpGroupAndChannel, 'unable_to_update_existing_sessions' => UnableToUpdateExistingSessions, 'uneditable_column' => UneditableColumn, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index 32757867..42609ea5 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit 32757867a5d54838b71403fbf45bc4c081abdf23 +Subproject commit 42609ea58d960115b69960674ae27be7629a709f diff --git a/spec/slack/web/api/endpoints/admin_users_spec.rb b/spec/slack/web/api/endpoints/admin_users_spec.rb index 89c66dd8..96747ff4 100644 --- a/spec/slack/web/api/endpoints/admin_users_spec.rb +++ b/spec/slack/web/api/endpoints/admin_users_spec.rb @@ -37,7 +37,7 @@ expect { client.admin_users_setAdmin(user_id: %q[W12345678]) }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setAdmin(team_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setAdmin(team_id: %q[T12345678]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_setExpiration' do @@ -50,10 +50,10 @@ end context 'admin.users_setOwner' do it 'requires team_id' do - expect { client.admin_users_setOwner(user_id: %q[]) }.to raise_error ArgumentError, /Required arguments :team_id missing/ + expect { client.admin_users_setOwner(user_id: %q[W12345678]) }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setOwner(team_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setOwner(team_id: %q[T12345678]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end context 'admin.users_setRegular' do @@ -61,7 +61,7 @@ expect { client.admin_users_setRegular(user_id: %q[W12345678]) }.to raise_error ArgumentError, /Required arguments :team_id missing/ end it 'requires user_id' do - expect { client.admin_users_setRegular(team_id: %q[]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ + expect { client.admin_users_setRegular(team_id: %q[T12345678]) }.to raise_error ArgumentError, /Required arguments :user_id missing/ end end end diff --git a/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb b/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb index 4dd119a6..9a2ffe3f 100644 --- a/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb +++ b/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb @@ -12,10 +12,7 @@ end context 'admin.workflows.triggers.types.permissions_set' do it 'requires id' do - expect { client.admin_workflows_triggers_types_permissions_set(visibility: %q[]) }.to raise_error ArgumentError, /Required arguments :id missing/ - end - it 'requires visibility' do - expect { client.admin_workflows_triggers_types_permissions_set(id: %q[['FTT01', 'FTT02', 'FTT03']]) }.to raise_error ArgumentError, /Required arguments :visibility missing/ + expect { client.admin_workflows_triggers_types_permissions_set }.to raise_error ArgumentError, /Required arguments :id missing/ end end end diff --git a/spec/slack/web/api/endpoints/chat_spec.rb b/spec/slack/web/api/endpoints/chat_spec.rb index 81b4c7d7..eb4c0b32 100644 --- a/spec/slack/web/api/endpoints/chat_spec.rb +++ b/spec/slack/web/api/endpoints/chat_spec.rb @@ -58,12 +58,12 @@ end context 'chat_postEphemeral' do it 'requires channel' do - expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /Required arguments :channel missing/ end it 'requires user' do - expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /Required arguments :user missing/ + expect { client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :user missing/ end - it 'requires one of attachments, blocks, text' do + it 'requires one of attachments, blocks, text, markdown_text' do expect { client.chat_postEphemeral(channel: %q[], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /At least one of/ expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], user: %q[U0BPQUNTA]}) @@ -75,28 +75,63 @@ expect(client).to receive(:post).with('chat.postEphemeral', {text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]) + expect(client).to receive(:post).with('chat.postEphemeral', {markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(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"}}]], 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"}}]], channel: %q[], user: %q[U0BPQUNTA]) expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]) + expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]}) + client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], markdown_text: %q[**This is bold text**], channel: %q[], user: %q[U0BPQUNTA]) + expect(client).to receive(:post).with('chat.postEphemeral', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]}) client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], user: %q[U0BPQUNTA]) + 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).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]) + + 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).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).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).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 '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]) + + 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, /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[], user: %q[U0BPQUNTA], blocks: %q[{"data":["data"]}]}) - client.chat_postEphemeral(attachments: {:data=>["data"]}, channel: %q[], user: %q[U0BPQUNTA], blocks: {:data=>["data"]}) + 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"]}]}) + client.chat_postEphemeral(attachments: {:data=>["data"]}, channel: %q[], text: %q[Hello world], user: %q[U0BPQUNTA], blocks: {:data=>["data"]}) end end context 'chat_postMessage' do it 'requires channel' do - expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :channel missing/ end - it 'requires one of attachments, blocks, text' do + it 'requires one of attachments, blocks, text, markdown_text' do expect { client.chat_postMessage(channel: %q[]) }.to raise_error ArgumentError, /At least one of/ expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]}) @@ -108,31 +143,66 @@ expect(client).to receive(:post).with('chat.postMessage', {text: %q[Hello world], channel: %q[]}) client.chat_postMessage(text: %q[Hello world], channel: %q[]) + expect(client).to receive(:post).with('chat.postMessage', {markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(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"}}]], channel: %q[]}) client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[]) expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[]}) client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[]) + expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], markdown_text: %q[**This is bold text**], channel: %q[]}) + client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], markdown_text: %q[**This is bold text**], channel: %q[]) + expect(client).to receive(:post).with('chat.postMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[]}) client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[]) + 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).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[]) + + 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).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).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).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 '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[]) + + 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, /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[], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) - client.chat_postMessage(attachments: {:data=>["data"]}, channel: %q[], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) + 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"]}]}) + client.chat_postMessage(attachments: {:data=>["data"]}, channel: %q[], text: %q[Hello world], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) end end context 'chat_scheduleMessage' do it 'requires channel' do - expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], post_at: %q[299876400]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], post_at: %q[299876400], text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :channel missing/ end it 'requires post_at' do - expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /Required arguments :post_at missing/ + expect { client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :post_at missing/ end - it 'requires one of attachments, blocks, text' do + it 'requires one of attachments, blocks, text, markdown_text' do expect { client.chat_scheduleMessage(channel: %q[], post_at: %q[299876400]) }.to raise_error ArgumentError, /At least one of/ expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], post_at: %q[299876400]}) @@ -144,21 +214,56 @@ expect(client).to receive(:post).with('chat.scheduleMessage', {text: %q[Hello world], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(text: %q[Hello world], channel: %q[], post_at: %q[299876400]) + expect(client).to receive(:post).with('chat.scheduleMessage', {markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]}) + client.chat_scheduleMessage(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"}}]], 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"}}]], channel: %q[], post_at: %q[299876400]) expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]) + expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-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"}]], markdown_text: %q[**This is bold text**], channel: %q[], post_at: %q[299876400]) + expect(client).to receive(:post).with('chat.scheduleMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]}) client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], post_at: %q[299876400]) + 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).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]) + + 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).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).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).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 '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]) + + 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, /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], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) - client.chat_scheduleMessage(attachments: {:data=>["data"]}, channel: %q[], post_at: %q[299876400], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) + 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"]}]}) + client.chat_scheduleMessage(attachments: {:data=>["data"]}, channel: %q[], post_at: %q[299876400], text: %q[Hello world], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) end end context 'chat_startStream' do @@ -189,12 +294,12 @@ end context 'chat_update' do it 'requires channel' do - expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /Required arguments :channel missing/ end it 'requires ts' do - expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[]) }.to raise_error ArgumentError, /Required arguments :ts missing/ + expect { client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], text: %q[Hello world]) }.to raise_error ArgumentError, /Required arguments :ts missing/ end - it 'requires one of attachments, blocks, text' do + it 'requires one of attachments, blocks, text, markdown_text' do expect { client.chat_update(channel: %q[], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /At least one of/ expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[], ts: %q["1405894322.002768"]}) @@ -206,21 +311,56 @@ expect(client).to receive(:post).with('chat.update', {text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]) + expect(client).to receive(:post).with('chat.update', {markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]}) + client.chat_update(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"}}]], 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"}}]], channel: %q[], ts: %q["1405894322.002768"]) expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]) + expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-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"}]], markdown_text: %q[**This is bold text**], channel: %q[], ts: %q["1405894322.002768"]) + expect(client).to receive(:post).with('chat.update', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]}) client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[], ts: %q["1405894322.002768"]) + 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).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"]) + + 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).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).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).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 '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"]) + + 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, /Exactly one of/ end it 'encodes attachments, blocks, metadata as json' do - expect(client).to receive(:post).with('chat.update', {attachments: %q[{"data":["data"]}], channel: %q[], ts: %q["1405894322.002768"], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) - client.chat_update(attachments: {:data=>["data"]}, channel: %q[], ts: %q["1405894322.002768"], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) + expect(client).to receive(:post).with('chat.update', {attachments: %q[{"data":["data"]}], channel: %q[], text: %q[Hello world], ts: %q["1405894322.002768"], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) + client.chat_update(attachments: {:data=>["data"]}, channel: %q[], text: %q[Hello world], ts: %q["1405894322.002768"], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) end end end