slack-ruby-client 1.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/integration_test.yml +45 -0
- data/.github/workflows/lint.yml +14 -0
- data/.github/workflows/pr_lint.yml +21 -0
- data/.github/workflows/test.yml +37 -0
- data/.gitignore +4 -3
- data/.rubocop.yml +6 -1
- data/.rubocop_todo.yml +88 -34
- data/.ruby-version +1 -0
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +6 -5
- data/Gemfile +13 -1
- data/Gemfile.danger +6 -0
- data/README.md +78 -76
- data/RELEASING.md +2 -2
- data/SECURITY.md +9 -0
- data/UPGRADING.md +28 -0
- data/bin/commands/admin_analytics.rb +16 -10
- data/bin/commands/admin_apps.rb +48 -42
- data/bin/commands/admin_apps_approved.rb +17 -11
- data/bin/commands/admin_apps_requests.rb +28 -11
- data/bin/commands/admin_apps_restricted.rb +17 -11
- data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
- data/bin/commands/admin_auth_policy.rb +37 -31
- data/bin/commands/admin_barriers.rb +44 -38
- data/bin/commands/admin_conversations.rb +221 -163
- data/bin/commands/admin_conversations_ekm.rb +17 -11
- data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
- data/bin/commands/admin_emoji.rb +50 -44
- data/bin/commands/admin_inviteRequests.rb +34 -28
- data/bin/commands/admin_inviteRequests_approved.rb +16 -10
- data/bin/commands/admin_inviteRequests_denied.rb +16 -10
- data/bin/commands/admin_roles.rb +46 -0
- data/bin/commands/admin_teams.rb +26 -20
- data/bin/commands/admin_teams_admins.rb +16 -10
- data/bin/commands/admin_teams_owners.rb +16 -10
- data/bin/commands/admin_teams_settings.rb +59 -53
- data/bin/commands/admin_usergroups.rb +45 -39
- data/bin/commands/admin_users.rb +91 -85
- data/bin/commands/admin_users_session.rb +72 -66
- data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
- data/bin/commands/api.rb +14 -8
- data/bin/commands/apps.rb +15 -9
- data/bin/commands/apps_connections.rb +13 -7
- data/bin/commands/apps_event_authorizations.rb +16 -10
- data/bin/commands/apps_manifest.rb +48 -41
- data/bin/commands/auth.rb +21 -15
- data/bin/commands/auth_teams.rb +16 -10
- data/bin/commands/bookmarks.rb +59 -0
- data/bin/commands/bots.rb +15 -9
- data/bin/commands/calls.rb +49 -43
- data/bin/commands/calls_participants.rb +24 -18
- data/bin/commands/chat.rb +150 -141
- data/bin/commands/chat_scheduledMessages.rb +19 -13
- data/bin/commands/conversations.rb +233 -225
- data/bin/commands/dialog.rb +15 -9
- data/bin/commands/dnd.rb +46 -40
- data/bin/commands/emoji.rb +14 -7
- data/bin/commands/files.rb +112 -83
- data/bin/commands/files_comments.rb +15 -9
- data/bin/commands/files_remote.rb +73 -67
- data/bin/commands/functions_workflows_steps.rb +22 -0
- data/bin/commands/functions_workflows_steps_responses.rb +22 -0
- data/bin/commands/migration.rb +16 -10
- data/bin/commands/oauth.rb +18 -12
- data/bin/commands/oauth_v2.rb +28 -22
- data/bin/commands/openid_connect.rb +26 -20
- data/bin/commands/pins.rb +33 -26
- data/bin/commands/reactions.rb +52 -46
- data/bin/commands/reminders.rb +53 -47
- data/bin/commands/rtm.rb +15 -24
- data/bin/commands/search.rb +43 -37
- data/bin/commands/stars.rb +38 -32
- data/bin/commands/team.rb +47 -38
- data/bin/commands/team_billing.rb +13 -7
- data/bin/commands/team_preferences.rb +13 -7
- data/bin/commands/team_profile.rb +14 -8
- data/bin/commands/tooling_tokens.rb +14 -8
- data/bin/commands/usergroups.rb +64 -58
- data/bin/commands/usergroups_users.rb +27 -21
- data/bin/commands/users.rb +111 -105
- data/bin/commands/users_admin.rb +28 -22
- data/bin/commands/users_prefs.rb +13 -7
- data/bin/commands/users_profile.rb +26 -20
- data/bin/commands/views.rb +47 -39
- data/bin/commands/workflows.rb +36 -30
- data/bin/slack +48 -43
- data/lib/slack/real_time/api/message.rb +3 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
- data/lib/slack/real_time/api/typing.rb +2 -1
- data/lib/slack/real_time/client.rb +10 -28
- data/lib/slack/real_time/config.rb +3 -3
- data/lib/slack/real_time/models/channel.rb +4 -0
- data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
- data/lib/slack/real_time/models.rb +2 -1
- data/lib/slack/real_time/stores/base.rb +25 -9
- data/lib/slack/real_time/stores/starter.rb +323 -309
- data/lib/slack/real_time/stores/store.rb +265 -198
- data/lib/slack/real_time/stores.rb +1 -7
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
- data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
- data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
- data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
- data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
- data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
- data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
- data/lib/slack/web/api/endpoints/apps.rb +2 -2
- data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
- data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
- data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
- data/lib/slack/web/api/endpoints/bots.rb +1 -1
- data/lib/slack/web/api/endpoints/calls.rb +5 -5
- data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +37 -31
- data/lib/slack/web/api/endpoints/conversations.rb +38 -34
- data/lib/slack/web/api/endpoints/dialog.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +1 -1
- data/lib/slack/web/api/endpoints/emoji.rb +2 -0
- data/lib/slack/web/api/endpoints/files.rb +45 -10
- data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
- data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
- data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
- data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
- data/lib/slack/web/api/endpoints/migration.rb +1 -1
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/pins.rb +5 -3
- data/lib/slack/web/api/endpoints/reactions.rb +4 -4
- data/lib/slack/web/api/endpoints/reminders.rb +5 -5
- data/lib/slack/web/api/endpoints/rtm.rb +0 -23
- data/lib/slack/web/api/endpoints/search.rb +3 -3
- data/lib/slack/web/api/endpoints/team.rb +13 -1
- data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
- data/lib/slack/web/api/endpoints/users.rb +4 -4
- data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
- data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
- data/lib/slack/web/api/endpoints/views.rb +16 -11
- data/lib/slack/web/api/endpoints/workflows.rb +4 -4
- data/lib/slack/web/api/endpoints.rb +12 -0
- data/lib/slack/web/api/errors.rb +146 -8
- data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.id.rb +1 -1
- data/lib/slack/web/api/mixins/users.search.rb +2 -1
- data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
- data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
- data/lib/slack/web/api/patches/views.view-json.patch +55 -0
- data/lib/slack/web/api/templates/command.erb +18 -12
- data/lib/slack/web/api/templates/method.erb +1 -1
- data/lib/slack/web/config.rb +2 -2
- data/lib/slack/web/faraday/connection.rb +4 -4
- data/lib/slack/web/faraday/request.rb +2 -0
- data/lib/slack/web/faraday/response/raise_error.rb +2 -10
- data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
- data/lib/slack-ruby-client.rb +2 -1
- data/lib/tasks/real_time.rake +44 -24
- data/lib/tasks/web.rake +9 -8
- data/slack-ruby-client.gemspec +5 -14
- data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
- data/spec/integration/integration_spec.rb +1 -1
- data/spec/slack/events/config_spec.rb +2 -0
- data/spec/slack/events/request_spec.rb +5 -1
- data/spec/slack/messages/formatting_spec.rb +10 -0
- data/spec/slack/real_time/api/message_spec.rb +1 -1
- data/spec/slack/real_time/api/ping_spec.rb +1 -1
- data/spec/slack/real_time/api/typing_spec.rb +1 -1
- data/spec/slack/real_time/client_spec.rb +91 -127
- data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
- data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
- data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
- data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
- data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
- data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
- data/spec/slack/real_time/stores/store_spec.rb +50 -0
- data/spec/slack/slack_spec.rb +5 -4
- data/spec/slack/version_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
- data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
- data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
- data/spec/slack/web/api/mixins/users_spec.rb +2 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
- data/spec/slack/web/client_spec.rb +39 -11
- data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
- data/spec/support/real_time/connected_client.rb +1 -1
- data/spec/support/real_time/loaded_client.rb +120 -0
- metadata +45 -197
- data/.travis.yml +0 -29
- data/bin/commands/admin_conversations_whitelist.rb +0 -37
- data/bin/commands/apps_permissions.rb +0 -23
- data/bin/commands/apps_permissions_resources.rb +0 -15
- data/bin/commands/apps_permissions_scopes.rb +0 -13
- data/bin/commands/apps_permissions_users.rb +0 -26
- data/bin/commands/channels.rb +0 -23
- data/bin/commands/groups.rb +0 -14
- data/bin/commands/im.rb +0 -6
- data/bin/commands/mpim.rb +0 -6
- data/bin/commands.rb +0 -66
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
- data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
- data/lib/slack/web/api/endpoints/channels.rb +0 -25
- data/lib/slack/web/api/endpoints/groups.rb +0 -13
- data/lib/slack/web/api/endpoints/im.rb +0 -13
- data/lib/slack/web/api/endpoints/mpim.rb +0 -13
- data/lib/slack/web/api/endpoints/presence.rb +0 -23
- data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
- data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
- data/lib/slack/web/api/templates/commands.erb +0 -6
- data/spec/fixtures/slack/web/rtm_start.yml +0 -815
- data/spec/slack/real_time/rtm_start_spec.rb +0 -14
- data/spec/slack/real_time/store_spec.rb +0 -12
@@ -16,8 +16,8 @@ module Slack
|
|
16
16
|
# @see https://api.slack.com/methods/calls.participants.add
|
17
17
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.add.json
|
18
18
|
def calls_participants_add(options = {})
|
19
|
-
|
20
|
-
|
19
|
+
raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
|
20
|
+
raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
|
21
21
|
post('calls.participants.add', options)
|
22
22
|
end
|
23
23
|
|
@@ -31,8 +31,8 @@ module Slack
|
|
31
31
|
# @see https://api.slack.com/methods/calls.participants.remove
|
32
32
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.remove.json
|
33
33
|
def calls_participants_remove(options = {})
|
34
|
-
|
35
|
-
|
34
|
+
raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
|
35
|
+
raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
|
36
36
|
post('calls.participants.remove', options)
|
37
37
|
end
|
38
38
|
end
|
@@ -17,8 +17,8 @@ module Slack
|
|
17
17
|
# Additional parameters provided to the slash command.
|
18
18
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/chat/chat.command.json
|
19
19
|
def chat_command(options = {})
|
20
|
-
|
21
|
-
|
20
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
21
|
+
raise ArgumentError, 'Required arguments :command missing' if options[:command].nil?
|
22
22
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
23
23
|
logger.warn('The chat.command method is undocumented.')
|
24
24
|
post('chat.command', options)
|
@@ -36,8 +36,8 @@ module Slack
|
|
36
36
|
# @see https://api.slack.com/methods/chat.delete
|
37
37
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.delete.json
|
38
38
|
def chat_delete(options = {})
|
39
|
-
|
40
|
-
|
39
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
40
|
+
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
41
41
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
42
42
|
post('chat.delete', options)
|
43
43
|
end
|
@@ -54,8 +54,8 @@ module Slack
|
|
54
54
|
# @see https://api.slack.com/methods/chat.deleteScheduledMessage
|
55
55
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.deleteScheduledMessage.json
|
56
56
|
def chat_deleteScheduledMessage(options = {})
|
57
|
-
|
58
|
-
|
57
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
58
|
+
raise ArgumentError, 'Required arguments :scheduled_message_id missing' if options[:scheduled_message_id].nil?
|
59
59
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
60
60
|
post('chat.deleteScheduledMessage', options)
|
61
61
|
end
|
@@ -70,8 +70,8 @@ module Slack
|
|
70
70
|
# @see https://api.slack.com/methods/chat.getPermalink
|
71
71
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.getPermalink.json
|
72
72
|
def chat_getPermalink(options = {})
|
73
|
-
|
74
|
-
|
73
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
74
|
+
raise ArgumentError, 'Required arguments :message_ts missing' if options[:message_ts].nil?
|
75
75
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
76
76
|
post('chat.getPermalink', options)
|
77
77
|
end
|
@@ -86,8 +86,8 @@ module Slack
|
|
86
86
|
# @see https://api.slack.com/methods/chat.meMessage
|
87
87
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.meMessage.json
|
88
88
|
def chat_meMessage(options = {})
|
89
|
-
|
90
|
-
|
89
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
90
|
+
raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
|
91
91
|
post('chat.meMessage', options)
|
92
92
|
end
|
93
93
|
|
@@ -101,7 +101,7 @@ module Slack
|
|
101
101
|
# @option options [user] :user
|
102
102
|
# id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
|
103
103
|
# @option options [boolean] :as_user
|
104
|
-
# Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.
|
104
|
+
# (Legacy) Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false.
|
105
105
|
# @option options [string] :attachments
|
106
106
|
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
107
107
|
# @option options [blocks[] as string] :blocks
|
@@ -121,9 +121,9 @@ module Slack
|
|
121
121
|
# @see https://api.slack.com/methods/chat.postEphemeral
|
122
122
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
123
123
|
def chat_postEphemeral(options = {})
|
124
|
-
|
125
|
-
|
126
|
-
|
124
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
125
|
+
raise ArgumentError, 'Required arguments :text, :attachments or :blocks missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
|
126
|
+
raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
|
127
127
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
128
128
|
# attachments must be passed as an encoded JSON string
|
129
129
|
if options.key?(:attachments)
|
@@ -152,17 +152,19 @@ module Slack
|
|
152
152
|
# @option options [string] :text
|
153
153
|
# The formatted text of the message to be published. If blocks are included, this will become the fallback text used in notifications.
|
154
154
|
# @option options [boolean] :as_user
|
155
|
-
# Pass true to post the message as the authed user
|
155
|
+
# (Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below.
|
156
156
|
# @option options [string] :icon_emoji
|
157
157
|
# Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
158
158
|
# @option options [string] :icon_url
|
159
159
|
# URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
160
160
|
# @option options [boolean] :link_names
|
161
|
-
# Find and link
|
161
|
+
# Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.
|
162
|
+
# @option options [string] :metadata
|
163
|
+
# 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.
|
162
164
|
# @option options [boolean] :mrkdwn
|
163
165
|
# Disable Slack markup parsing by setting to false. Enabled by default.
|
164
166
|
# @option options [string] :parse
|
165
|
-
# Change how messages are treated.
|
167
|
+
# Change how messages are treated. See below.
|
166
168
|
# @option options [boolean] :reply_broadcast
|
167
169
|
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
168
170
|
# @option options [string] :thread_ts
|
@@ -176,8 +178,8 @@ module Slack
|
|
176
178
|
# @see https://api.slack.com/methods/chat.postMessage
|
177
179
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
|
178
180
|
def chat_postMessage(options = {})
|
179
|
-
|
180
|
-
|
181
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
182
|
+
raise ArgumentError, 'Required arguments :text, :attachments or :blocks missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
|
181
183
|
# attachments must be passed as an encoded JSON string
|
182
184
|
if options.key?(:attachments)
|
183
185
|
attachments = options[:attachments]
|
@@ -203,15 +205,17 @@ module Slack
|
|
203
205
|
# @option options [string] :text
|
204
206
|
# How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
|
205
207
|
# @option options [boolean] :as_user
|
206
|
-
#
|
208
|
+
# Set to true to post the message as the authed user, instead of as a bot. Defaults to false. Cannot be used by new Slack apps. See chat.postMessage.
|
207
209
|
# @option options [string] :attachments
|
208
210
|
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
209
211
|
# @option options [blocks[] as string] :blocks
|
210
212
|
# A JSON-based array of structured blocks, presented as a URL-encoded string.
|
211
213
|
# @option options [boolean] :link_names
|
212
|
-
# Find and link
|
214
|
+
# Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.
|
215
|
+
# @option options [string] :metadata
|
216
|
+
# 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.
|
213
217
|
# @option options [string] :parse
|
214
|
-
# Change how messages are treated.
|
218
|
+
# Change how messages are treated. See chat.postMessage.
|
215
219
|
# @option options [boolean] :reply_broadcast
|
216
220
|
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
217
221
|
# @option options [string] :thread_ts
|
@@ -223,9 +227,9 @@ module Slack
|
|
223
227
|
# @see https://api.slack.com/methods/chat.scheduleMessage
|
224
228
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.scheduleMessage.json
|
225
229
|
def chat_scheduleMessage(options = {})
|
226
|
-
|
227
|
-
|
228
|
-
|
230
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
231
|
+
raise ArgumentError, 'Required arguments :post_at missing' if options[:post_at].nil?
|
232
|
+
raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
|
229
233
|
post('chat.scheduleMessage', options)
|
230
234
|
end
|
231
235
|
|
@@ -253,9 +257,9 @@ module Slack
|
|
253
257
|
# @see https://api.slack.com/methods/chat.unfurl
|
254
258
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.unfurl.json
|
255
259
|
def chat_unfurl(options = {})
|
256
|
-
|
257
|
-
|
258
|
-
|
260
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
261
|
+
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
262
|
+
raise ArgumentError, 'Required arguments :unfurls missing' if options[:unfurls].nil?
|
259
263
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
260
264
|
post('chat.unfurl', options)
|
261
265
|
end
|
@@ -277,6 +281,8 @@ module Slack
|
|
277
281
|
# Array of new file ids that will be sent with this message.
|
278
282
|
# @option options [boolean] :link_names
|
279
283
|
# Find and link channel names and usernames. Defaults to none. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, none.
|
284
|
+
# @option options [string] :metadata
|
285
|
+
# JSON object with event_type and event_payload fields, presented as a URL-encoded string. If you don't include this field, the message's previous metadata will be retained. To remove previous metadata, include an empty object for this field. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.
|
280
286
|
# @option options [string] :parse
|
281
287
|
# Change how messages are treated. Defaults to client, unlike chat.postMessage. Accepts either none or full. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, client.
|
282
288
|
# @option options [boolean] :reply_broadcast
|
@@ -286,9 +292,9 @@ module Slack
|
|
286
292
|
# @see https://api.slack.com/methods/chat.update
|
287
293
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
|
288
294
|
def chat_update(options = {})
|
289
|
-
|
290
|
-
|
291
|
-
|
295
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
296
|
+
raise ArgumentError, 'Required arguments :text, :attachments, :blocks or :reply_broadcast missing' if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil? && options[:reply_broadcast].nil?
|
297
|
+
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
292
298
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
293
299
|
# attachments must be passed as an encoded JSON string
|
294
300
|
if options.key?(:attachments)
|
@@ -19,12 +19,12 @@ module Slack
|
|
19
19
|
# See the shared_channel_invite_received event payload for more details on how to retrieve the ID of the invitation.
|
20
20
|
# @option options [boolean] :is_private
|
21
21
|
# Whether the channel should be private.
|
22
|
-
# @option options [
|
22
|
+
# @option options [Object] :team_id
|
23
23
|
# The ID of the workspace to accept the channel in. If an org-level token is used to call this method, the team_id argument is required.
|
24
24
|
# @see https://api.slack.com/methods/conversations.acceptSharedInvite
|
25
25
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.acceptSharedInvite.json
|
26
26
|
def conversations_acceptSharedInvite(options = {})
|
27
|
-
|
27
|
+
raise ArgumentError, 'Required arguments :channel_name missing' if options[:channel_name].nil?
|
28
28
|
post('conversations.acceptSharedInvite', options)
|
29
29
|
end
|
30
30
|
|
@@ -38,7 +38,7 @@ module Slack
|
|
38
38
|
# @see https://api.slack.com/methods/conversations.approveSharedInvite
|
39
39
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.approveSharedInvite.json
|
40
40
|
def conversations_approveSharedInvite(options = {})
|
41
|
-
|
41
|
+
raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
|
42
42
|
post('conversations.approveSharedInvite', options)
|
43
43
|
end
|
44
44
|
|
@@ -50,7 +50,7 @@ module Slack
|
|
50
50
|
# @see https://api.slack.com/methods/conversations.archive
|
51
51
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.archive.json
|
52
52
|
def conversations_archive(options = {})
|
53
|
-
|
53
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
54
54
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
55
55
|
post('conversations.archive', options)
|
56
56
|
end
|
@@ -63,7 +63,7 @@ module Slack
|
|
63
63
|
# @see https://api.slack.com/methods/conversations.close
|
64
64
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.close.json
|
65
65
|
def conversations_close(options = {})
|
66
|
-
|
66
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
67
67
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
68
68
|
post('conversations.close', options)
|
69
69
|
end
|
@@ -80,7 +80,7 @@ module Slack
|
|
80
80
|
# @see https://api.slack.com/methods/conversations.create
|
81
81
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
|
82
82
|
def conversations_create(options = {})
|
83
|
-
|
83
|
+
raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
|
84
84
|
post('conversations.create', options)
|
85
85
|
end
|
86
86
|
|
@@ -94,7 +94,7 @@ module Slack
|
|
94
94
|
# @see https://api.slack.com/methods/conversations.declineSharedInvite
|
95
95
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.declineSharedInvite.json
|
96
96
|
def conversations_declineSharedInvite(options = {})
|
97
|
-
|
97
|
+
raise ArgumentError, 'Required arguments :invite_id missing' if options[:invite_id].nil?
|
98
98
|
post('conversations.declineSharedInvite', options)
|
99
99
|
end
|
100
100
|
|
@@ -105,18 +105,20 @@ module Slack
|
|
105
105
|
# Conversation ID to fetch history for.
|
106
106
|
# @option options [string] :cursor
|
107
107
|
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
|
108
|
+
# @option options [boolean] :include_all_metadata
|
109
|
+
# Return all metadata associated with this message.
|
108
110
|
# @option options [boolean] :inclusive
|
109
|
-
# Include messages with
|
111
|
+
# Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.
|
110
112
|
# @option options [timestamp] :latest
|
111
|
-
#
|
113
|
+
# Only messages before this Unix timestamp will be included in results. Default is the current time.
|
112
114
|
# @option options [number] :limit
|
113
115
|
# The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
|
114
116
|
# @option options [timestamp] :oldest
|
115
|
-
#
|
117
|
+
# Only messages after this Unix timestamp will be included in results.
|
116
118
|
# @see https://api.slack.com/methods/conversations.history
|
117
119
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.history.json
|
118
120
|
def conversations_history(options = {})
|
119
|
-
|
121
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
120
122
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
121
123
|
if block_given?
|
122
124
|
Pagination::Cursor.new(self, :conversations_history, options).each do |page|
|
@@ -139,7 +141,7 @@ module Slack
|
|
139
141
|
# @see https://api.slack.com/methods/conversations.info
|
140
142
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.info.json
|
141
143
|
def conversations_info(options = {})
|
142
|
-
|
144
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
143
145
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
144
146
|
post('conversations.info', options)
|
145
147
|
end
|
@@ -154,8 +156,8 @@ module Slack
|
|
154
156
|
# @see https://api.slack.com/methods/conversations.invite
|
155
157
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
|
156
158
|
def conversations_invite(options = {})
|
157
|
-
|
158
|
-
|
159
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
160
|
+
raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
|
159
161
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
160
162
|
post('conversations.invite', options)
|
161
163
|
end
|
@@ -174,7 +176,7 @@ module Slack
|
|
174
176
|
# @see https://api.slack.com/methods/conversations.inviteShared
|
175
177
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.inviteShared.json
|
176
178
|
def conversations_inviteShared(options = {})
|
177
|
-
|
179
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
178
180
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
179
181
|
post('conversations.inviteShared', options)
|
180
182
|
end
|
@@ -187,7 +189,7 @@ module Slack
|
|
187
189
|
# @see https://api.slack.com/methods/conversations.join
|
188
190
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.join.json
|
189
191
|
def conversations_join(options = {})
|
190
|
-
|
192
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
191
193
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
192
194
|
post('conversations.join', options)
|
193
195
|
end
|
@@ -202,8 +204,8 @@ module Slack
|
|
202
204
|
# @see https://api.slack.com/methods/conversations.kick
|
203
205
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
|
204
206
|
def conversations_kick(options = {})
|
205
|
-
|
206
|
-
|
207
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
208
|
+
raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
|
207
209
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
208
210
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
209
211
|
post('conversations.kick', options)
|
@@ -217,7 +219,7 @@ module Slack
|
|
217
219
|
# @see https://api.slack.com/methods/conversations.leave
|
218
220
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.leave.json
|
219
221
|
def conversations_leave(options = {})
|
220
|
-
|
222
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
221
223
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
222
224
|
post('conversations.leave', options)
|
223
225
|
end
|
@@ -276,8 +278,8 @@ module Slack
|
|
276
278
|
# @see https://api.slack.com/methods/conversations.mark
|
277
279
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.mark.json
|
278
280
|
def conversations_mark(options = {})
|
279
|
-
|
280
|
-
|
281
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
282
|
+
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
281
283
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
282
284
|
post('conversations.mark', options)
|
283
285
|
end
|
@@ -294,7 +296,7 @@ module Slack
|
|
294
296
|
# @see https://api.slack.com/methods/conversations.members
|
295
297
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.members.json
|
296
298
|
def conversations_members(options = {})
|
297
|
-
|
299
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
298
300
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
299
301
|
if block_given?
|
300
302
|
Pagination::Cursor.new(self, :conversations_members, options).each do |page|
|
@@ -333,8 +335,8 @@ module Slack
|
|
333
335
|
# @see https://api.slack.com/methods/conversations.rename
|
334
336
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.rename.json
|
335
337
|
def conversations_rename(options = {})
|
336
|
-
|
337
|
-
|
338
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
339
|
+
raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
|
338
340
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
339
341
|
post('conversations.rename', options)
|
340
342
|
end
|
@@ -348,19 +350,21 @@ module Slack
|
|
348
350
|
# Unique identifier of either a thread's parent message or a message in the thread. ts must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by ts will return - it is just an ordinary, unthreaded message.
|
349
351
|
# @option options [string] :cursor
|
350
352
|
# Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
|
353
|
+
# @option options [boolean] :include_all_metadata
|
354
|
+
# Return all metadata associated with this message.
|
351
355
|
# @option options [boolean] :inclusive
|
352
|
-
# Include messages with
|
356
|
+
# Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified.
|
353
357
|
# @option options [timestamp] :latest
|
354
|
-
#
|
358
|
+
# Only messages before this Unix timestamp will be included in results.
|
355
359
|
# @option options [number] :limit
|
356
360
|
# The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
|
357
361
|
# @option options [timestamp] :oldest
|
358
|
-
#
|
362
|
+
# Only messages after this Unix timestamp will be included in results.
|
359
363
|
# @see https://api.slack.com/methods/conversations.replies
|
360
364
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.replies.json
|
361
365
|
def conversations_replies(options = {})
|
362
|
-
|
363
|
-
|
366
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
367
|
+
raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
|
364
368
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
365
369
|
if block_given?
|
366
370
|
Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
|
@@ -381,8 +385,8 @@ module Slack
|
|
381
385
|
# @see https://api.slack.com/methods/conversations.setPurpose
|
382
386
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setPurpose.json
|
383
387
|
def conversations_setPurpose(options = {})
|
384
|
-
|
385
|
-
|
388
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
389
|
+
raise ArgumentError, 'Required arguments :purpose missing' if options[:purpose].nil?
|
386
390
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
387
391
|
post('conversations.setPurpose', options)
|
388
392
|
end
|
@@ -397,8 +401,8 @@ module Slack
|
|
397
401
|
# @see https://api.slack.com/methods/conversations.setTopic
|
398
402
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.setTopic.json
|
399
403
|
def conversations_setTopic(options = {})
|
400
|
-
|
401
|
-
|
404
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
405
|
+
raise ArgumentError, 'Required arguments :topic missing' if options[:topic].nil?
|
402
406
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
403
407
|
post('conversations.setTopic', options)
|
404
408
|
end
|
@@ -411,7 +415,7 @@ module Slack
|
|
411
415
|
# @see https://api.slack.com/methods/conversations.unarchive
|
412
416
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.unarchive.json
|
413
417
|
def conversations_unarchive(options = {})
|
414
|
-
|
418
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
415
419
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
416
420
|
post('conversations.unarchive', options)
|
417
421
|
end
|
@@ -16,8 +16,8 @@ module Slack
|
|
16
16
|
# @see https://api.slack.com/methods/dialog.open
|
17
17
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dialog/dialog.open.json
|
18
18
|
def dialog_open(options = {})
|
19
|
-
|
20
|
-
|
19
|
+
raise ArgumentError, 'Required arguments :dialog missing' if options[:dialog].nil?
|
20
|
+
raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil?
|
21
21
|
# dialog must be passed as an encoded JSON string
|
22
22
|
if options.key?(:dialog)
|
23
23
|
dialog = options[:dialog]
|
@@ -59,7 +59,7 @@ module Slack
|
|
59
59
|
# @see https://api.slack.com/methods/dnd.teamInfo
|
60
60
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/dnd/dnd.teamInfo.json
|
61
61
|
def dnd_teamInfo(options = {})
|
62
|
-
|
62
|
+
raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
|
63
63
|
post('dnd.teamInfo', options)
|
64
64
|
end
|
65
65
|
end
|
@@ -9,6 +9,8 @@ module Slack
|
|
9
9
|
#
|
10
10
|
# Lists custom emoji for a team.
|
11
11
|
#
|
12
|
+
# @option options [boolean] :include_categories
|
13
|
+
# Include a list of categories for Unicode emoji and the emoji in each category.
|
12
14
|
# @see https://api.slack.com/methods/emoji.list
|
13
15
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/emoji/emoji.list.json
|
14
16
|
def emoji_list(options = {})
|
@@ -6,6 +6,24 @@ module Slack
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module Files
|
9
|
+
#
|
10
|
+
# Finishes an upload started with files.getUploadURLExternal
|
11
|
+
#
|
12
|
+
# @option options [array] :files
|
13
|
+
# Array of file ids and their corresponding (optional) titles.
|
14
|
+
# @option options [Object] :channel_id
|
15
|
+
# Channel ID where the file will be shared. If not specified the file will be private.
|
16
|
+
# @option options [string] :initial_comment
|
17
|
+
# The message text introducing the file in specified channels.
|
18
|
+
# @option options [string] :thread_ts
|
19
|
+
# Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
|
20
|
+
# @see https://api.slack.com/methods/files.completeUploadExternal
|
21
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
|
22
|
+
def files_completeUploadExternal(options = {})
|
23
|
+
raise ArgumentError, 'Required arguments :files missing' if options[:files].nil?
|
24
|
+
post('files.completeUploadExternal', options)
|
25
|
+
end
|
26
|
+
|
9
27
|
#
|
10
28
|
# Deletes a file.
|
11
29
|
#
|
@@ -14,7 +32,7 @@ module Slack
|
|
14
32
|
# @see https://api.slack.com/methods/files.delete
|
15
33
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.delete.json
|
16
34
|
def files_delete(options = {})
|
17
|
-
|
35
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
18
36
|
post('files.delete', options)
|
19
37
|
end
|
20
38
|
|
@@ -29,12 +47,31 @@ module Slack
|
|
29
47
|
# New filetype of the file. See https://api.slack.com/types/file#file_types for a list of all supported types.
|
30
48
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.edit.json
|
31
49
|
def files_edit(options = {})
|
32
|
-
|
33
|
-
|
50
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
51
|
+
raise ArgumentError, 'Required arguments :title missing' if options[:title].nil?
|
34
52
|
logger.warn('The files.edit method is undocumented.')
|
35
53
|
post('files.edit', options)
|
36
54
|
end
|
37
55
|
|
56
|
+
#
|
57
|
+
# Gets a URL for an edge external file upload
|
58
|
+
#
|
59
|
+
# @option options [string] :filename
|
60
|
+
# Name of the file being uploaded.
|
61
|
+
# @option options [integer] :length
|
62
|
+
# Size in bytes of the file being uploaded.
|
63
|
+
# @option options [string] :alt_txt
|
64
|
+
# Description of image for screen-reader.
|
65
|
+
# @option options [string] :snippet_type
|
66
|
+
# Syntax type of the snippet being uploaded.
|
67
|
+
# @see https://api.slack.com/methods/files.getUploadURLExternal
|
68
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.getUploadURLExternal.json
|
69
|
+
def files_getUploadURLExternal(options = {})
|
70
|
+
raise ArgumentError, 'Required arguments :filename missing' if options[:filename].nil?
|
71
|
+
raise ArgumentError, 'Required arguments :length missing' if options[:length].nil?
|
72
|
+
post('files.getUploadURLExternal', options)
|
73
|
+
end
|
74
|
+
|
38
75
|
#
|
39
76
|
# Gets information about a file.
|
40
77
|
#
|
@@ -47,7 +84,7 @@ module Slack
|
|
47
84
|
# @see https://api.slack.com/methods/files.info
|
48
85
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
|
49
86
|
def files_info(options = {})
|
50
|
-
|
87
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
51
88
|
if block_given?
|
52
89
|
Pagination::Cursor.new(self, :files_info, options).each do |page|
|
53
90
|
yield page
|
@@ -62,8 +99,6 @@ module Slack
|
|
62
99
|
#
|
63
100
|
# @option options [channel] :channel
|
64
101
|
# Filter files appearing in a specific channel, indicated by its ID.
|
65
|
-
# @option options [string] :files
|
66
|
-
# .
|
67
102
|
# @option options [boolean] :show_files_hidden_by_limit
|
68
103
|
# Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.
|
69
104
|
# @option options [string] :team_id
|
@@ -92,7 +127,7 @@ module Slack
|
|
92
127
|
# @see https://api.slack.com/methods/files.revokePublicURL
|
93
128
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.revokePublicURL.json
|
94
129
|
def files_revokePublicURL(options = {})
|
95
|
-
|
130
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
96
131
|
post('files.revokePublicURL', options)
|
97
132
|
end
|
98
133
|
|
@@ -105,8 +140,8 @@ module Slack
|
|
105
140
|
# Channel to share the file in. Works with both public (channel ID) and private channels (group ID).
|
106
141
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/files/files.share.json
|
107
142
|
def files_share(options = {})
|
108
|
-
|
109
|
-
|
143
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
144
|
+
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
|
110
145
|
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
111
146
|
logger.warn('The files.share method is undocumented.')
|
112
147
|
post('files.share', options)
|
@@ -120,7 +155,7 @@ module Slack
|
|
120
155
|
# @see https://api.slack.com/methods/files.sharedPublicURL
|
121
156
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.sharedPublicURL.json
|
122
157
|
def files_sharedPublicURL(options = {})
|
123
|
-
|
158
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
124
159
|
post('files.sharedPublicURL', options)
|
125
160
|
end
|
126
161
|
|
@@ -16,8 +16,8 @@ module Slack
|
|
16
16
|
# @see https://api.slack.com/methods/files.comments.delete
|
17
17
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files.comments/files.comments.delete.json
|
18
18
|
def files_comments_delete(options = {})
|
19
|
-
|
20
|
-
|
19
|
+
raise ArgumentError, 'Required arguments :file missing' if options[:file].nil?
|
20
|
+
raise ArgumentError, 'Required arguments :id missing' if options[:id].nil?
|
21
21
|
post('files.comments.delete', options)
|
22
22
|
end
|
23
23
|
end
|