slack-ruby-client 0.7.9 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +1 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +32 -1
- data/.rubocop_todo.yml +98 -49
- data/.travis.yml +10 -14
- data/CHANGELOG.md +172 -24
- data/CONTRIBUTING.md +17 -6
- data/Dangerfile +2 -0
- data/Gemfile +10 -4
- data/LICENSE.md +1 -1
- data/README.md +276 -54
- data/RELEASING.md +19 -11
- data/Rakefile +2 -1
- data/UPGRADING.md +84 -2
- data/bin/commands.rb +43 -1
- data/bin/commands/admin_analytics.rb +15 -0
- data/bin/commands/admin_apps.rb +40 -0
- data/bin/commands/admin_apps_approved.rb +17 -0
- data/bin/commands/admin_apps_requests.rb +16 -0
- data/bin/commands/admin_apps_restricted.rb +17 -0
- data/bin/commands/admin_barriers.rb +47 -0
- data/bin/commands/admin_conversations.rb +169 -0
- data/bin/commands/admin_conversations_ekm.rb +17 -0
- data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
- data/bin/commands/admin_conversations_whitelist.rb +37 -0
- data/bin/commands/admin_emoji.rb +54 -0
- data/bin/commands/admin_inviteRequests.rb +36 -0
- data/bin/commands/admin_inviteRequests_approved.rb +16 -0
- data/bin/commands/admin_inviteRequests_denied.rb +16 -0
- data/bin/commands/admin_teams.rb +27 -0
- data/bin/commands/admin_teams_admins.rb +16 -0
- data/bin/commands/admin_teams_owners.rb +16 -0
- data/bin/commands/admin_teams_settings.rb +64 -0
- data/bin/commands/admin_usergroups.rb +48 -0
- data/bin/commands/admin_users.rb +97 -0
- data/bin/commands/admin_users_session.rb +38 -0
- data/bin/commands/api.rb +3 -3
- data/bin/commands/apps.rb +15 -0
- data/bin/commands/apps_connections.rb +13 -0
- data/bin/commands/apps_event_authorizations.rb +16 -0
- data/bin/commands/apps_permissions.rb +23 -0
- data/bin/commands/apps_permissions_resources.rb +15 -0
- data/bin/commands/apps_permissions_scopes.rb +13 -0
- data/bin/commands/apps_permissions_users.rb +26 -0
- data/bin/commands/auth.rb +5 -4
- data/bin/commands/auth_teams.rb +16 -0
- data/bin/commands/bots.rb +4 -2
- data/bin/commands/calls.rb +52 -0
- data/bin/commands/calls_participants.rb +25 -0
- data/bin/commands/channels.rb +64 -43
- data/bin/commands/chat.rb +114 -24
- data/bin/commands/chat_scheduledMessages.rb +19 -0
- data/bin/commands/conversations.rb +196 -0
- data/bin/commands/dialog.rb +15 -0
- data/bin/commands/dnd.rb +9 -8
- data/bin/commands/emoji.rb +3 -2
- data/bin/commands/files.rb +45 -30
- data/bin/commands/files_comments.rb +3 -24
- data/bin/commands/files_remote.rb +78 -0
- data/bin/commands/groups.rb +53 -53
- data/bin/commands/im.rb +17 -13
- data/bin/commands/migration.rb +16 -0
- data/bin/commands/mpim.rb +16 -13
- data/bin/commands/oauth.rb +17 -2
- data/bin/commands/oauth_v2.rb +17 -0
- data/bin/commands/pins.rb +7 -10
- data/bin/commands/reactions.rb +17 -15
- data/bin/commands/reminders.rb +11 -10
- data/bin/commands/rtm.rb +19 -4
- data/bin/commands/search.rb +15 -11
- data/bin/commands/stars.rb +11 -8
- data/bin/commands/team.rb +15 -10
- data/bin/commands/team_profile.rb +3 -2
- data/bin/commands/usergroups.rb +22 -16
- data/bin/commands/usergroups_users.rb +7 -4
- data/bin/commands/users.rb +65 -37
- data/bin/commands/users_admin.rb +29 -0
- data/bin/commands/users_prefs.rb +13 -0
- data/bin/commands/users_profile.rb +8 -7
- data/bin/commands/views.rb +48 -0
- data/bin/commands/workflows.rb +38 -0
- data/bin/slack +3 -4
- data/examples/hi_real_time_and_web/Gemfile +1 -0
- data/examples/hi_real_time_and_web/hi.rb +8 -4
- data/examples/{hi_real_time_async_eventmachine → hi_real_time_async_async}/Gemfile +2 -1
- data/examples/{hi_real_time_async_celluloid → hi_real_time_async_async}/Procfile +0 -0
- data/examples/{hi_real_time_async_celluloid → hi_real_time_async_async}/hi.rb +13 -8
- data/examples/hi_web/Gemfile +1 -0
- data/examples/hi_web/hi.rb +2 -1
- data/examples/new_ticket/Gemfile +1 -0
- data/examples/new_ticket/new_ticket.rb +2 -1
- data/lib/slack-ruby-client.rb +40 -26
- data/lib/slack.rb +1 -0
- data/lib/slack/config.rb +1 -0
- data/lib/slack/events/config.rb +32 -0
- data/lib/slack/events/request.rb +70 -0
- data/lib/slack/logger.rb +6 -5
- data/lib/slack/messages/formatting.rb +4 -4
- data/lib/slack/messages/message.rb +2 -6
- data/lib/slack/real_time/api/message.rb +3 -1
- data/lib/slack/real_time/api/message_id.rb +1 -0
- data/lib/slack/real_time/api/ping.rb +5 -2
- data/lib/slack/real_time/api/templates/event_handler.erb +1 -1
- data/lib/slack/real_time/api/typing.rb +3 -1
- data/lib/slack/real_time/client.rb +113 -32
- data/lib/slack/real_time/concurrency.rb +2 -2
- data/lib/slack/real_time/concurrency/async.rb +140 -0
- data/lib/slack/real_time/config.rb +20 -12
- data/lib/slack/real_time/models.rb +8 -7
- data/lib/slack/real_time/models/base.rb +2 -6
- data/lib/slack/real_time/models/bot.rb +1 -0
- data/lib/slack/real_time/models/channel.rb +1 -0
- data/lib/slack/real_time/models/group.rb +1 -0
- data/lib/slack/real_time/models/im.rb +1 -0
- data/lib/slack/real_time/models/team.rb +1 -0
- data/lib/slack/real_time/models/user.rb +1 -0
- data/lib/slack/real_time/socket.rb +46 -17
- data/lib/slack/real_time/stores.rb +4 -3
- data/lib/slack/real_time/stores/base.rb +5 -3
- data/lib/slack/real_time/stores/starter.rb +113 -72
- data/lib/slack/real_time/stores/store.rb +131 -88
- data/lib/slack/version.rb +2 -1
- data/lib/slack/web/api/endpoints.rb +110 -26
- data/lib/slack/web/api/endpoints/admin_analytics.rb +26 -0
- data/lib/slack/web/api/endpoints/admin_apps.rb +62 -0
- data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_apps_requests.rb +33 -0
- data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
- data/lib/slack/web/api/endpoints/admin_conversations.rb +260 -0
- data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
- data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
- data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
- data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
- data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
- data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
- data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
- data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
- data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
- data/lib/slack/web/api/endpoints/admin_users_session.rb +66 -0
- data/lib/slack/web/api/endpoints/api.rb +3 -4
- data/lib/slack/web/api/endpoints/apps.rb +27 -0
- data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
- data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
- data/lib/slack/web/api/endpoints/apps_permissions.rb +36 -0
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +31 -0
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +21 -0
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +50 -0
- data/lib/slack/web/api/endpoints/auth.rb +5 -4
- data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
- data/lib/slack/web/api/endpoints/bots.rb +5 -2
- data/lib/slack/web/api/endpoints/calls.rb +83 -0
- data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
- data/lib/slack/web/api/endpoints/channels.rb +105 -49
- data/lib/slack/web/api/endpoints/chat.rb +221 -40
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +40 -0
- data/lib/slack/web/api/endpoints/conversations.rb +332 -0
- data/lib/slack/web/api/endpoints/dialog.rb +33 -0
- data/lib/slack/web/api/endpoints/dnd.rb +11 -9
- data/lib/slack/web/api/endpoints/emoji.rb +3 -2
- data/lib/slack/web/api/endpoints/files.rb +75 -38
- data/lib/slack/web/api/endpoints/files_comments.rb +3 -38
- data/lib/slack/web/api/endpoints/files_remote.rb +127 -0
- data/lib/slack/web/api/endpoints/groups.rb +76 -53
- data/lib/slack/web/api/endpoints/im.rb +38 -21
- data/lib/slack/web/api/endpoints/migration.rb +28 -0
- data/lib/slack/web/api/endpoints/mpim.rb +37 -22
- data/lib/slack/web/api/endpoints/oauth.rb +25 -4
- data/lib/slack/web/api/endpoints/oauth_v2.rb +30 -0
- data/lib/slack/web/api/endpoints/pins.rb +10 -19
- data/lib/slack/web/api/endpoints/presence.rb +1 -1
- data/lib/slack/web/api/endpoints/reactions.rb +37 -28
- data/lib/slack/web/api/endpoints/reminders.rb +11 -10
- data/lib/slack/web/api/endpoints/rtm.rb +28 -7
- data/lib/slack/web/api/endpoints/search.rb +21 -14
- data/lib/slack/web/api/endpoints/stars.rb +24 -15
- data/lib/slack/web/api/endpoints/team.rb +21 -13
- data/lib/slack/web/api/endpoints/team_profile.rb +3 -2
- data/lib/slack/web/api/endpoints/usergroups.rb +33 -22
- data/lib/slack/web/api/endpoints/usergroups_users.rb +9 -4
- data/lib/slack/web/api/endpoints/users.rb +78 -29
- data/lib/slack/web/api/endpoints/users_admin.rb +49 -0
- data/lib/slack/web/api/endpoints/users_prefs.rb +21 -0
- data/lib/slack/web/api/endpoints/users_profile.rb +11 -10
- data/lib/slack/web/api/endpoints/views.rb +97 -0
- data/lib/slack/web/api/endpoints/workflows.rb +61 -0
- data/lib/slack/web/api/error.rb +2 -8
- data/lib/slack/web/api/errors.rb +850 -0
- data/lib/slack/web/api/errors/internal_error.rb +14 -0
- data/lib/slack/web/api/errors/slack_error.rb +29 -0
- data/lib/slack/web/api/errors/too_many_requests_error.rb +24 -0
- data/lib/slack/web/api/mixins.rb +6 -4
- data/lib/slack/web/api/mixins/channels.id.rb +6 -7
- data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
- data/lib/slack/web/api/mixins/groups.id.rb +6 -7
- data/lib/slack/web/api/mixins/ids.id.rb +24 -0
- data/lib/slack/web/api/mixins/users.id.rb +6 -7
- data/lib/slack/web/api/mixins/users.search.rb +39 -36
- data/lib/slack/web/api/patches/chat.1.patch +72 -0
- data/lib/slack/web/api/patches/dialog.1.open-json-support.patch +17 -0
- data/lib/slack/web/api/patches/views.1.view-json.patch +40 -0
- data/lib/slack/web/api/patches/views.1.views-published.patch +16 -0
- data/lib/slack/web/api/templates/command.erb +5 -3
- data/lib/slack/web/api/templates/commands.erb +2 -1
- data/lib/slack/web/api/templates/endpoints.erb +5 -3
- data/lib/slack/web/api/templates/errors.erb +20 -0
- data/lib/slack/web/api/templates/method.erb +26 -4
- data/lib/slack/web/api/templates/method_spec.erb +3 -2
- data/lib/slack/web/client.rb +2 -1
- data/lib/slack/web/config.rb +21 -10
- data/lib/slack/web/faraday/connection.rb +25 -16
- data/lib/slack/web/faraday/request.rb +2 -0
- data/lib/slack/web/faraday/response/raise_error.rb +23 -1
- data/lib/slack/web/faraday/response/wrap_error.rb +18 -0
- data/lib/slack/web/pagination/cursor.rb +52 -0
- data/lib/slack_ruby_client.rb +1 -0
- data/lib/tasks/git.rake +2 -1
- data/lib/tasks/real_time.rake +16 -6
- data/lib/tasks/update.rake +1 -0
- data/lib/tasks/web.rake +38 -10
- data/screenshots/create-app.png +0 -0
- data/slack-ruby-client.gemspec +9 -6
- data/spec/fixtures/slack/web/429_error.yml +2 -0
- data/spec/fixtures/slack/web/503_error.yml +14 -0
- data/spec/fixtures/slack/web/channels_info.yml +108 -15
- data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
- data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
- data/spec/fixtures/slack/web/rtm_connect.yml +70 -0
- data/spec/fixtures/slack/web/rtm_start.yml +1 -1
- data/spec/fixtures/slack/web/views_open_error.yml +76 -0
- data/spec/integration/integration_spec.rb +116 -48
- data/spec/slack/config_spec.rb +2 -0
- data/spec/slack/events/config_spec.rb +33 -0
- data/spec/slack/events/request_spec.rb +183 -0
- data/spec/slack/messages/formatting_spec.rb +25 -14
- data/spec/slack/real_time/api/message_spec.rb +6 -1
- data/spec/slack/real_time/api/ping_spec.rb +2 -0
- data/spec/slack/real_time/api/typing_spec.rb +5 -1
- data/spec/slack/real_time/client_spec.rb +462 -134
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +3 -1
- data/spec/slack/real_time/event_handlers/bot_spec.rb +6 -3
- data/spec/slack/real_time/event_handlers/channel_spec.rb +9 -6
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +3 -2
- data/spec/slack/real_time/event_handlers/group_spec.rb +5 -4
- data/spec/slack/real_time/event_handlers/im_spec.rb +4 -3
- data/spec/slack/real_time/event_handlers/team_spec.rb +8 -4
- data/spec/slack/real_time/event_handlers/user_spec.rb +5 -2
- data/spec/slack/real_time/rtm_connect_spec.rb +14 -0
- data/spec/slack/real_time/rtm_start_spec.rb +1 -0
- data/spec/slack/real_time/store_spec.rb +2 -1
- data/spec/slack/slack_spec.rb +39 -7
- data/spec/slack/version_spec.rb +2 -1
- data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
- data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +98 -0
- data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +32 -0
- data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
- data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
- data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +21 -0
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
- data/spec/slack/web/api/endpoints/api_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +16 -0
- data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +19 -0
- data/spec/slack/web/api/endpoints/apps_spec.rb +16 -0
- data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/bots_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
- data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
- data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/conversations_spec.rb +109 -0
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +13 -4
- data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +5 -3
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +140 -24
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +36 -0
- data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +2 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +21 -6
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +95 -0
- data/spec/slack/web/api/endpoints/dnd_spec.rb +6 -0
- data/spec/slack/web/api/endpoints/emoji_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +3 -21
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +24 -0
- data/spec/slack/web/api/endpoints/files_spec.rb +17 -5
- data/spec/slack/web/api/endpoints/im_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/migration_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/mpim_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/oauth_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/pins_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/reactions_spec.rb +8 -1
- data/spec/slack/web/api/endpoints/reminders_spec.rb +3 -2
- data/spec/slack/web/api/endpoints/rtm_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/search_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/stars_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/team_profile_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/team_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/usergroups_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +3 -2
- data/spec/slack/web/api/endpoints/users_admin_spec.rb +18 -0
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +8 -0
- data/spec/slack/web/api/endpoints/users_profile_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/views_spec.rb +29 -0
- data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
- data/spec/slack/web/api/error_spec.rb +5 -3
- data/spec/slack/web/api/errors/slack_error_spec.rb +38 -0
- data/spec/slack/web/api/mixins/channels_spec.rb +24 -12
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
- data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
- data/spec/slack/web/api/mixins/groups_spec.rb +24 -12
- data/spec/slack/web/api/mixins/users_spec.rb +30 -17
- data/spec/slack/web/api/pagination/cursor_spec.rb +100 -0
- data/spec/slack/web/client_spec.rb +215 -14
- data/spec/slack/web/faraday/response/raise_error_spec.rb +85 -0
- data/spec/spec_helper.rb +8 -1
- data/spec/support/queue_with_timeout.rb +6 -5
- data/spec/support/real_time/concurrency/mock.rb +2 -2
- data/spec/support/real_time/connected_client.rb +13 -2
- data/spec/support/real_time/event.rb +1 -0
- data/spec/support/token.rb +1 -0
- data/spec/support/vcr.rb +6 -1
- metadata +280 -55
- data/examples/hi_real_time/Gemfile +0 -5
- data/examples/hi_real_time/hi.gif +0 -0
- data/examples/hi_real_time/hi.rb +0 -37
- data/examples/hi_real_time_async_celluloid/Gemfile +0 -6
- data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
- data/examples/hi_real_time_async_eventmachine/hi.rb +0 -36
- data/lib/slack/real_time/concurrency/celluloid.rb +0 -113
- data/lib/slack/real_time/concurrency/eventmachine.rb +0 -60
- data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
- data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
- data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -20
- data/screenshots/register-bot.png +0 -0
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -31
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -47
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# This file was auto-generated by lib/tasks/web.rake
|
3
|
+
|
4
|
+
module Slack
|
5
|
+
module Web
|
6
|
+
module Api
|
7
|
+
module Endpoints
|
8
|
+
module CallsParticipants
|
9
|
+
#
|
10
|
+
# Registers new participants added to a Call.
|
11
|
+
#
|
12
|
+
# @option options [Object] :id
|
13
|
+
# id returned by the calls.add method.
|
14
|
+
# @option options [Object] :users
|
15
|
+
# The list of users to add as participants in the Call. Read more on how to specify users here.
|
16
|
+
# @see https://api.slack.com/methods/calls.participants.add
|
17
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.add.json
|
18
|
+
def calls_participants_add(options = {})
|
19
|
+
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
|
20
|
+
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
|
21
|
+
post('calls.participants.add', options)
|
22
|
+
end
|
23
|
+
|
24
|
+
#
|
25
|
+
# Registers participants removed from a Call.
|
26
|
+
#
|
27
|
+
# @option options [Object] :id
|
28
|
+
# id returned by the calls.add method.
|
29
|
+
# @option options [Object] :users
|
30
|
+
# The list of users to remove as participants in the Call. Read more on how to specify users here.
|
31
|
+
# @see https://api.slack.com/methods/calls.participants.remove
|
32
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/calls.participants/calls.participants.remove.json
|
33
|
+
def calls_participants_remove(options = {})
|
34
|
+
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
|
35
|
+
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
|
36
|
+
post('calls.participants.remove', options)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# This file was auto-generated by lib/tasks/web.rake
|
2
3
|
|
3
4
|
module Slack
|
@@ -6,225 +7,280 @@ module Slack
|
|
6
7
|
module Endpoints
|
7
8
|
module Channels
|
8
9
|
#
|
9
|
-
#
|
10
|
+
# Archives a channel.
|
10
11
|
#
|
11
12
|
# @option options [channel] :channel
|
12
13
|
# Channel to archive.
|
13
14
|
# @see https://api.slack.com/methods/channels.archive
|
14
|
-
# @see https://github.com/
|
15
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.archive.json
|
15
16
|
def channels_archive(options = {})
|
16
17
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
17
|
-
options = options.merge(channel:
|
18
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
19
|
+
logger.warn('channels.archive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.archive.')
|
18
20
|
post('channels.archive', options)
|
19
21
|
end
|
20
22
|
|
21
23
|
#
|
22
|
-
#
|
24
|
+
# Creates a channel.
|
23
25
|
#
|
24
26
|
# @option options [Object] :name
|
25
27
|
# Name of channel to create.
|
28
|
+
# @option options [Object] :team_id
|
29
|
+
# encoded team id to create the channel in, required if org token is used.
|
30
|
+
# @option options [Object] :validate
|
31
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
26
32
|
# @see https://api.slack.com/methods/channels.create
|
27
|
-
# @see https://github.com/
|
33
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.create.json
|
28
34
|
def channels_create(options = {})
|
29
35
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
36
|
+
logger.warn('channels.create: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.create.')
|
30
37
|
post('channels.create', options)
|
31
38
|
end
|
32
39
|
|
33
40
|
#
|
34
|
-
#
|
41
|
+
# Delete a channel (undocumented)
|
42
|
+
#
|
43
|
+
# @option options [channel] :channel
|
44
|
+
# Channel to delete.
|
45
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/channels/channels.delete.json
|
46
|
+
def channels_delete(options = {})
|
47
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
48
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
49
|
+
logger.warn('The channels.delete method is undocumented.')
|
50
|
+
post('channels.delete', options)
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Fetches history of messages and events from a channel.
|
35
55
|
#
|
36
56
|
# @option options [channel] :channel
|
37
57
|
# Channel to fetch history for.
|
58
|
+
# @option options [Object] :inclusive
|
59
|
+
# Include messages with latest or oldest timestamp in results.
|
38
60
|
# @option options [timestamp] :latest
|
39
61
|
# End of time range of messages to include in results.
|
40
62
|
# @option options [timestamp] :oldest
|
41
63
|
# Start of time range of messages to include in results.
|
42
|
-
# @option options [Object] :inclusive
|
43
|
-
# Include messages with latest or oldest timestamp in results.
|
44
64
|
# @option options [Object] :unreads
|
45
65
|
# Include unread_count_display in the output?.
|
46
66
|
# @see https://api.slack.com/methods/channels.history
|
47
|
-
# @see https://github.com/
|
67
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.history.json
|
48
68
|
def channels_history(options = {})
|
49
69
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
50
|
-
options = options.merge(channel:
|
70
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
71
|
+
logger.warn('channels.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
|
51
72
|
post('channels.history', options)
|
52
73
|
end
|
53
74
|
|
54
75
|
#
|
55
|
-
#
|
76
|
+
# Gets information about a channel.
|
56
77
|
#
|
57
78
|
# @option options [channel] :channel
|
58
79
|
# Channel to get info on.
|
80
|
+
# @option options [Object] :include_locale
|
81
|
+
# Set this to true to receive the locale for this channel. Defaults to false.
|
59
82
|
# @see https://api.slack.com/methods/channels.info
|
60
|
-
# @see https://github.com/
|
83
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.info.json
|
61
84
|
def channels_info(options = {})
|
62
85
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
63
|
-
options = options.merge(channel:
|
86
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
87
|
+
logger.warn('channels.info: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.info.')
|
64
88
|
post('channels.info', options)
|
65
89
|
end
|
66
90
|
|
67
91
|
#
|
68
|
-
#
|
92
|
+
# Invites a user to a channel.
|
69
93
|
#
|
70
94
|
# @option options [channel] :channel
|
71
95
|
# Channel to invite user to.
|
72
96
|
# @option options [user] :user
|
73
97
|
# User to invite to channel.
|
74
98
|
# @see https://api.slack.com/methods/channels.invite
|
75
|
-
# @see https://github.com/
|
99
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.invite.json
|
76
100
|
def channels_invite(options = {})
|
77
101
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
78
102
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
79
|
-
options = options.merge(channel:
|
103
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
80
104
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
105
|
+
logger.warn('channels.invite: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.invite.')
|
81
106
|
post('channels.invite', options)
|
82
107
|
end
|
83
108
|
|
84
109
|
#
|
85
|
-
#
|
86
|
-
# created.
|
110
|
+
# Joins a channel, creating it if needed.
|
87
111
|
#
|
88
112
|
# @option options [Object] :name
|
89
113
|
# Name of channel to join.
|
114
|
+
# @option options [Object] :team_id
|
115
|
+
# encoded team id to list channels in, required if org token is used.
|
116
|
+
# @option options [Object] :validate
|
117
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
90
118
|
# @see https://api.slack.com/methods/channels.join
|
91
|
-
# @see https://github.com/
|
119
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.join.json
|
92
120
|
def channels_join(options = {})
|
93
121
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
122
|
+
logger.warn('channels.join: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.join.')
|
94
123
|
post('channels.join', options)
|
95
124
|
end
|
96
125
|
|
97
126
|
#
|
98
|
-
#
|
127
|
+
# Removes a user from a channel.
|
99
128
|
#
|
100
129
|
# @option options [channel] :channel
|
101
130
|
# Channel to remove user from.
|
102
131
|
# @option options [user] :user
|
103
132
|
# User to remove from channel.
|
104
133
|
# @see https://api.slack.com/methods/channels.kick
|
105
|
-
# @see https://github.com/
|
134
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.kick.json
|
106
135
|
def channels_kick(options = {})
|
107
136
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
108
137
|
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
109
|
-
options = options.merge(channel:
|
138
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
110
139
|
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
140
|
+
logger.warn('channels.kick: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.kick.')
|
111
141
|
post('channels.kick', options)
|
112
142
|
end
|
113
143
|
|
114
144
|
#
|
115
|
-
#
|
145
|
+
# Leaves a channel.
|
116
146
|
#
|
117
147
|
# @option options [channel] :channel
|
118
148
|
# Channel to leave.
|
119
149
|
# @see https://api.slack.com/methods/channels.leave
|
120
|
-
# @see https://github.com/
|
150
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.leave.json
|
121
151
|
def channels_leave(options = {})
|
122
152
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
123
|
-
options = options.merge(channel:
|
153
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
154
|
+
logger.warn('channels.leave: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.leave.')
|
124
155
|
post('channels.leave', options)
|
125
156
|
end
|
126
157
|
|
127
158
|
#
|
128
|
-
#
|
159
|
+
# Lists all channels in a Slack team.
|
129
160
|
#
|
161
|
+
# @option options [Object] :cursor
|
162
|
+
# 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.
|
130
163
|
# @option options [Object] :exclude_archived
|
131
|
-
#
|
164
|
+
# Exclude archived channels from the list.
|
165
|
+
# @option options [Object] :exclude_members
|
166
|
+
# Exclude the members collection from each channel.
|
167
|
+
# @option options [Object] :limit
|
168
|
+
# 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.
|
169
|
+
# @option options [Object] :team_id
|
170
|
+
# encoded team id to list channels in, required if org token is used.
|
132
171
|
# @see https://api.slack.com/methods/channels.list
|
133
|
-
# @see https://github.com/
|
172
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.list.json
|
134
173
|
def channels_list(options = {})
|
135
|
-
|
174
|
+
logger.warn('channels.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
|
175
|
+
if block_given?
|
176
|
+
Pagination::Cursor.new(self, :channels_list, options).each do |page|
|
177
|
+
yield page
|
178
|
+
end
|
179
|
+
else
|
180
|
+
post('channels.list', options)
|
181
|
+
end
|
136
182
|
end
|
137
183
|
|
138
184
|
#
|
139
|
-
#
|
185
|
+
# Sets the read cursor in a channel.
|
140
186
|
#
|
141
187
|
# @option options [channel] :channel
|
142
|
-
# Channel to set
|
188
|
+
# Channel or conversation to set the read cursor for.
|
143
189
|
# @option options [timestamp] :ts
|
144
|
-
#
|
190
|
+
# Unique identifier of message you want marked as most recently seen in this conversation.
|
145
191
|
# @see https://api.slack.com/methods/channels.mark
|
146
|
-
# @see https://github.com/
|
192
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.mark.json
|
147
193
|
def channels_mark(options = {})
|
148
194
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
149
195
|
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
150
|
-
options = options.merge(channel:
|
196
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
197
|
+
logger.warn('channels.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.')
|
151
198
|
post('channels.mark', options)
|
152
199
|
end
|
153
200
|
|
154
201
|
#
|
155
|
-
#
|
202
|
+
# Renames a channel.
|
156
203
|
#
|
157
204
|
# @option options [channel] :channel
|
158
205
|
# Channel to rename.
|
159
206
|
# @option options [Object] :name
|
160
207
|
# New name for channel.
|
208
|
+
# @option options [Object] :validate
|
209
|
+
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
161
210
|
# @see https://api.slack.com/methods/channels.rename
|
162
|
-
# @see https://github.com/
|
211
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.rename.json
|
163
212
|
def channels_rename(options = {})
|
164
213
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
165
214
|
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
166
|
-
options = options.merge(channel:
|
215
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
216
|
+
logger.warn('channels.rename: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.rename.')
|
167
217
|
post('channels.rename', options)
|
168
218
|
end
|
169
219
|
|
170
220
|
#
|
171
|
-
#
|
221
|
+
# Retrieve a thread of messages posted to a channel
|
172
222
|
#
|
173
223
|
# @option options [channel] :channel
|
174
224
|
# Channel to fetch thread from.
|
175
225
|
# @option options [Object] :thread_ts
|
176
226
|
# Unique identifier of a thread's parent message.
|
177
227
|
# @see https://api.slack.com/methods/channels.replies
|
178
|
-
# @see https://github.com/
|
228
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.replies.json
|
179
229
|
def channels_replies(options = {})
|
180
230
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
181
231
|
throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
|
182
|
-
options = options.merge(channel:
|
232
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
233
|
+
logger.warn('channels.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
|
183
234
|
post('channels.replies', options)
|
184
235
|
end
|
185
236
|
|
186
237
|
#
|
187
|
-
#
|
238
|
+
# Sets the purpose for a channel.
|
188
239
|
#
|
189
240
|
# @option options [channel] :channel
|
190
241
|
# Channel to set the purpose of.
|
191
242
|
# @option options [Object] :purpose
|
192
243
|
# The new purpose.
|
244
|
+
# @option options [Object] :name_tagging
|
245
|
+
# if it is true, treat this like a message and not an unescaped thing.
|
193
246
|
# @see https://api.slack.com/methods/channels.setPurpose
|
194
|
-
# @see https://github.com/
|
247
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.setPurpose.json
|
195
248
|
def channels_setPurpose(options = {})
|
196
249
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
197
250
|
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
198
|
-
options = options.merge(channel:
|
251
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
252
|
+
logger.warn('channels.setPurpose: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setPurpose.')
|
199
253
|
post('channels.setPurpose', options)
|
200
254
|
end
|
201
255
|
|
202
256
|
#
|
203
|
-
#
|
257
|
+
# Sets the topic for a channel.
|
204
258
|
#
|
205
259
|
# @option options [channel] :channel
|
206
260
|
# Channel to set the topic of.
|
207
261
|
# @option options [Object] :topic
|
208
262
|
# The new topic.
|
209
263
|
# @see https://api.slack.com/methods/channels.setTopic
|
210
|
-
# @see https://github.com/
|
264
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.setTopic.json
|
211
265
|
def channels_setTopic(options = {})
|
212
266
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
213
267
|
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
214
|
-
options = options.merge(channel:
|
268
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
269
|
+
logger.warn('channels.setTopic: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setTopic.')
|
215
270
|
post('channels.setTopic', options)
|
216
271
|
end
|
217
272
|
|
218
273
|
#
|
219
|
-
#
|
274
|
+
# Unarchives a channel.
|
220
275
|
#
|
221
276
|
# @option options [channel] :channel
|
222
277
|
# Channel to unarchive.
|
223
278
|
# @see https://api.slack.com/methods/channels.unarchive
|
224
|
-
# @see https://github.com/
|
279
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.unarchive.json
|
225
280
|
def channels_unarchive(options = {})
|
226
281
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
227
|
-
options = options.merge(channel:
|
282
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
283
|
+
logger.warn('channels.unarchive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.unarchive.')
|
228
284
|
post('channels.unarchive', options)
|
229
285
|
end
|
230
286
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# This file was auto-generated by lib/tasks/web.rake
|
2
3
|
|
3
4
|
module Slack
|
@@ -6,32 +7,84 @@ module Slack
|
|
6
7
|
module Endpoints
|
7
8
|
module Chat
|
8
9
|
#
|
9
|
-
#
|
10
|
+
# Execute a slash command in a public channel (undocumented)
|
11
|
+
#
|
12
|
+
# @option options [channel] :channel
|
13
|
+
# Channel to execute the command in.
|
14
|
+
# @option options [Object] :command
|
15
|
+
# Slash command to be executed. Leading backslash is required.
|
16
|
+
# @option options [Object] :text
|
17
|
+
# Additional parameters provided to the slash command.
|
18
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/chat/chat.command.json
|
19
|
+
def chat_command(options = {})
|
20
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
21
|
+
throw ArgumentError.new('Required arguments :command missing') if options[:command].nil?
|
22
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
23
|
+
logger.warn('The chat.command method is undocumented.')
|
24
|
+
post('chat.command', options)
|
25
|
+
end
|
26
|
+
|
27
|
+
#
|
28
|
+
# Deletes a message.
|
10
29
|
#
|
11
|
-
# @option options [timestamp] :ts
|
12
|
-
# Timestamp of the message to be deleted.
|
13
30
|
# @option options [channel] :channel
|
14
31
|
# Channel containing the message to be deleted.
|
32
|
+
# @option options [timestamp] :ts
|
33
|
+
# Timestamp of the message to be deleted.
|
15
34
|
# @option options [Object] :as_user
|
16
|
-
# Pass true to delete the message as the authed user. Bot users in this context are considered authed users.
|
35
|
+
# Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.
|
17
36
|
# @see https://api.slack.com/methods/chat.delete
|
18
|
-
# @see https://github.com/
|
37
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.delete.json
|
19
38
|
def chat_delete(options = {})
|
20
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
21
39
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
22
|
-
|
40
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
41
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
23
42
|
post('chat.delete', options)
|
24
43
|
end
|
25
44
|
|
26
45
|
#
|
27
|
-
#
|
46
|
+
# Deletes a pending scheduled message from the queue.
|
47
|
+
#
|
48
|
+
# @option options [channel] :channel
|
49
|
+
# The channel the scheduled_message is posting to.
|
50
|
+
# @option options [Object] :scheduled_message_id
|
51
|
+
# scheduled_message_id returned from call to chat.scheduleMessage.
|
52
|
+
# @option options [Object] :as_user
|
53
|
+
# Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.
|
54
|
+
# @see https://api.slack.com/methods/chat.deleteScheduledMessage
|
55
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.deleteScheduledMessage.json
|
56
|
+
def chat_deleteScheduledMessage(options = {})
|
57
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
58
|
+
throw ArgumentError.new('Required arguments :scheduled_message_id missing') if options[:scheduled_message_id].nil?
|
59
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
60
|
+
post('chat.deleteScheduledMessage', options)
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Retrieve a permalink URL for a specific extant message
|
65
|
+
#
|
66
|
+
# @option options [channel] :channel
|
67
|
+
# The ID of the conversation or channel containing the message.
|
68
|
+
# @option options [Object] :message_ts
|
69
|
+
# A message's ts value, uniquely identifying it within a channel.
|
70
|
+
# @see https://api.slack.com/methods/chat.getPermalink
|
71
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.getPermalink.json
|
72
|
+
def chat_getPermalink(options = {})
|
73
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
74
|
+
throw ArgumentError.new('Required arguments :message_ts missing') if options[:message_ts].nil?
|
75
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
76
|
+
post('chat.getPermalink', options)
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Share a me message into a channel.
|
28
81
|
#
|
29
82
|
# @option options [channel] :channel
|
30
83
|
# Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
|
31
84
|
# @option options [Object] :text
|
32
85
|
# Text of the message to send.
|
33
86
|
# @see https://api.slack.com/methods/chat.meMessage
|
34
|
-
# @see https://github.com/
|
87
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.meMessage.json
|
35
88
|
def chat_meMessage(options = {})
|
36
89
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
37
90
|
throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
@@ -39,78 +92,206 @@ module Slack
|
|
39
92
|
end
|
40
93
|
|
41
94
|
#
|
42
|
-
#
|
95
|
+
# Sends an ephemeral message to a user in a channel.
|
43
96
|
#
|
97
|
+
# @option options [Object] :attachments
|
98
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
44
99
|
# @option options [channel] :channel
|
45
|
-
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
|
100
|
+
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
|
46
101
|
# @option options [Object] :text
|
47
|
-
#
|
102
|
+
# How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
|
103
|
+
# @option options [user] :user
|
104
|
+
# id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
|
105
|
+
# @option options [Object] :as_user
|
106
|
+
# 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.
|
107
|
+
# @option options [Object] :blocks
|
108
|
+
# A JSON-based array of structured blocks, presented as a URL-encoded string.
|
109
|
+
# @option options [Object] :icon_emoji
|
110
|
+
# 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.
|
111
|
+
# @option options [Object] :icon_url
|
112
|
+
# 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.
|
113
|
+
# @option options [Object] :link_names
|
114
|
+
# Find and link channel names and usernames.
|
48
115
|
# @option options [Object] :parse
|
49
116
|
# Change how messages are treated. Defaults to none. See below.
|
117
|
+
# @option options [Object] :thread_ts
|
118
|
+
# Provide another message's ts value to post this message in a thread. Avoid using a reply's ts value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread.
|
119
|
+
# @option options [Object] :username
|
120
|
+
# Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
|
121
|
+
# @see https://api.slack.com/methods/chat.postEphemeral
|
122
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
|
123
|
+
def chat_postEphemeral(options = {})
|
124
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
125
|
+
throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
|
126
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
127
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
128
|
+
# attachments must be passed as an encoded JSON string
|
129
|
+
if options.key?(:attachments)
|
130
|
+
attachments = options[:attachments]
|
131
|
+
attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
132
|
+
options = options.merge(attachments: attachments)
|
133
|
+
end
|
134
|
+
# blocks must be passed as an encoded JSON string
|
135
|
+
if options.key?(:blocks)
|
136
|
+
blocks = options[:blocks]
|
137
|
+
blocks = JSON.dump(blocks) unless blocks.is_a?(String)
|
138
|
+
options = options.merge(blocks: blocks)
|
139
|
+
end
|
140
|
+
post('chat.postEphemeral', options)
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# Sends a message to a channel.
|
145
|
+
#
|
146
|
+
# @option options [channel] :channel
|
147
|
+
# Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
|
148
|
+
# @option options [Object] :text
|
149
|
+
# How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
|
150
|
+
# @option options [Object] :as_user
|
151
|
+
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below. This argument may not be used with newer bot tokens.
|
152
|
+
# @option options [Object] :attachments
|
153
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
154
|
+
# @option options [Object] :blocks
|
155
|
+
# A JSON-based array of structured blocks, presented as a URL-encoded string.
|
156
|
+
# @option options [Object] :icon_emoji
|
157
|
+
# Emoji to use as the icon for this message. Overrides icon_url. See authorship below. Use with bot tokens requires chat:write.customize.
|
158
|
+
# @option options [Object] :icon_url
|
159
|
+
# URL to an image to use as the icon for this message. See authorship below. Use with bot tokens requires chat:write.customize.
|
50
160
|
# @option options [Object] :link_names
|
51
161
|
# Find and link channel names and usernames.
|
52
|
-
# @option options [Object] :
|
53
|
-
#
|
162
|
+
# @option options [Object] :mrkdwn
|
163
|
+
# Disable Slack markup parsing by setting to false. Enabled by default.
|
164
|
+
# @option options [Object] :parse
|
165
|
+
# Change how messages are treated. Defaults to none. See below.
|
166
|
+
# @option options [Object] :reply_broadcast
|
167
|
+
# 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
|
+
# @option options [Object] :thread_ts
|
169
|
+
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
54
170
|
# @option options [Object] :unfurl_links
|
55
171
|
# Pass true to enable unfurling of primarily text-based content.
|
56
172
|
# @option options [Object] :unfurl_media
|
57
173
|
# Pass false to disable unfurling of media content.
|
58
174
|
# @option options [Object] :username
|
59
|
-
# Set your bot's user name.
|
60
|
-
# @option options [Object] :as_user
|
61
|
-
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
|
62
|
-
# @option options [Object] :icon_url
|
63
|
-
# 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.
|
64
|
-
# @option options [Object] :icon_emoji
|
65
|
-
# 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.
|
66
|
-
# @option options [Object] :thread_ts
|
67
|
-
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
68
|
-
# @option options [Object] :reply_broadcast
|
69
|
-
# Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
|
175
|
+
# Set your bot's user name. See authorship below. Use with bot tokens requires chat:write.customize.
|
70
176
|
# @see https://api.slack.com/methods/chat.postMessage
|
71
|
-
# @see https://github.com/
|
177
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
|
72
178
|
def chat_postMessage(options = {})
|
73
179
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
74
|
-
throw ArgumentError.new('Required arguments :text or :
|
180
|
+
throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
|
75
181
|
# attachments must be passed as an encoded JSON string
|
76
182
|
if options.key?(:attachments)
|
77
183
|
attachments = options[:attachments]
|
78
184
|
attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
79
185
|
options = options.merge(attachments: attachments)
|
80
186
|
end
|
187
|
+
# blocks must be passed as an encoded JSON string
|
188
|
+
if options.key?(:blocks)
|
189
|
+
blocks = options[:blocks]
|
190
|
+
blocks = JSON.dump(blocks) unless blocks.is_a?(String)
|
191
|
+
options = options.merge(blocks: blocks)
|
192
|
+
end
|
81
193
|
post('chat.postMessage', options)
|
82
194
|
end
|
83
195
|
|
84
196
|
#
|
85
|
-
#
|
197
|
+
# Schedules a message to be sent to a channel.
|
86
198
|
#
|
87
|
-
# @option options [timestamp] :ts
|
88
|
-
# Timestamp of the message to be updated.
|
89
199
|
# @option options [channel] :channel
|
90
|
-
# Channel
|
200
|
+
# Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.
|
201
|
+
# @option options [Object] :post_at
|
202
|
+
# Unix EPOCH timestamp of time in future to send the message.
|
91
203
|
# @option options [Object] :text
|
92
|
-
#
|
204
|
+
# 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
|
+
# @option options [Object] :as_user
|
206
|
+
# Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See chat.postMessage.
|
93
207
|
# @option options [Object] :attachments
|
94
|
-
#
|
95
|
-
# @option options [Object] :
|
96
|
-
#
|
208
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string.
|
209
|
+
# @option options [Object] :blocks
|
210
|
+
# A JSON-based array of structured blocks, presented as a URL-encoded string.
|
97
211
|
# @option options [Object] :link_names
|
98
|
-
# Find and link channel names and usernames.
|
212
|
+
# Find and link channel names and usernames.
|
213
|
+
# @option options [Object] :parse
|
214
|
+
# Change how messages are treated. Defaults to none. See chat.postMessage.
|
215
|
+
# @option options [Object] :reply_broadcast
|
216
|
+
# 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
|
+
# @option options [Object] :thread_ts
|
218
|
+
# Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
|
219
|
+
# @option options [Object] :unfurl_links
|
220
|
+
# Pass true to enable unfurling of primarily text-based content.
|
221
|
+
# @option options [Object] :unfurl_media
|
222
|
+
# Pass false to disable unfurling of media content.
|
223
|
+
# @see https://api.slack.com/methods/chat.scheduleMessage
|
224
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.scheduleMessage.json
|
225
|
+
def chat_scheduleMessage(options = {})
|
226
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
227
|
+
throw ArgumentError.new('Required arguments :post_at missing') if options[:post_at].nil?
|
228
|
+
throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
|
229
|
+
post('chat.scheduleMessage', options)
|
230
|
+
end
|
231
|
+
|
232
|
+
#
|
233
|
+
# Provide custom unfurl behavior for user-posted URLs
|
234
|
+
#
|
235
|
+
# @option options [channel] :channel
|
236
|
+
# Channel ID of the message.
|
237
|
+
# @option options [timestamp] :ts
|
238
|
+
# Timestamp of the message to add unfurl behavior to.
|
239
|
+
# @option options [Object] :unfurls
|
240
|
+
# URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.
|
241
|
+
# @option options [Object] :user_auth_message
|
242
|
+
# Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.
|
243
|
+
# @option options [Object] :user_auth_required
|
244
|
+
# Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.
|
245
|
+
# @option options [Object] :user_auth_url
|
246
|
+
# Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
|
247
|
+
# @see https://api.slack.com/methods/chat.unfurl
|
248
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.unfurl.json
|
249
|
+
def chat_unfurl(options = {})
|
250
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
251
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
252
|
+
throw ArgumentError.new('Required arguments :unfurls missing') if options[:unfurls].nil?
|
253
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
254
|
+
post('chat.unfurl', options)
|
255
|
+
end
|
256
|
+
|
257
|
+
#
|
258
|
+
# Updates a message.
|
259
|
+
#
|
260
|
+
# @option options [channel] :channel
|
261
|
+
# Channel containing the message to be updated.
|
262
|
+
# @option options [timestamp] :ts
|
263
|
+
# Timestamp of the message to be updated.
|
99
264
|
# @option options [Object] :as_user
|
100
265
|
# Pass true to update the message as the authed user. Bot users in this context are considered authed users.
|
266
|
+
# @option options [Object] :attachments
|
267
|
+
# A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text. If you don't include this field, the message's previous attachments will be retained. To remove previous attachments, include an empty array for this field.
|
268
|
+
# @option options [Object] :blocks
|
269
|
+
# A JSON-based array of structured blocks, presented as a URL-encoded string. If you don't include this field, the message's previous blocks will be retained. To remove previous blocks, include an empty array for this field.
|
270
|
+
# @option options [Object] :link_names
|
271
|
+
# 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.
|
272
|
+
# @option options [Object] :parse
|
273
|
+
# 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.
|
274
|
+
# @option options [Object] :text
|
275
|
+
# New text for the message, using the default formatting rules. It's not required when presenting blocks or attachments.
|
101
276
|
# @see https://api.slack.com/methods/chat.update
|
102
|
-
# @see https://github.com/
|
277
|
+
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.update.json
|
103
278
|
def chat_update(options = {})
|
104
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
105
279
|
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
106
|
-
throw ArgumentError.new('Required arguments :text or :
|
107
|
-
|
280
|
+
throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if options[:text].nil? && options[:attachments].nil? && options[:blocks].nil?
|
281
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
282
|
+
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
108
283
|
# attachments must be passed as an encoded JSON string
|
109
284
|
if options.key?(:attachments)
|
110
285
|
attachments = options[:attachments]
|
111
286
|
attachments = JSON.dump(attachments) unless attachments.is_a?(String)
|
112
287
|
options = options.merge(attachments: attachments)
|
113
288
|
end
|
289
|
+
# blocks must be passed as an encoded JSON string
|
290
|
+
if options.key?(:blocks)
|
291
|
+
blocks = options[:blocks]
|
292
|
+
blocks = JSON.dump(blocks) unless blocks.is_a?(String)
|
293
|
+
options = options.merge(blocks: blocks)
|
294
|
+
end
|
114
295
|
post('chat.update', options)
|
115
296
|
end
|
116
297
|
end
|