slack-ruby-client 0.14.4 → 0.16.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/.rubocop.yml +23 -7
- data/.rubocop_todo.yml +104 -47
- data/.travis.yml +1 -5
- data/CHANGELOG.md +41 -2
- data/CONTRIBUTING.md +17 -6
- data/Dangerfile +2 -1
- data/Gemfile +2 -2
- data/README.md +94 -53
- data/Rakefile +1 -0
- data/UPGRADING.md +20 -2
- data/bin/commands.rb +30 -0
- 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 +25 -2
- data/bin/commands/api.rb +3 -3
- data/bin/commands/apps.rb +3 -2
- data/bin/commands/apps_connections.rb +13 -0
- data/bin/commands/apps_event_authorizations.rb +16 -0
- data/bin/commands/apps_permissions.rb +5 -4
- data/bin/commands/apps_permissions_resources.rb +3 -2
- data/bin/commands/apps_permissions_scopes.rb +3 -2
- data/bin/commands/apps_permissions_users.rb +5 -4
- 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 +37 -33
- data/bin/commands/chat.rb +34 -33
- data/bin/commands/chat_scheduledMessages.rb +4 -2
- data/bin/commands/conversations.rb +50 -38
- data/bin/commands/dialog.rb +3 -2
- data/bin/commands/dnd.rb +10 -9
- data/bin/commands/emoji.rb +3 -2
- data/bin/commands/files.rb +16 -13
- data/bin/commands/files_comments.rb +3 -2
- data/bin/commands/files_remote.rb +78 -0
- data/bin/commands/groups.rb +38 -35
- data/bin/commands/im.rb +14 -13
- data/bin/commands/migration.rb +4 -2
- data/bin/commands/mpim.rb +14 -13
- data/bin/commands/oauth.rb +6 -5
- data/bin/commands/oauth_v2.rb +17 -0
- data/bin/commands/pins.rb +7 -10
- data/bin/commands/reactions.rb +11 -11
- data/bin/commands/reminders.rb +11 -10
- data/bin/commands/rtm.rb +5 -4
- data/bin/commands/search.rb +11 -7
- data/bin/commands/stars.rb +7 -6
- data/bin/commands/team.rb +12 -8
- data/bin/commands/team_profile.rb +3 -2
- data/bin/commands/usergroups.rb +17 -11
- data/bin/commands/usergroups_users.rb +7 -4
- data/bin/commands/users.rb +26 -23
- data/bin/commands/users_admin.rb +1 -0
- data/bin/commands/users_prefs.rb +1 -0
- data/bin/commands/users_profile.rb +6 -5
- data/bin/commands/views.rb +48 -0
- data/bin/commands/workflows.rb +38 -0
- data/bin/slack +1 -2
- data/examples/hi_real_time_and_web/Gemfile +1 -0
- data/examples/hi_real_time_and_web/hi.rb +7 -3
- data/examples/hi_real_time_async_async/Gemfile +1 -0
- data/examples/hi_real_time_async_async/hi.rb +6 -2
- data/examples/hi_web/Gemfile +1 -0
- data/examples/hi_web/hi.rb +1 -0
- data/examples/new_ticket/Gemfile +1 -0
- data/examples/new_ticket/new_ticket.rb +1 -0
- data/lib/slack-ruby-client.rb +6 -4
- data/lib/slack.rb +1 -0
- data/lib/slack/config.rb +1 -0
- data/lib/slack/events/config.rb +1 -0
- data/lib/slack/events/request.rb +8 -2
- data/lib/slack/logger.rb +6 -5
- data/lib/slack/messages/formatting.rb +1 -0
- data/lib/slack/messages/message.rb +1 -4
- 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/typing.rb +3 -1
- data/lib/slack/real_time/client.rb +21 -13
- data/lib/slack/real_time/concurrency.rb +1 -2
- data/lib/slack/real_time/concurrency/async.rb +12 -6
- data/lib/slack/real_time/config.rb +9 -3
- data/lib/slack/real_time/models.rb +1 -0
- data/lib/slack/real_time/models/base.rb +1 -4
- 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 +16 -13
- data/lib/slack/real_time/stores.rb +1 -0
- data/lib/slack/real_time/stores/base.rb +4 -1
- data/lib/slack/real_time/stores/starter.rb +1 -0
- data/lib/slack/real_time/stores/store.rb +16 -25
- data/lib/slack/version.rb +2 -1
- data/lib/slack/web/api/endpoints.rb +60 -0
- 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 +40 -1
- data/lib/slack/web/api/endpoints/api.rb +2 -3
- data/lib/slack/web/api/endpoints/apps.rb +2 -1
- 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 +3 -2
- data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +2 -1
- data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +2 -1
- data/lib/slack/web/api/endpoints/apps_permissions_users.rb +3 -2
- data/lib/slack/web/api/endpoints/auth.rb +3 -2
- data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
- data/lib/slack/web/api/endpoints/bots.rb +4 -1
- 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 +52 -31
- data/lib/slack/web/api/endpoints/chat.rb +31 -30
- data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +5 -2
- data/lib/slack/web/api/endpoints/conversations.rb +55 -36
- data/lib/slack/web/api/endpoints/dialog.rb +2 -1
- data/lib/slack/web/api/endpoints/dnd.rb +5 -4
- data/lib/slack/web/api/endpoints/emoji.rb +2 -1
- data/lib/slack/web/api/endpoints/files.rb +13 -8
- data/lib/slack/web/api/endpoints/files_comments.rb +2 -1
- data/lib/slack/web/api/endpoints/files_remote.rb +127 -0
- data/lib/slack/web/api/endpoints/groups.rb +39 -24
- data/lib/slack/web/api/endpoints/im.rb +17 -12
- data/lib/slack/web/api/endpoints/migration.rb +4 -1
- data/lib/slack/web/api/endpoints/mpim.rb +18 -13
- data/lib/slack/web/api/endpoints/oauth.rb +4 -6
- data/lib/slack/web/api/endpoints/oauth_v2.rb +30 -0
- data/lib/slack/web/api/endpoints/pins.rb +7 -16
- data/lib/slack/web/api/endpoints/reactions.rb +14 -15
- data/lib/slack/web/api/endpoints/reminders.rb +6 -5
- data/lib/slack/web/api/endpoints/rtm.rb +3 -2
- data/lib/slack/web/api/endpoints/search.rb +10 -3
- data/lib/slack/web/api/endpoints/stars.rb +6 -7
- data/lib/slack/web/api/endpoints/team.rb +11 -5
- data/lib/slack/web/api/endpoints/team_profile.rb +2 -1
- data/lib/slack/web/api/endpoints/usergroups.rb +16 -5
- data/lib/slack/web/api/endpoints/usergroups_users.rb +7 -2
- data/lib/slack/web/api/endpoints/users.rb +18 -21
- data/lib/slack/web/api/endpoints/users_admin.rb +1 -0
- data/lib/slack/web/api/endpoints/users_prefs.rb +1 -0
- data/lib/slack/web/api/endpoints/users_profile.rb +4 -3
- 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 +1 -0
- 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 +14 -1
- data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -0
- data/lib/slack/web/api/mixins.rb +2 -0
- data/lib/slack/web/api/mixins/channels.id.rb +2 -3
- data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
- data/lib/slack/web/api/mixins/groups.id.rb +2 -3
- data/lib/slack/web/api/mixins/ids.id.rb +3 -2
- data/lib/slack/web/api/mixins/users.id.rb +2 -3
- data/lib/slack/web/api/mixins/users.search.rb +1 -0
- data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +29 -26
- 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 +1 -0
- data/lib/slack/web/api/templates/commands.erb +1 -0
- data/lib/slack/web/api/templates/endpoints.erb +2 -0
- data/lib/slack/web/api/templates/errors.erb +20 -0
- data/lib/slack/web/api/templates/method.erb +5 -1
- data/lib/slack/web/api/templates/method_spec.erb +2 -1
- data/lib/slack/web/client.rb +2 -1
- data/lib/slack/web/config.rb +3 -0
- data/lib/slack/web/faraday/connection.rb +24 -20
- data/lib/slack/web/faraday/request.rb +1 -0
- data/lib/slack/web/faraday/response/raise_error.rb +25 -6
- data/lib/slack/web/faraday/response/wrap_error.rb +18 -0
- data/lib/slack/web/pagination/cursor.rb +3 -2
- data/lib/slack_ruby_client.rb +1 -0
- data/lib/tasks/git.rake +1 -0
- data/lib/tasks/real_time.rake +13 -5
- data/lib/tasks/update.rake +1 -0
- data/lib/tasks/web.rake +34 -10
- data/screenshots/create-app.png +0 -0
- data/slack-ruby-client.gemspec +6 -3
- 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/views_open_error.yml +76 -0
- data/spec/integration/integration_spec.rb +16 -17
- data/spec/slack/config_spec.rb +2 -0
- data/spec/slack/events/config_spec.rb +8 -4
- data/spec/slack/events/request_spec.rb +74 -40
- data/spec/slack/messages/formatting_spec.rb +25 -13
- 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 +153 -38
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +2 -0
- data/spec/slack/real_time/event_handlers/bot_spec.rb +2 -1
- data/spec/slack/real_time/event_handlers/channel_spec.rb +9 -6
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +2 -1
- 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 +3 -1
- data/spec/slack/real_time/event_handlers/user_spec.rb +1 -0
- data/spec/slack/real_time/rtm_connect_spec.rb +1 -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 +37 -5
- 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 +9 -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 +1 -0
- data/spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +3 -2
- data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +4 -3
- data/spec/slack/web/api/endpoints/apps_spec.rb +3 -2
- 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 +1 -0
- data/spec/slack/web/api/endpoints/conversations_spec.rb +21 -12
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +5 -1
- data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +5 -3
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +80 -25
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +12 -4
- data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +2 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +6 -1
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +95 -0
- data/spec/slack/web/api/endpoints/dnd_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/emoji_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +3 -2
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +24 -0
- data/spec/slack/web/api/endpoints/files_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/im_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/migration_spec.rb +1 -0
- data/spec/slack/web/api/endpoints/mpim_spec.rb +5 -4
- data/spec/slack/web/api/endpoints/oauth_spec.rb +4 -14
- 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 +1 -0
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +1 -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 +4 -2
- data/spec/slack/web/api/errors/slack_error_spec.rb +26 -2
- data/spec/slack/web/api/mixins/channels_spec.rb +17 -7
- 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 +17 -7
- data/spec/slack/web/api/mixins/users_spec.rb +17 -8
- data/spec/slack/web/api/pagination/cursor_spec.rb +40 -10
- data/spec/slack/web/client_spec.rb +171 -18
- data/spec/slack/web/faraday/response/raise_error_spec.rb +47 -12
- data/spec/spec_helper.rb +2 -1
- data/spec/support/queue_with_timeout.rb +1 -0
- data/spec/support/real_time/concurrency/mock.rb +1 -0
- data/spec/support/real_time/connected_client.rb +9 -3
- data/spec/support/real_time/event.rb +1 -0
- data/spec/support/token.rb +1 -0
- data/spec/support/vcr.rb +5 -0
- metadata +190 -46
- 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_celluloid/Procfile +0 -2
- data/examples/hi_real_time_async_celluloid/hi.rb +0 -35
- data/examples/hi_real_time_async_eventmachine/Gemfile +0 -6
- data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
- data/examples/hi_real_time_async_eventmachine/hi.rb +0 -35
- data/lib/slack/real_time/concurrency/celluloid.rb +0 -136
- data/lib/slack/real_time/concurrency/eventmachine.rb +0 -82
- 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 -21
- data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
- data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
- data/screenshots/register-bot.png +0 -0
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -111
- data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -49
- data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bfdecfe74d4f64a551519516ce706fbd50d7e8f512df2f10cf991f4c3d153a
|
4
|
+
data.tar.gz: 8f8330671c68f4937026b7bf211eb623a5a4f03ac704fb2465c5ad70833ce610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4eca0d30990e29c93ec5e2063cdfb7c9cbc9e0f4c23fe566b64af1c23dd2bc3dc2690937b43f9fb771035425fde4d023c29180592b01513a2d8a3ac4731511b
|
7
|
+
data.tar.gz: ca8c4a73812d77fe3b8bef823b2b7b1fa890c8efdab14a0bfa9094b5c171632f0ce33fb79493fc8444a21605397b63a38f4e890b1736afd74cfd14117a4dddcb
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: [dblock]
|
data/.rubocop.yml
CHANGED
@@ -1,21 +1,37 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rspec
|
6
|
+
|
1
7
|
AllCops:
|
8
|
+
DisplayCopNames: true
|
2
9
|
Exclude:
|
10
|
+
- bin/**/*
|
3
11
|
- vendor/**/*
|
4
12
|
- lib/slack/web/api/slack-api-ref/**/*
|
13
|
+
- lib/slack/web/api/endpoints/* # Auto-generated
|
14
|
+
- lib/slack/web/api/errors.rb # Auto-generated
|
15
|
+
- spec/slack/web/api/endpoints/* # Auto-generated
|
5
16
|
|
6
|
-
|
17
|
+
Layout/EmptyLineAfterMagicComment:
|
7
18
|
Enabled: false
|
8
19
|
|
9
|
-
Metrics/
|
10
|
-
Max: 512
|
11
|
-
|
12
|
-
Style/Documentation:
|
20
|
+
Metrics/BlockLength:
|
13
21
|
Enabled: false
|
14
22
|
|
15
|
-
|
23
|
+
Metrics/ClassLength:
|
24
|
+
Max: 250
|
25
|
+
|
26
|
+
Layout/LineLength:
|
27
|
+
Max: 128
|
28
|
+
|
29
|
+
Style/Documentation:
|
16
30
|
Enabled: false
|
17
31
|
|
18
32
|
Style/ModuleFunction:
|
19
33
|
Enabled: false
|
20
34
|
|
21
|
-
|
35
|
+
Naming/FileName:
|
36
|
+
Exclude:
|
37
|
+
- lib/slack-ruby-client.rb # Required to match gemspec name
|
data/.rubocop_todo.yml
CHANGED
@@ -1,75 +1,132 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-08-24 10:08:11 -0400 using RuboCop version 0.82.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
#
|
11
|
-
Lint/
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
Lint/NonDeterministicRequireOrder:
|
12
12
|
Exclude:
|
13
|
-
- '
|
14
|
-
- 'lib/slack/real_time/socket.rb'
|
13
|
+
- 'spec/spec_helper.rb'
|
15
14
|
|
16
|
-
# Offense count:
|
17
|
-
|
15
|
+
# Offense count: 2
|
16
|
+
# Cop supports --auto-correct.
|
17
|
+
Lint/RedundantCopDisableDirective:
|
18
18
|
Exclude:
|
19
19
|
- 'lib/slack-ruby-client.rb'
|
20
|
-
- 'lib/slack/real_time/concurrency/async.rb'
|
21
|
-
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
|
22
|
-
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
|
23
20
|
|
24
|
-
# Offense count:
|
25
|
-
# Configuration parameters:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
21
|
+
# Offense count: 11
|
22
|
+
# Configuration parameters: IgnoredMethods.
|
23
|
+
Metrics/AbcSize:
|
24
|
+
Max: 39
|
25
|
+
|
26
|
+
# Offense count: 2
|
27
|
+
# Configuration parameters: IgnoredMethods.
|
28
|
+
Metrics/CyclomaticComplexity:
|
29
|
+
Max: 9
|
30
|
+
|
31
|
+
# Offense count: 14
|
32
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
33
|
+
Metrics/MethodLength:
|
34
|
+
Max: 32
|
33
35
|
|
34
36
|
# Offense count: 1
|
35
|
-
# Configuration parameters:
|
36
|
-
|
37
|
-
|
38
|
-
Exclude:
|
39
|
-
- 'lib/slack/logger.rb'
|
37
|
+
# Configuration parameters: CountKeywordArgs.
|
38
|
+
Metrics/ParameterLists:
|
39
|
+
Max: 6
|
40
40
|
|
41
41
|
# Offense count: 1
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
# Configuration parameters: IgnoredMethods.
|
43
|
+
Metrics/PerceivedComplexity:
|
44
|
+
Max: 9
|
45
45
|
|
46
46
|
# Offense count: 2
|
47
|
-
#
|
48
|
-
|
49
|
-
Style/AccessModifierDeclarations:
|
47
|
+
# Cop supports --auto-correct.
|
48
|
+
Performance/RegexpMatch:
|
50
49
|
Exclude:
|
51
|
-
- 'lib/
|
52
|
-
|
50
|
+
- 'lib/tasks/web.rake'
|
51
|
+
|
52
|
+
# Offense count: 5
|
53
|
+
# Cop supports --auto-correct.
|
54
|
+
RSpec/ContextMethod:
|
55
|
+
Exclude:
|
56
|
+
- 'spec/slack/messages/formatting_spec.rb'
|
57
|
+
- 'spec/slack/web/api/mixins/channels_spec.rb'
|
58
|
+
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
59
|
+
- 'spec/slack/web/api/mixins/users_spec.rb'
|
60
|
+
|
61
|
+
# Offense count: 72
|
62
|
+
# Configuration parameters: Prefixes.
|
63
|
+
# Prefixes: when, with, without
|
64
|
+
RSpec/ContextWording:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
# Offense count: 131
|
68
|
+
# Cop supports --auto-correct.
|
69
|
+
# Configuration parameters: AllowConsecutiveOneLiners.
|
70
|
+
RSpec/EmptyLineAfterExample:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
# Offense count: 66
|
74
|
+
# Configuration parameters: Max.
|
75
|
+
RSpec/ExampleLength:
|
76
|
+
Enabled: false
|
53
77
|
|
54
|
-
# Offense count:
|
55
|
-
# Configuration parameters:
|
56
|
-
|
78
|
+
# Offense count: 18
|
79
|
+
# Configuration parameters: CustomTransform, IgnoreMethods.
|
80
|
+
RSpec/FilePath:
|
57
81
|
Enabled: false
|
58
82
|
|
59
|
-
# Offense count:
|
60
|
-
# Configuration parameters:
|
61
|
-
|
83
|
+
# Offense count: 14
|
84
|
+
# Configuration parameters: AssignmentOnly.
|
85
|
+
RSpec/InstanceVariable:
|
62
86
|
Exclude:
|
63
|
-
- '
|
64
|
-
- '
|
65
|
-
- '
|
87
|
+
- 'spec/integration/integration_spec.rb'
|
88
|
+
- 'spec/slack/real_time/client_spec.rb'
|
89
|
+
- 'spec/slack/slack_spec.rb'
|
66
90
|
|
67
|
-
# Offense count:
|
68
|
-
|
91
|
+
# Offense count: 77
|
92
|
+
# Configuration parameters: .
|
93
|
+
# SupportedStyles: have_received, receive
|
94
|
+
RSpec/MessageSpies:
|
95
|
+
EnforcedStyle: receive
|
96
|
+
|
97
|
+
# Offense count: 95
|
98
|
+
RSpec/MultipleExpectations:
|
99
|
+
Max: 5
|
100
|
+
|
101
|
+
# Offense count: 2
|
102
|
+
# Configuration parameters: IgnoreSharedExamples.
|
103
|
+
RSpec/NamedSubject:
|
69
104
|
Exclude:
|
70
|
-
- '
|
105
|
+
- 'spec/slack/web/api/mixins/conversations_list_spec.rb'
|
71
106
|
|
72
|
-
# Offense count:
|
73
|
-
|
107
|
+
# Offense count: 37
|
108
|
+
RSpec/NestedGroups:
|
109
|
+
Max: 6
|
110
|
+
|
111
|
+
# Offense count: 4
|
112
|
+
RSpec/SubjectStub:
|
74
113
|
Exclude:
|
114
|
+
- 'spec/slack/web/api/mixins/channels_spec.rb'
|
115
|
+
- 'spec/slack/web/api/mixins/conversations_spec.rb'
|
116
|
+
- 'spec/slack/web/api/mixins/groups_spec.rb'
|
117
|
+
- 'spec/slack/web/api/mixins/users_spec.rb'
|
118
|
+
|
119
|
+
# Offense count: 16
|
120
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
121
|
+
RSpec/VerifiedDoubles:
|
122
|
+
Exclude:
|
123
|
+
- 'spec/slack/events/request_spec.rb'
|
124
|
+
- 'spec/slack/real_time/client_spec.rb'
|
125
|
+
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
|
75
126
|
- 'spec/support/real_time/connected_client.rb'
|
127
|
+
|
128
|
+
# Offense count: 4
|
129
|
+
# Configuration parameters: .
|
130
|
+
# SupportedStyles: annotated, template, unannotated
|
131
|
+
Style/FormatStringToken:
|
132
|
+
EnforcedStyle: unannotated
|
data/.travis.yml
CHANGED
@@ -3,9 +3,9 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.3.8
|
7
6
|
- 2.5.3
|
8
7
|
- 2.6.0
|
8
|
+
- 2.7.1
|
9
9
|
- ruby-head
|
10
10
|
- jruby-head
|
11
11
|
|
@@ -14,10 +14,6 @@ matrix:
|
|
14
14
|
- rvm: 2.4.1
|
15
15
|
script:
|
16
16
|
- bundle exec danger
|
17
|
-
- rvm: 2.4.1
|
18
|
-
env: CONCURRENCY=celluloid-io
|
19
|
-
- rvm: 2.4.1
|
20
|
-
env: CONCURRENCY=faye-websocket
|
21
17
|
- rvm: 2.5.3
|
22
18
|
env: CONCURRENCY=async-websocket
|
23
19
|
allow_failures:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,42 @@
|
|
1
|
+
### 0.16.0 (2021/01/24)
|
2
|
+
|
3
|
+
* [#350](https://github.com/slack-ruby/slack-ruby-client/pull/350): Handle server errors such as timouts & non-json responses (see [Upgrading to 0.16.0](UPGRADING.md#upgrading-to--0160)) - [@ojab](https://github.com/ojab).
|
4
|
+
* [#354](https://github.com/slack-ruby/slack-ruby-client/pull/354): Rewind body after checking request signature - [@sunny](https://github.com/sunny).
|
5
|
+
* [#355](https://github.com/slack-ruby/slack-ruby-client/pull/355), [#357](https://github.com/slack-ruby/slack-ruby-client/pull/357): Removed celluloid and faye-websocket support - [@wasabigeek](https://github.com/wasabigeek).
|
6
|
+
* [#356](https://github.com/slack-ruby/slack-ruby-client/pull/356): Added `admin_apps_clearResolution`, `admin_conversations_getCustomRetention`, `admin_conversations_removeCustomRetention`, `admin_conversations_setCustomRetention` and `admin_users_session_list` endpoints - [@dblock](https://github.com/dblock).
|
7
|
+
* [#348](https://github.com/slack-ruby/slack-ruby-client/pull/348): Added `admin_conversations_archive`, `admin_conversations_convertToPrivate`, `admin_conversations_create`, `admin_conversations_delete`, `admin_conversations_disconnectShared`, `admin_conversations_getConversationPrefs`, `admin_conversations_getTeams`, `admin_conversations_invite`, `admin_conversations_rename`, `admin_conversations_search`, `admin_conversations_setConversationPrefs`, `admin_conversations_unarchive`, `admin_conversations_ekm_listOriginalConnectedChannelInfo`, `admin_users_session_invalidate`, `apps_event_authorizations_list`, `conversations_mark`, `workflows_stepCompleted`, `workflows_stepFailed` and `workflows_updateStep` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
8
|
+
|
9
|
+
### 0.15.1 (2020/9/3)
|
10
|
+
|
11
|
+
* [#336](https://github.com/slack-ruby/slack-ruby-client/pull/336): Fix: handle nil events - [@pyama86](https://github.com/pyama86).
|
12
|
+
* [#339](https://github.com/slack-ruby/slack-ruby-client/pull/339): Fix: `channel_not_found` resolving channel IDs with 100+ channels - [@dblock](https://github.com/dblock).
|
13
|
+
* [#340](https://github.com/slack-ruby/slack-ruby-client/pull/340): Added `adapter` configuration setting to change the `Faraday` HTTP adapter - [@watsonjon](https://github.com/watsonjon).
|
14
|
+
|
15
|
+
### 0.15.0 (2020/7/26)
|
16
|
+
|
17
|
+
* [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
|
18
|
+
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
|
19
|
+
* [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Upgrade slack-ruby-danger, rubocop, rubocop-rspec and rubocop-performance - [@dblock](https://github.com/dblock).
|
20
|
+
* [#327](https://github.com/slack-ruby/slack-ruby-client/pull/327), [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Added `admin_conversations_whitelist`, `admin_usergroups`, `calls` and `calls_participants` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
21
|
+
* [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
|
22
|
+
* [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
|
23
|
+
* [#331](https://github.com/slack-ruby/slack-ruby-client/pull/331): Use `conversations_list` instead of deprecated `channels_list`. Added `admin_conversations_restrictAccess_addGroup`, `admin_conversations_restrictAccess_listGroups` and `admin_conversations_restrictAccess_removeGroup` endpoints - [@wasabigeek](https://github.com/wasabigeek).
|
24
|
+
|
25
|
+
### 0.14.6 (2020/3/28)
|
26
|
+
|
27
|
+
* [#305](https://github.com/slack-ruby/slack-ruby-client/pull/305): Added `admin_inviteRequests_approve`, `admin_inviteRequests_deny`, `admin_inviteRequests_list`, `admin_inviteRequests_approved_list`, `admin_inviteRequests_denied_list`, `admin_teams_create`, `admin_teams_list`, `admin_teams_admins_list`, `admin_teams_owners_list`, `admin_teams_settings`, `admin_teams_settings_setIcon`, `admin_teams_settings_setName`, `admin_teams_settings_setDescription`, `admin_users_assign`, `admin_users_invite`, `admin_users_remove`, `admin_users_setAdmin`, `admin_users_setOwner` and `admin_users_setRegular` endpoints - [@manuelmeurer](https://github.com/manuelmeurer).
|
28
|
+
* [#311](https://github.com/slack-ruby/slack-ruby-client/pull/311): Made Web API `response_metadata` more accessible in errors - [@jmanian](https://github.com/jmanian).
|
29
|
+
* [#312](https://github.com/slack-ruby/slack-ruby-client/pull/312): Added specific error classes for Web API - [@jmanian](https://github.com/jmanian).
|
30
|
+
* [#313](https://github.com/slack-ruby/slack-ruby-client/pull/313): Added `admin_teams_settings_info`, `admin_users_list`, `admin_users_setExpiration`, `admin_apps_approved_list`, `admin_apps_restricted_list`, `admin_conversations_setTeams`, `admin_emoji_add`, `admin_emoji_addAlias`, `admin_emoji_list`, `admin_emoji_remove` and `admin_emoji_rename` endpoints - [@dblock](https://github.com/dblock).
|
31
|
+
|
32
|
+
### 0.14.5 (2019/12/23)
|
33
|
+
|
34
|
+
* [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
|
35
|
+
* [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk).
|
36
|
+
* [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Added `admin_apps`, `admin_app_requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
|
37
|
+
* [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth_v2_access` and `views_publish` endpoints - [@jwright](https://github.com/jwright).
|
38
|
+
* [#309](https://github.com/slack-ruby/slack-ruby-client/pull/309): Stop ping on `inactive_account` and `invalid_auth` - [@dblock](https://github.com/dblock).
|
39
|
+
|
1
40
|
### 0.14.4 (2019/7/28)
|
2
41
|
|
3
42
|
* [#289](https://github.com/slack-ruby/slack-ruby-client/pull/289): Fix reconnects when ping timers under/overshoot - [@georgyangelov](https://github.com/georgyangelov).
|
@@ -159,8 +198,8 @@
|
|
159
198
|
### 0.7.1 (2016/5/2)
|
160
199
|
|
161
200
|
* [#82](https://github.com/slack-ruby/slack-ruby-client/pull/82): Fix `usergroups.users.{list,update}` and `files.comments.{add,edit,delete}` APIs - [@masatomo](https://github.com/masatomo).
|
162
|
-
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73):
|
163
|
-
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69):
|
201
|
+
* [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Added a `closed` event - [@rkadyb](https://github.com/rkadyb).
|
202
|
+
* [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Added attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
|
164
203
|
* [#85](https://github.com/slack-ruby/slack-ruby-client/issues/85): Compatibility with WebMock 2.0 - [@dblock](https://github.com/dblock).
|
165
204
|
* Added `as_user` to `chat_delete` Web API - [@dblock](https://github.com/dblock).
|
166
205
|
* Added `reminders_add`, `reminders_complete`, `reminders_delete`, `reminders_info` and `reminders_list` to Web API - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
@@ -75,13 +75,24 @@ rake slack:api:update
|
|
75
75
|
|
76
76
|
Sometimes it's necessary to patch auto-generated Slack Web API methods. For example, we want to help clients with calling `to_json` on the `attachments` parameter sent to `chat_postMessage`. See [#20](https://github.com/slack-ruby/slack-ruby-client/issues/20).
|
77
77
|
|
78
|
-
|
78
|
+
The broad steps are:
|
79
|
+
1. Run `rake slack:api:update` to check that existing patches are still valid.
|
80
|
+
- If you run into a `failed to apply patch` error, the auto-generated methods likely drifted from the last patch. Follow the steps [below](#resolving-patch-errors).
|
81
|
+
- This may add new methods if the API has updated, please split them up into multiple PRs if so.
|
82
|
+
2. Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb`.
|
83
|
+
3. Generate a patch:
|
84
|
+
```
|
85
|
+
git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
|
86
|
+
```
|
87
|
+
4. Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
88
|
+
|
89
|
+
##### Resolving Patch Errors
|
90
|
+
|
91
|
+
The auto-generated method files may drift overtime e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
|
92
|
+
1. Run `rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
|
93
|
+
2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
|
94
|
+
3. Continue with Step 2 [above](#patching-slack-web-api).
|
79
95
|
|
80
|
-
```
|
81
|
-
git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
|
82
|
-
```
|
83
|
-
|
84
|
-
Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
|
85
96
|
|
86
97
|
### Write Documentation
|
87
98
|
|
data/Dangerfile
CHANGED
data/Gemfile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source 'http://rubygems.org'
|
2
3
|
|
3
4
|
gemspec
|
@@ -12,6 +13,5 @@ if ENV.key?('CONCURRENCY')
|
|
12
13
|
end
|
13
14
|
|
14
15
|
group :test do
|
15
|
-
gem 'danger
|
16
|
-
gem 'slack-ruby-danger', '~> 0.1.0', require: false
|
16
|
+
gem 'slack-ruby-danger', '~> 0.2.0', require: false
|
17
17
|
end
|
data/README.md
CHANGED
@@ -16,20 +16,26 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
16
16
|
- [Installation](#installation)
|
17
17
|
- [Usage](#usage)
|
18
18
|
- [Create a New Bot Integration](#create-a-new-bot-integration)
|
19
|
-
- [
|
19
|
+
- [OAuth Code Grant](#oauth-code-grant)
|
20
|
+
- [Using the Legacy API Token](#using-the-legacy-api-token)
|
20
21
|
- [Global Settings](#global-settings)
|
21
22
|
- [Web Client](#web-client)
|
22
|
-
- [
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
- [Web Client Examples](#web-client-examples)
|
24
|
+
- [Test Auth](#test-auth)
|
25
|
+
- [Send Messages](#send-messages)
|
26
|
+
- [List Channels](#list-channels)
|
27
|
+
- [Upload a File](#upload-a-file)
|
28
|
+
- [Get Channel Info](#get-channel-info)
|
29
|
+
- [Get User Info](#get-user-info)
|
30
|
+
- [Search for a User](#search-for-a-user)
|
31
|
+
- [Other](#other)
|
30
32
|
- [Web Client Options](#web-client-options)
|
31
33
|
- [Pagination Support](#pagination-support)
|
34
|
+
- [Character Encoding](#character-encoding)
|
32
35
|
- [Error Handling](#error-handling)
|
36
|
+
- [Slack Errors](#slack-errors)
|
37
|
+
- [Rate Limiting](#rate-limiting)
|
38
|
+
- [Other Errors](#other-errors)
|
33
39
|
- [RealTime Client](#realtime-client)
|
34
40
|
- [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
|
35
41
|
- [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
|
@@ -41,8 +47,6 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
41
47
|
- [Large Team Considerations](#large-team-considerations)
|
42
48
|
- [Concurrency](#concurrency)
|
43
49
|
- [Async](#async)
|
44
|
-
- [Faye::Websocket with Eventmachine](#fayewebsocket-with-eventmachine)
|
45
|
-
- [Celluloid](#celluloid)
|
46
50
|
- [Events API](#events-api)
|
47
51
|
- [Configuring Slack::Events](#configuring-slackevents)
|
48
52
|
- [Verifying the Request Signature](#verifying-the-request-signature)
|
@@ -61,12 +65,12 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
61
65
|
|
62
66
|
* This library will let you send messages to Slack via the Web API, send and receive messages via the Real Time Messaging API and facilitate integration with the Events API.
|
63
67
|
* To respond to slash commands, interactive components or events, implement a web application using your favorite web framework and use this library to call the Slack Web API and to verify that events are coming from Slack.
|
64
|
-
* To build a bot using the Real Time Messaging API, use [slack-ruby-bot](https://github.com/
|
65
|
-
* To roll out a complete service using the Real Time Messaging API with Slack button integration to multiple teams, check out [slack-ruby-bot-server](https://github.com/
|
68
|
+
* To build a bot using the Real Time Messaging API, use [slack-ruby-bot](https://github.com/slack-ruby/slack-ruby-bot), which uses this library.
|
69
|
+
* To roll out a complete service using the Real Time Messaging API with Slack button integration to multiple teams, check out [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server), which is built on top of slack-ruby-bot, which uses this library.
|
66
70
|
|
67
71
|
## Stable Release
|
68
72
|
|
69
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.
|
73
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.16.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
70
74
|
|
71
75
|
## Installation
|
72
76
|
|
@@ -76,7 +80,7 @@ Add to Gemfile.
|
|
76
80
|
gem 'slack-ruby-client'
|
77
81
|
```
|
78
82
|
|
79
|
-
If you're going to be using the RealTime client, add
|
83
|
+
If you're going to be using the RealTime client, add `async-websocket`. See below for more information about concurrency.
|
80
84
|
|
81
85
|
```
|
82
86
|
gem 'async-websocket', '~> 0.8.0'
|
@@ -88,11 +92,17 @@ Run `bundle install`.
|
|
88
92
|
|
89
93
|
### Create a New Bot Integration
|
90
94
|
|
91
|
-
|
95
|
+
To integrate your bot with Slack, you must first create a new [Slack App](https://api.slack.com/apps).
|
92
96
|
|
93
|
-
![](screenshots/
|
97
|
+
![](screenshots/create-app.png)
|
94
98
|
|
95
|
-
###
|
99
|
+
### OAuth Code Grant
|
100
|
+
|
101
|
+
Once created, go to the app's Basic Info tab and grab the Client ID and Client Secret. You'll need these in order complete an [OAuth code grant flow](https://api.slack.com/docs/oauth#flow) as described at [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
|
102
|
+
|
103
|
+
### Using the Legacy API Token
|
104
|
+
|
105
|
+
Although OAuth is recommended, you can still [generate a legacy API token](https://api.slack.com/custom-integrations/legacy-tokens) for your app and use it for some interactions.
|
96
106
|
|
97
107
|
```ruby
|
98
108
|
Slack.configure do |config|
|
@@ -115,14 +125,18 @@ logger | An optional logger, defaults to `::Logger.new(STDOUT)` at `Logger
|
|
115
125
|
|
116
126
|
The Slack Web API allows you to build applications that interact with Slack.
|
117
127
|
|
118
|
-
####
|
128
|
+
#### Web Client Examples
|
129
|
+
|
130
|
+
Here are some examples of how to use the web client with the Web API.
|
131
|
+
|
132
|
+
##### Test Auth
|
119
133
|
|
120
134
|
```ruby
|
121
135
|
client = Slack::Web::Client.new
|
122
136
|
client.auth_test
|
123
137
|
```
|
124
138
|
|
125
|
-
|
139
|
+
##### Send Messages
|
126
140
|
|
127
141
|
Send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
|
128
142
|
|
@@ -134,7 +148,7 @@ See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
|
|
134
148
|
|
135
149
|
![](examples/hi_web/hi.gif)
|
136
150
|
|
137
|
-
|
151
|
+
##### List Channels
|
138
152
|
|
139
153
|
List channels with [channels_list](https://api.slack.com/methods/channels.list).
|
140
154
|
|
@@ -144,7 +158,7 @@ channels = client.channels_list.channels
|
|
144
158
|
general_channel = channels.detect { |c| c.name == 'general' }
|
145
159
|
```
|
146
160
|
|
147
|
-
|
161
|
+
##### Upload a File
|
148
162
|
|
149
163
|
Upload a file with [files_upload](https://api.slack.com/methods/files.upload).
|
150
164
|
|
@@ -159,7 +173,7 @@ client.files_upload(
|
|
159
173
|
)
|
160
174
|
```
|
161
175
|
|
162
|
-
|
176
|
+
##### Get Channel Info
|
163
177
|
|
164
178
|
You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `channels_list` in order to locate the channel ID.
|
165
179
|
|
@@ -171,7 +185,7 @@ client.channels_info(channel: 'C04KB5X4D') # calls channels_info
|
|
171
185
|
client.channels_info(channel: '#general') # calls channels_list followed by channels_info
|
172
186
|
```
|
173
187
|
|
174
|
-
|
188
|
+
##### Get User Info
|
175
189
|
|
176
190
|
You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API and the `users_id` method called invokes `users_list` in order to locate the user ID.
|
177
191
|
|
@@ -183,7 +197,7 @@ client.users_info(user: 'U092BDCLV') # calls users_info
|
|
183
197
|
client.users_info(user: '@dblock') # calls users_list followed by users_info
|
184
198
|
```
|
185
199
|
|
186
|
-
|
200
|
+
##### Search for a User
|
187
201
|
|
188
202
|
Constructs an in-memory index of users and searches it. If you want to use this functionality, add the [picky](https://github.com/floere/picky) gem to your project's Gemfile.
|
189
203
|
|
@@ -191,7 +205,7 @@ Constructs an in-memory index of users and searches it. If you want to use this
|
|
191
205
|
client.users_search(user: 'dblock')
|
192
206
|
```
|
193
207
|
|
194
|
-
|
208
|
+
##### Other
|
195
209
|
|
196
210
|
Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
|
197
211
|
|
@@ -224,6 +238,7 @@ timeout | Optional open/read timeout in seconds.
|
|
224
238
|
open_timeout | Optional connection open timeout in seconds.
|
225
239
|
default_page_size | Optional page size for paginated requests, default is _100_.
|
226
240
|
default_max_retries | Optional number of retries for paginated requests, default is _100_.
|
241
|
+
adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
|
227
242
|
|
228
243
|
You can also pass request options, including `timeout` and `open_timeout` into individual calls.
|
229
244
|
|
@@ -261,13 +276,59 @@ end
|
|
261
276
|
all_members # many thousands of team members retrieved 10 at a time
|
262
277
|
```
|
263
278
|
|
279
|
+
#### Character Encoding
|
280
|
+
|
281
|
+
Note that Slack expects `text` to be UTF-8 encoded. If your messages appear with text such as `BAD+11` in Slack, check `text.encoding` and `.encode(Encoding::UTF_8)` your messages before sending them to Slack.
|
282
|
+
|
283
|
+
```ruby
|
284
|
+
text = 'characters such as "Ñ", "Á", "É"'
|
285
|
+
text.encoding
|
286
|
+
=> #<Encoding:UTF-8>
|
287
|
+
client.chat_postMessage(channel: '#general', text: text, as_user: true)
|
288
|
+
# renders 'characters such as "Ñ", "Á", "É"' in Slack
|
289
|
+
|
290
|
+
text = text.encode(Encoding::ISO_8859_1)
|
291
|
+
text.encoding
|
292
|
+
# => #<Encoding:ISO-8859-1>
|
293
|
+
client.chat_postMessage(channel: '#general', text: text, as_user: true)
|
294
|
+
# renders 'characters such as "BAD+11", "", "BAD+9"' in Slack
|
295
|
+
```
|
296
|
+
|
264
297
|
#### Error Handling
|
265
298
|
|
266
|
-
|
299
|
+
##### Slack Errors
|
300
|
+
|
301
|
+
If Slack returns an error for the request, then an error will be raised. The error class is specific to the type of error that Slack returns. For instance if Slack returns `account_inactive` then the error will be `Slack::Web::Api::Errors::AccountInactive`. This allows you to handle certain types of errors as needed:
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
rescue Slack::Web::Api::Errors::AccountInactive => e
|
305
|
+
# deal with inactive account
|
306
|
+
end
|
307
|
+
```
|
308
|
+
|
309
|
+
All of these errors inherit from `Slack::Web::Api::Errors::SlackError`, so you can handle or silence all errors if necessary:
|
267
310
|
|
268
|
-
|
311
|
+
```ruby
|
312
|
+
rescue Slack::Web::Api::Errors::SlackError => e
|
313
|
+
# capture all Slack errors
|
314
|
+
end
|
315
|
+
```
|
269
316
|
|
270
|
-
|
317
|
+
If there's a new error type that is not yet known by this library, then it will raise `Slack::Web::Api::Errors::SlackError`. (Update the Web API if you find that errors are missing — see [CONTRIBUTING](CONTRIBUTING.md).)
|
318
|
+
|
319
|
+
In all of these cases the error message contains the error code, which is also accessible with `slack_error.error`. In case of multiple errors, the error message contains the error codes separated by commas, or they are accessible as an array with `slack_error.errors`. The original response is also accessible using the `response` attribute. The `response_metadata` is accessible with `slack_error.response_metadata`.
|
320
|
+
|
321
|
+
##### Rate Limiting
|
322
|
+
|
323
|
+
If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead. (This does not inherit from `Slack::Web::Api::Errors::SlackError`.)
|
324
|
+
|
325
|
+
##### Other Errors
|
326
|
+
|
327
|
+
In case of Slack temporarily unavailability a `Slack::Web::Api::Errors::ServerError` (`Slack::Web::Api::Errors::SlackError` subclass) subclasses will be raised and original `Faraday::Error` will be accesible via `exception.cause`.
|
328
|
+
|
329
|
+
Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on non-json response (i. e. 200 OK with `Slack unavailable` HTML page) and `Slack::Web::Api::Errors::HttpRequestError` subclasses for connection failures (`Slack::Web::Api::Errors::TimeoutError` for read/open timeouts & `Slack::Web::Api::Errors::UnavailableError` for 5xx HTTP responses).
|
330
|
+
|
331
|
+
In any other case, a `Faraday::ClientError` will be raised.
|
271
332
|
|
272
333
|
### RealTime Client
|
273
334
|
|
@@ -432,7 +493,7 @@ See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a dis
|
|
432
493
|
|
433
494
|
#### Concurrency
|
434
495
|
|
435
|
-
`Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async)
|
496
|
+
`Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async).
|
436
497
|
|
437
498
|
```ruby
|
438
499
|
Slack::RealTime.configure do |config|
|
@@ -440,7 +501,7 @@ Slack::RealTime.configure do |config|
|
|
440
501
|
end
|
441
502
|
```
|
442
503
|
|
443
|
-
Use `client.start_async` instead of `client.start!`. A good example of such application is [slack-bot-server](https://github.com/
|
504
|
+
Use `client.start_async` instead of `client.start!`. A good example of such application is [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
|
444
505
|
|
445
506
|
```ruby
|
446
507
|
client = Slack::RealTime::Client.new
|
@@ -450,7 +511,7 @@ client.start_async
|
|
450
511
|
|
451
512
|
##### Async
|
452
513
|
|
453
|
-
|
514
|
+
Add `async-websocket` to your Gemfile.
|
454
515
|
|
455
516
|
```
|
456
517
|
gem 'async-websocket'
|
@@ -458,26 +519,6 @@ gem 'async-websocket'
|
|
458
519
|
|
459
520
|
See a fully working example in [examples/hi_real_time_async_async](examples/hi_real_time_async_async/hi.rb).
|
460
521
|
|
461
|
-
##### Faye::Websocket with Eventmachine
|
462
|
-
|
463
|
-
Add the following to your Gemfile.
|
464
|
-
|
465
|
-
```
|
466
|
-
gem 'faye-websocket'
|
467
|
-
```
|
468
|
-
|
469
|
-
See a fully working example in [examples/hi_real_time_async_eventmachine](examples/hi_real_time_async_eventmachine/hi.rb).
|
470
|
-
|
471
|
-
##### Celluloid
|
472
|
-
|
473
|
-
Add the following to your Gemfile.
|
474
|
-
|
475
|
-
```
|
476
|
-
gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io']
|
477
|
-
```
|
478
|
-
|
479
|
-
See a fully working example in [examples/hi_real_time_async_celluloid](examples/hi_real_time_async_celluloid/hi.rb).
|
480
|
-
|
481
522
|
### Events API
|
482
523
|
|
483
524
|
This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
|
@@ -515,7 +556,7 @@ Slack::Events::Request.new(http_request,
|
|
515
556
|
signature_expires_in: signature_expires_in)
|
516
557
|
```
|
517
558
|
|
518
|
-
The `verify!` call may raise `Slack::Events::MissingSigningSecret`, `Slack::Events::InvalidSignature` or `Slack::Events::TimestampExpired` errors.
|
559
|
+
The `verify!` call may raise `Slack::Events::Request::MissingSigningSecret`, `Slack::Events::Request::InvalidSignature` or `Slack::Events::Request::TimestampExpired` errors.
|
519
560
|
|
520
561
|
### Message Parsing
|
521
562
|
|