slack-ruby-client 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +22 -12
- data/.github/workflows/update_api.yml +1 -1
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +43 -13
- data/CHANGELOG.md +19 -0
- data/CONTRIBUTING.md +7 -7
- data/Gemfile +1 -0
- data/README.md +68 -25
- data/bin/commands/admin_conversations.rb +21 -0
- data/bin/commands/admin_emoji.rb +1 -1
- data/bin/commands/admin_users.rb +4 -4
- data/bin/commands/admin_users_session.rb +1 -1
- data/bin/commands/admin_workflows.rb +6 -2
- data/bin/commands/admin_workflows_triggers_types_permissions.rb +31 -0
- data/bin/commands/apps_datastore.rb +46 -0
- data/bin/commands/assistant_threads.rb +45 -0
- data/bin/commands/bookmarks.rb +1 -0
- data/bin/commands/canvases.rb +40 -0
- data/bin/commands/canvases_access.rb +34 -0
- data/bin/commands/canvases_sections.rb +21 -0
- data/bin/commands/chat.rb +7 -3
- data/bin/commands/conversations.rb +6 -6
- data/bin/commands/conversations_canvases.rb +21 -0
- data/bin/commands/conversations_externalInvitePermissions.rb +22 -0
- data/bin/commands/conversations_requestSharedInvite.rb +48 -0
- data/bin/commands/files.rb +2 -1
- data/bin/commands/functions_distributions_permissions.rb +59 -0
- data/bin/commands/oauth.rb +2 -2
- data/bin/commands/oauth_v2.rb +2 -2
- data/bin/commands/reminders.rb +1 -1
- data/bin/commands/team_externalTeams.rb +35 -0
- data/bin/commands/usergroups.rb +5 -0
- data/bin/commands/usergroups_users.rb +2 -0
- data/bin/commands/users_discoverableContacts.rb +20 -0
- data/bin/commands/workflows_triggers_permissions.rb +60 -0
- data/examples/files_upload_v2/.env.example +1 -0
- data/examples/files_upload_v2/Gemfile +5 -0
- data/examples/files_upload_v2/README.md +13 -0
- data/examples/files_upload_v2/files_upload_v2.rb +37 -0
- data/examples/oauth_v2/.env.example +4 -0
- data/examples/oauth_v2/Gemfile +7 -0
- data/examples/oauth_v2/README.md +33 -0
- data/examples/oauth_v2/oauth_v2.rb +60 -0
- data/lib/slack/messages/formatting.rb +13 -0
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_conversations.rb +35 -0
- data/lib/slack/web/api/endpoints/admin_emoji.rb +1 -1
- data/lib/slack/web/api/endpoints/admin_users.rb +2 -2
- data/lib/slack/web/api/endpoints/admin_users_session.rb +2 -3
- data/lib/slack/web/api/endpoints/admin_workflows.rb +10 -2
- data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +41 -0
- data/lib/slack/web/api/endpoints/apps_datastore.rb +71 -0
- data/lib/slack/web/api/endpoints/assistant_threads.rb +68 -0
- data/lib/slack/web/api/endpoints/bookmarks.rb +2 -0
- data/lib/slack/web/api/endpoints/canvases.rb +52 -0
- data/lib/slack/web/api/endpoints/canvases_access.rb +47 -0
- data/lib/slack/web/api/endpoints/canvases_sections.rb +27 -0
- data/lib/slack/web/api/endpoints/chat.rb +12 -3
- data/lib/slack/web/api/endpoints/conversations.rb +5 -5
- data/lib/slack/web/api/endpoints/conversations_canvases.rb +26 -0
- data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +31 -0
- data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +73 -0
- data/lib/slack/web/api/endpoints/dnd.rb +1 -0
- data/lib/slack/web/api/endpoints/files.rb +3 -1
- data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +80 -0
- data/lib/slack/web/api/endpoints/oauth.rb +2 -2
- data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
- data/lib/slack/web/api/endpoints/reminders.rb +1 -1
- data/lib/slack/web/api/endpoints/team_externalTeams.rb +53 -0
- data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
- data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
- data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +24 -0
- data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +87 -0
- data/lib/slack/web/api/endpoints.rb +24 -0
- data/lib/slack/web/api/errors.rb +118 -8
- data/lib/slack/web/api/helpers/files.rb +87 -0
- data/lib/slack/web/api/helpers.rb +13 -0
- data/lib/slack/web/api/templates/method.erb +1 -0
- data/lib/slack/web/api/templates/method_spec.erb +6 -4
- data/lib/slack/web/client.rb +1 -0
- data/lib/slack/web/faraday/connection.rb +13 -26
- data/lib/slack/web/faraday/options.rb +24 -0
- data/lib/slack/web/faraday/request.rb +2 -1
- data/lib/slack-ruby-client.rb +2 -0
- data/slack-ruby-client.gemspec +2 -1
- metadata +52 -144
- data/screenshots/create-app.png +0 -0
- data/spec/fixtures/slack/web/429_error.yml +0 -81
- data/spec/fixtures/slack/web/auth_test_error.yml +0 -81
- data/spec/fixtures/slack/web/auth_test_success.yml +0 -81
- data/spec/fixtures/slack/web/conversations_info.yml +0 -167
- data/spec/fixtures/slack/web/conversations_setTopic.yml +0 -84
- data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +0 -172
- data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +0 -253
- data/spec/fixtures/slack/web/paginated_users_list.yml +0 -613
- data/spec/fixtures/slack/web/rtm_connect.yml +0 -391
- data/spec/fixtures/slack/web/users_info.yml +0 -214
- data/spec/fixtures/slack/web/users_list.yml +0 -133
- data/spec/fixtures/slack/web/views_open_error.yml +0 -83
- data/spec/integration/integration_spec.rb +0 -207
- data/spec/slack/config_spec.rb +0 -16
- data/spec/slack/events/config_spec.rb +0 -35
- data/spec/slack/events/request_spec.rb +0 -199
- data/spec/slack/messages/formatting_spec.rb +0 -124
- data/spec/slack/real_time/api/message_spec.rb +0 -20
- data/spec/slack/real_time/api/ping_spec.rb +0 -17
- data/spec/slack/real_time/api/typing_spec.rb +0 -19
- data/spec/slack/real_time/client_spec.rb +0 -601
- data/spec/slack/real_time/concurrency/clients/async_spec.rb +0 -16
- data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +0 -21
- data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +0 -10
- data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +0 -10
- data/spec/slack/real_time/event_handlers/bot_spec.rb +0 -47
- data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +0 -16
- data/spec/slack/real_time/event_handlers/im_spec.rb +0 -51
- data/spec/slack/real_time/event_handlers/private_channel_spec.rb +0 -99
- data/spec/slack/real_time/event_handlers/public_channel_spec.rb +0 -123
- data/spec/slack/real_time/event_handlers/team_spec.rb +0 -63
- data/spec/slack/real_time/event_handlers/user_spec.rb +0 -65
- data/spec/slack/real_time/rtm_connect_spec.rb +0 -14
- data/spec/slack/real_time/stores/store_spec.rb +0 -50
- data/spec/slack/slack_spec.rb +0 -93
- data/spec/slack/version_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_config_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_apps_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +0 -35
- data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +0 -38
- data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +0 -32
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -133
- data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +0 -37
- data/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/admin_functions_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/admin_roles_spec.rb +0 -30
- data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +0 -53
- data/spec/slack/web/api/endpoints/admin_teams_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +0 -37
- data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +0 -41
- data/spec/slack/web/api/endpoints/admin_users_spec.rb +0 -67
- data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/admin_workflows_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/api_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/apps_activities_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_auth_external_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_connections_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/apps_datastore_spec.rb +0 -45
- data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +0 -44
- data/spec/slack/web/api/endpoints/apps_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/auth_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/auth_teams_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/bookmarks_spec.rb +0 -40
- data/spec/slack/web/api/endpoints/bots_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/calls_participants_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/calls_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/chat_spec.rb +0 -134
- data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +0 -27
- data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +0 -206
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +0 -40
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +0 -38
- data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +0 -112
- data/spec/slack/web/api/endpoints/dialog_spec.rb +0 -14
- data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/emoji_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/files_comments_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/files_remote_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/files_spec.rb +0 -57
- data/spec/slack/web/api/endpoints/functions_spec.rb +0 -28
- data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/migration_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/openid_connect_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/pins_spec.rb +0 -23
- data/spec/slack/web/api/endpoints/reactions_spec.rb +0 -24
- data/spec/slack/web/api/endpoints/reminders_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/rtm_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/search_spec.rb +0 -23
- data/spec/slack/web/api/endpoints/stars_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_billing_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_preferences_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_profile_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/team_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/usergroups_spec.rb +0 -28
- data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/users_admin_spec.rb +0 -18
- data/spec/slack/web/api/endpoints/users_prefs_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/users_profile_spec.rb +0 -14
- data/spec/slack/web/api/endpoints/users_spec.rb +0 -8
- data/spec/slack/web/api/endpoints/views_spec.rb +0 -65
- data/spec/slack/web/api/endpoints/workflows_spec.rb +0 -34
- data/spec/slack/web/api/error_spec.rb +0 -14
- data/spec/slack/web/api/errors/slack_error_spec.rb +0 -33
- data/spec/slack/web/api/mixins/conversations_list_spec.rb +0 -21
- data/spec/slack/web/api/mixins/conversations_spec.rb +0 -45
- data/spec/slack/web/api/mixins/users_spec.rb +0 -52
- data/spec/slack/web/api/options_spec.rb +0 -69
- data/spec/slack/web/api/pagination/cursor_spec.rb +0 -102
- data/spec/slack/web/client_spec.rb +0 -359
- data/spec/slack/web/faraday/request_spec.rb +0 -80
- data/spec/slack/web/faraday/response/raise_error_spec.rb +0 -86
- data/spec/spec_helper.rb +0 -30
- data/spec/support/queue_with_timeout.rb +0 -35
- data/spec/support/real_time/concurrency/mock.rb +0 -31
- data/spec/support/real_time/connected_client.rb +0 -21
- data/spec/support/real_time/event.rb +0 -12
- data/spec/support/real_time/loaded_client.rb +0 -120
- data/spec/support/token.rb +0 -11
- data/spec/support/vcr.rb +0 -45
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Pins do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'pins_add' do
|
9
|
-
it 'requires channel' do
|
10
|
-
expect { client.pins_add }.to raise_error ArgumentError, /Required arguments :channel missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'pins_list' do
|
14
|
-
it 'requires channel' do
|
15
|
-
expect { client.pins_list }.to raise_error ArgumentError, /Required arguments :channel missing/
|
16
|
-
end
|
17
|
-
end
|
18
|
-
context 'pins_remove' do
|
19
|
-
it 'requires channel' do
|
20
|
-
expect { client.pins_remove }.to raise_error ArgumentError, /Required arguments :channel missing/
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Reactions do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'reactions_add' do
|
9
|
-
it 'requires channel' do
|
10
|
-
expect { client.reactions_add(name: %q[thumbsup], timestamp: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :channel missing/
|
11
|
-
end
|
12
|
-
it 'requires name' do
|
13
|
-
expect { client.reactions_add(channel: %q[C1234567890], timestamp: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :name missing/
|
14
|
-
end
|
15
|
-
it 'requires timestamp' do
|
16
|
-
expect { client.reactions_add(channel: %q[C1234567890], name: %q[thumbsup]) }.to raise_error ArgumentError, /Required arguments :timestamp missing/
|
17
|
-
end
|
18
|
-
end
|
19
|
-
context 'reactions_remove' do
|
20
|
-
it 'requires name' do
|
21
|
-
expect { client.reactions_remove }.to raise_error ArgumentError, /Required arguments :name missing/
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Reminders do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'reminders_add' do
|
9
|
-
it 'requires text' do
|
10
|
-
expect { client.reminders_add(time: %q[1602288000]) }.to raise_error ArgumentError, /Required arguments :text missing/
|
11
|
-
end
|
12
|
-
it 'requires time' do
|
13
|
-
expect { client.reminders_add(text: %q[eat a banana]) }.to raise_error ArgumentError, /Required arguments :time missing/
|
14
|
-
end
|
15
|
-
end
|
16
|
-
context 'reminders_complete' do
|
17
|
-
it 'requires reminder' do
|
18
|
-
expect { client.reminders_complete }.to raise_error ArgumentError, /Required arguments :reminder missing/
|
19
|
-
end
|
20
|
-
end
|
21
|
-
context 'reminders_delete' do
|
22
|
-
it 'requires reminder' do
|
23
|
-
expect { client.reminders_delete }.to raise_error ArgumentError, /Required arguments :reminder missing/
|
24
|
-
end
|
25
|
-
end
|
26
|
-
context 'reminders_info' do
|
27
|
-
it 'requires reminder' do
|
28
|
-
expect { client.reminders_info }.to raise_error ArgumentError, /Required arguments :reminder missing/
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Search do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'search_all' do
|
9
|
-
it 'requires query' do
|
10
|
-
expect { client.search_all }.to raise_error ArgumentError, /Required arguments :query missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'search_files' do
|
14
|
-
it 'requires query' do
|
15
|
-
expect { client.search_files }.to raise_error ArgumentError, /Required arguments :query missing/
|
16
|
-
end
|
17
|
-
end
|
18
|
-
context 'search_messages' do
|
19
|
-
it 'requires query' do
|
20
|
-
expect { client.search_messages }.to raise_error ArgumentError, /Required arguments :query missing/
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::ToolingTokens do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'tooling.tokens_rotate' do
|
9
|
-
it 'requires refresh_token' do
|
10
|
-
expect { client.tooling_tokens_rotate }.to raise_error ArgumentError, /Required arguments :refresh_token missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Usergroups do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'usergroups_create' do
|
9
|
-
it 'requires name' do
|
10
|
-
expect { client.usergroups_create }.to raise_error ArgumentError, /Required arguments :name missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'usergroups_disable' do
|
14
|
-
it 'requires usergroup' do
|
15
|
-
expect { client.usergroups_disable }.to raise_error ArgumentError, /Required arguments :usergroup missing/
|
16
|
-
end
|
17
|
-
end
|
18
|
-
context 'usergroups_enable' do
|
19
|
-
it 'requires usergroup' do
|
20
|
-
expect { client.usergroups_enable }.to raise_error ArgumentError, /Required arguments :usergroup missing/
|
21
|
-
end
|
22
|
-
end
|
23
|
-
context 'usergroups_update' do
|
24
|
-
it 'requires usergroup' do
|
25
|
-
expect { client.usergroups_update }.to raise_error ArgumentError, /Required arguments :usergroup missing/
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::UsergroupsUsers do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'usergroups.users_list' do
|
9
|
-
it 'requires usergroup' do
|
10
|
-
expect { client.usergroups_users_list }.to raise_error ArgumentError, /Required arguments :usergroup missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'usergroups.users_update' do
|
14
|
-
it 'requires usergroup' do
|
15
|
-
expect { client.usergroups_users_update(users: %q[U060R4BJ4,U060RNRCZ]) }.to raise_error ArgumentError, /Required arguments :usergroup missing/
|
16
|
-
end
|
17
|
-
it 'requires users' do
|
18
|
-
expect { client.usergroups_users_update(usergroup: %q[S0604QSJC]) }.to raise_error ArgumentError, /Required arguments :users missing/
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::UsersAdmin do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'users.admin_invite' do
|
9
|
-
it 'requires email' do
|
10
|
-
expect { client.users_admin_invite }.to raise_error ArgumentError, /Required arguments :email missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'users.admin_setInactive' do
|
14
|
-
it 'requires user' do
|
15
|
-
expect { client.users_admin_setInactive }.to raise_error ArgumentError, /Required arguments :user missing/
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::UsersProfile do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'users.profile_set' do
|
9
|
-
it 'encodes profile as json' do
|
10
|
-
expect(client).to receive(:post).with('users.profile.set', {profile: %q[{"data":["data"]}]})
|
11
|
-
client.users_profile_set(profile: {:data=>["data"]})
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Views do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'views_open' do
|
9
|
-
it 'requires one of trigger_id, interactivity_pointer' do
|
10
|
-
expect { client.views_open(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
11
|
-
|
12
|
-
expect(client).to receive(:post).with('views.open', {trigger_id: %q[12345.98765.abcd2358fdea], view: %q[]})
|
13
|
-
client.views_open(trigger_id: %q[12345.98765.abcd2358fdea], view: %q[])
|
14
|
-
|
15
|
-
expect(client).to receive(:post).with('views.open', {interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]})
|
16
|
-
client.views_open(interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[])
|
17
|
-
|
18
|
-
expect { client.views_open(trigger_id: %q[12345.98765.abcd2358fdea], interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
19
|
-
end
|
20
|
-
it 'encodes view as json' do
|
21
|
-
expect(client).to receive(:post).with('views.open', {view: %q[{"data":["data"]}], trigger_id: %q[12345.98765.abcd2358fdea]})
|
22
|
-
client.views_open(view: {:data=>["data"]}, trigger_id: %q[12345.98765.abcd2358fdea])
|
23
|
-
end
|
24
|
-
end
|
25
|
-
context 'views_publish' do
|
26
|
-
it 'encodes view as json' do
|
27
|
-
expect(client).to receive(:post).with('views.publish', {user_id: %q[U0BPQUNTA], view: %q[{"data":["data"]}]})
|
28
|
-
client.views_publish(user_id: %q[U0BPQUNTA], view: {:data=>["data"]})
|
29
|
-
end
|
30
|
-
end
|
31
|
-
context 'views_push' do
|
32
|
-
it 'requires one of trigger_id, interactivity_pointer' do
|
33
|
-
expect { client.views_push(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
34
|
-
|
35
|
-
expect(client).to receive(:post).with('views.push', {trigger_id: %q[12345.98765.abcd2358fdea], view: %q[]})
|
36
|
-
client.views_push(trigger_id: %q[12345.98765.abcd2358fdea], view: %q[])
|
37
|
-
|
38
|
-
expect(client).to receive(:post).with('views.push', {interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]})
|
39
|
-
client.views_push(interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[])
|
40
|
-
|
41
|
-
expect { client.views_push(trigger_id: %q[12345.98765.abcd2358fdea], interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
42
|
-
end
|
43
|
-
it 'encodes view as json' do
|
44
|
-
expect(client).to receive(:post).with('views.push', {view: %q[{"data":["data"]}], trigger_id: %q[12345.98765.abcd2358fdea]})
|
45
|
-
client.views_push(view: {:data=>["data"]}, trigger_id: %q[12345.98765.abcd2358fdea])
|
46
|
-
end
|
47
|
-
end
|
48
|
-
context 'views_update' do
|
49
|
-
it 'requires one of external_id, view_id' do
|
50
|
-
expect { client.views_update(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
51
|
-
|
52
|
-
expect(client).to receive(:post).with('views.update', {external_id: %q[bmarley_view2], view: %q[]})
|
53
|
-
client.views_update(external_id: %q[bmarley_view2], view: %q[])
|
54
|
-
|
55
|
-
expect(client).to receive(:post).with('views.update', {view_id: %q[VMM512F2U], view: %q[]})
|
56
|
-
client.views_update(view_id: %q[VMM512F2U], view: %q[])
|
57
|
-
|
58
|
-
expect { client.views_update(external_id: %q[bmarley_view2], view_id: %q[VMM512F2U], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
|
59
|
-
end
|
60
|
-
it 'encodes view as json' do
|
61
|
-
expect(client).to receive(:post).with('views.update', {view: %q[{"data":["data"]}], external_id: %q[bmarley_view2]})
|
62
|
-
client.views_update(view: {:data=>["data"]}, external_id: %q[bmarley_view2])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# This file was auto-generated by lib/tasks/web.rake
|
3
|
-
|
4
|
-
require 'spec_helper'
|
5
|
-
|
6
|
-
RSpec.describe Slack::Web::Api::Endpoints::Workflows do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'workflows_stepCompleted' do
|
9
|
-
it 'requires workflow_step_execute_id' do
|
10
|
-
expect { client.workflows_stepCompleted }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'workflows_stepFailed' do
|
14
|
-
it 'requires error' do
|
15
|
-
expect { client.workflows_stepFailed(workflow_step_execute_id: %q[]) }.to raise_error ArgumentError, /Required arguments :error missing/
|
16
|
-
end
|
17
|
-
it 'requires workflow_step_execute_id' do
|
18
|
-
expect { client.workflows_stepFailed(error: %q[]) }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/
|
19
|
-
end
|
20
|
-
it 'encodes error as json' do
|
21
|
-
expect(client).to receive(:post).with('workflows.stepFailed', {error: %q[{"data":["data"]}], workflow_step_execute_id: %q[]})
|
22
|
-
client.workflows_stepFailed(error: {:data=>["data"]}, workflow_step_execute_id: %q[])
|
23
|
-
end
|
24
|
-
end
|
25
|
-
context 'workflows_updateStep' do
|
26
|
-
it 'requires workflow_step_edit_id' do
|
27
|
-
expect { client.workflows_updateStep }.to raise_error ArgumentError, /Required arguments :workflow_step_edit_id missing/
|
28
|
-
end
|
29
|
-
it 'encodes inputs, outputs as json' do
|
30
|
-
expect(client).to receive(:post).with('workflows.updateStep', {workflow_step_edit_id: %q[], inputs: %q[{"data":["data"]}], outputs: %q[{"data":["data"]}]})
|
31
|
-
client.workflows_updateStep(workflow_step_edit_id: %q[], inputs: {:data=>["data"]}, outputs: {:data=>["data"]})
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Error do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
it 'provides access to the response object', vcr: { cassette_name: 'web/auth_test_error' } do
|
8
|
-
client.auth_test
|
9
|
-
raise 'Expected to receive Slack::Web::Api::Error.'
|
10
|
-
rescue described_class => e
|
11
|
-
expect(e.response).not_to be_nil
|
12
|
-
expect(e.response.status).to eq 200
|
13
|
-
end
|
14
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Errors::SlackError do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
it 'provides access to the response object', vcr: { cassette_name: 'web/auth_test_error' } do
|
8
|
-
client.auth_test
|
9
|
-
raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
|
10
|
-
rescue described_class => e
|
11
|
-
expect(e.response).not_to be_nil
|
12
|
-
expect(e.response.status).to eq 200
|
13
|
-
expect(e.message).to eql 'not_authed'
|
14
|
-
expect(e.error).to eql 'not_authed'
|
15
|
-
expect(e.response_metadata).to be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'provides access to any response_metadata', vcr: { cassette_name: 'web/views_open_error' } do
|
19
|
-
client.views_open(trigger_id: 'trigger_id', view: {})
|
20
|
-
raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
|
21
|
-
rescue described_class => e
|
22
|
-
expect(e.response).not_to be_nil
|
23
|
-
expect(e.response.status).to eq 200
|
24
|
-
expect(e.message).to eql 'invalid_arguments'
|
25
|
-
expect(e.error).to eql 'invalid_arguments'
|
26
|
-
expect(e.response_metadata).to eq(
|
27
|
-
'messages' => [
|
28
|
-
'[ERROR] failed to match all allowed schemas [json-pointer:/view]',
|
29
|
-
'[ERROR] missing required field: type [json-pointer:/view]'
|
30
|
-
]
|
31
|
-
)
|
32
|
-
end
|
33
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Client do
|
5
|
-
context 'conversations_setTopic' do
|
6
|
-
it 'does not invoke conversations_list', vcr: { cassette_name: 'web/conversations_setTopic' } do
|
7
|
-
rc = subject.conversations_setTopic({ channel: 'C019CV63UTC', topic: 'new topic' })
|
8
|
-
expect(rc.channel.topic.value).to eq 'new topic'
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'resolves IDs via conversations_list', vcr: { cassette_name: 'web/conversations_setTopic_one_page' } do
|
12
|
-
rc = subject.conversations_setTopic({ channel: '#1', topic: 'new topic' })
|
13
|
-
expect(rc.channel.topic.value).to eq 'new topic'
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'paginates to resolve IDs', vcr: { cassette_name: 'web/conversations_setTopic_paginated' } do
|
17
|
-
rc = subject.conversations_setTopic({ channel: '#topic', topic: 'new topic' })
|
18
|
-
expect(rc.channel.topic.value).to eq 'new topic'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Mixins::Conversations do
|
5
|
-
subject(:conversations) do
|
6
|
-
klass.new
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:klass) do
|
10
|
-
Class.new do
|
11
|
-
include Slack::Web::Api::Mixins::Conversations
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
before do
|
16
|
-
allow(conversations).to receive(:conversations_list).and_yield(
|
17
|
-
Slack::Messages::Message.new(
|
18
|
-
'channels' => [{
|
19
|
-
'id' => 'CDEADBEEF',
|
20
|
-
'name' => 'general'
|
21
|
-
}]
|
22
|
-
)
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#conversations_id' do
|
27
|
-
it 'leaves channels specified by ID alone' do
|
28
|
-
expect(conversations.conversations_id(channel: 'C123456')).to(
|
29
|
-
eq('ok' => true, 'channel' => { 'id' => 'C123456' })
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'translates a channel that starts with a #' do
|
34
|
-
expect(conversations.conversations_id(channel: '#general')).to(
|
35
|
-
eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' })
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'fails with an exception' do
|
40
|
-
expect { conversations.conversations_id(channel: '#invalid') }.to(
|
41
|
-
raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found')
|
42
|
-
)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Mixins::Users do
|
5
|
-
subject(:users) do
|
6
|
-
klass.new
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:klass) do
|
10
|
-
Class.new do
|
11
|
-
include Slack::Web::Api::Mixins::Users
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
before do
|
16
|
-
allow(users).to receive(:users_list).and_yield(
|
17
|
-
Slack::Messages::Message.new(
|
18
|
-
'members' => [{
|
19
|
-
'id' => 'UDEADBEEF',
|
20
|
-
'name' => 'aws',
|
21
|
-
'profile' => {}
|
22
|
-
}]
|
23
|
-
)
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
|
-
context '#users_id' do
|
28
|
-
it 'leaves users specified by ID alone' do
|
29
|
-
expect(users.users_id(user: 'U123456')).to eq('ok' => true, 'user' => { 'id' => 'U123456' })
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'translates a user that starts with a #' do
|
33
|
-
expect(users.users_id(user: '@aws')).to eq('ok' => true, 'user' => { 'id' => 'UDEADBEEF' })
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'fails with an exception' do
|
37
|
-
expect { users.users_id(user: '@foo') }.to(
|
38
|
-
raise_error(Slack::Web::Api::Errors::SlackError, 'user_not_found')
|
39
|
-
)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
if defined?(Picky)
|
44
|
-
context '#users_search' do
|
45
|
-
it 'finds a user' do
|
46
|
-
expect(users.users_search(user: 'aws')).to(
|
47
|
-
eq('ok' => true, 'members' => [{ 'id' => 'UDEADBEEF', 'name' => 'aws', 'profile' => {} }])
|
48
|
-
)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Error do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
describe '#encode_options_as_json' do
|
8
|
-
let(:encoded_options) { client.encode_options_as_json(options, keys) }
|
9
|
-
|
10
|
-
let(:keys) { %i[attachments blocks metadata] }
|
11
|
-
|
12
|
-
context 'with some of the keys present in the options' do
|
13
|
-
let(:options) do
|
14
|
-
{
|
15
|
-
text: 'Hello, world!',
|
16
|
-
blocks: blocks,
|
17
|
-
metadata: metadata
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'and non-string objects in those keys' do
|
22
|
-
let(:blocks) { [{ type: 'section' }, { type: 'actions' }] }
|
23
|
-
let(:metadata) { { external_id: SecureRandom.uuid } }
|
24
|
-
|
25
|
-
it 'encodes the named keys into json' do
|
26
|
-
expect(encoded_options).to eql(
|
27
|
-
text: 'Hello, world!',
|
28
|
-
blocks: JSON.dump(blocks),
|
29
|
-
metadata: JSON.dump(metadata)
|
30
|
-
)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'and string objects in those keys' do
|
35
|
-
let(:blocks) { JSON.dump([{ type: 'section' }, { type: 'actions' }]) }
|
36
|
-
let(:metadata) { JSON.dump({ external_id: SecureRandom.uuid }) }
|
37
|
-
|
38
|
-
it 'returns the original options' do
|
39
|
-
expect(encoded_options).to eql(options)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with none of the keys present in the options' do
|
45
|
-
let(:options) do
|
46
|
-
{
|
47
|
-
text: 'Hello, world!'
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'returns the original options' do
|
52
|
-
expect(encoded_options).to eql(options)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with no keys given' do
|
57
|
-
let(:options) do
|
58
|
-
{
|
59
|
-
text: 'Hello, world!'
|
60
|
-
}
|
61
|
-
end
|
62
|
-
let(:keys) { [] }
|
63
|
-
|
64
|
-
it 'returns the original options' do
|
65
|
-
expect(encoded_options).to eql(options)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|