slack-ruby-client 2.4.0 → 2.5.1
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 +1 -0
- data/.github/workflows/update_api.yml +2 -2
- data/.rubocop_todo.yml +47 -16
- data/CHANGELOG.md +30 -13
- data/CONTRIBUTING.md +7 -7
- data/Gemfile +1 -0
- data/README.md +41 -23
- data/bin/commands/admin_conversations.rb +21 -0
- data/bin/commands/admin_users_session.rb +1 -1
- data/bin/commands/admin_workflows.rb +3 -1
- data/bin/commands/admin_workflows_triggers_types_permissions.rb +4 -4
- data/bin/commands/assistant_threads.rb +45 -0
- data/bin/commands/bookmarks.rb +1 -0
- data/bin/commands/canvases.rb +4 -4
- data/bin/commands/canvases_access.rb +3 -3
- data/bin/commands/chat.rb +7 -3
- data/bin/commands/conversations.rb +5 -5
- data/bin/commands/conversations_canvases.rb +2 -2
- data/bin/commands/conversations_requestSharedInvite.rb +48 -0
- data/bin/commands/files.rb +2 -1
- data/bin/commands/usergroups.rb +5 -0
- data/bin/commands/usergroups_users.rb +2 -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 +1 -1
- 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_users_session.rb +2 -3
- data/lib/slack/web/api/endpoints/admin_workflows.rb +5 -1
- data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +2 -2
- 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 +2 -2
- data/lib/slack/web/api/endpoints/canvases_access.rb +4 -4
- data/lib/slack/web/api/endpoints/chat.rb +11 -3
- data/lib/slack/web/api/endpoints/conversations.rb +4 -4
- data/lib/slack/web/api/endpoints/conversations_canvases.rb +1 -1
- data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +73 -0
- data/lib/slack/web/api/endpoints/files.rb +3 -1
- 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.rb +4 -0
- data/lib/slack/web/api/errors.rb +48 -4
- 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 -1
- data/lib/slack/web/api/templates/method_spec.erb +4 -5
- 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/lib/tasks/web.rake +1 -3
- data/slack-ruby-client.gemspec +2 -1
- metadata +32 -154
- 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 -156
- 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/admin_workflows_triggers_types_permissions_spec.rb +0 -21
- 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 -74
- 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/canvases_access_spec.rb +0 -21
- data/spec/slack/web/api/endpoints/canvases_sections_spec.rb +0 -16
- data/spec/slack/web/api/endpoints/canvases_spec.rb +0 -21
- 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_canvases_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/conversations_externalInvitePermissions_spec.rb +0 -19
- 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 -18
- 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_distributions_permissions_spec.rb +0 -10
- 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_externalTeams_spec.rb +0 -13
- 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_discoverableContacts_spec.rb +0 -13
- 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/endpoints/workflows_triggers_permissions_spec.rb +0 -31
- 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,134 +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::Chat do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'chat_postEphemeral' do
|
9
|
-
it 'requires one of attachments, blocks, text' do
|
10
|
-
expect { client.chat_postEphemeral(channel: %q[C1234567890], user: %q[U0BPQUNTA]) }.to raise_error ArgumentError, /At least one of/
|
11
|
-
|
12
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
13
|
-
client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
14
|
-
|
15
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
16
|
-
client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
17
|
-
|
18
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
19
|
-
client.chat_postEphemeral(text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
20
|
-
|
21
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
22
|
-
client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
23
|
-
|
24
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
25
|
-
client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
26
|
-
|
27
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
28
|
-
client.chat_postEphemeral(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
29
|
-
|
30
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA]})
|
31
|
-
client.chat_postEphemeral(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], user: %q[U0BPQUNTA])
|
32
|
-
end
|
33
|
-
it 'encodes attachments, blocks as json' do
|
34
|
-
expect(client).to receive(:post).with('chat.postEphemeral', {channel: %q[C1234567890], user: %q[U0BPQUNTA], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}]})
|
35
|
-
client.chat_postEphemeral(channel: %q[C1234567890], user: %q[U0BPQUNTA], attachments: {:data=>["data"]}, blocks: {:data=>["data"]})
|
36
|
-
end
|
37
|
-
end
|
38
|
-
context 'chat_postMessage' do
|
39
|
-
it 'requires one of attachments, blocks, text' do
|
40
|
-
expect { client.chat_postMessage(channel: %q[C1234567890]) }.to raise_error ArgumentError, /At least one of/
|
41
|
-
|
42
|
-
expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890]})
|
43
|
-
client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890])
|
44
|
-
|
45
|
-
expect(client).to receive(:post).with('chat.postMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890]})
|
46
|
-
client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890])
|
47
|
-
|
48
|
-
expect(client).to receive(:post).with('chat.postMessage', {text: %q[Hello world], channel: %q[C1234567890]})
|
49
|
-
client.chat_postMessage(text: %q[Hello world], channel: %q[C1234567890])
|
50
|
-
|
51
|
-
expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890]})
|
52
|
-
client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890])
|
53
|
-
|
54
|
-
expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890]})
|
55
|
-
client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890])
|
56
|
-
|
57
|
-
expect(client).to receive(:post).with('chat.postMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890]})
|
58
|
-
client.chat_postMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890])
|
59
|
-
|
60
|
-
expect(client).to receive(:post).with('chat.postMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890]})
|
61
|
-
client.chat_postMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890])
|
62
|
-
end
|
63
|
-
it 'encodes attachments, blocks, metadata as json' do
|
64
|
-
expect(client).to receive(:post).with('chat.postMessage', {channel: %q[C1234567890], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]})
|
65
|
-
client.chat_postMessage(channel: %q[C1234567890], attachments: {:data=>["data"]}, blocks: {:data=>["data"]}, metadata: {:data=>["data"]})
|
66
|
-
end
|
67
|
-
end
|
68
|
-
context 'chat_scheduleMessage' do
|
69
|
-
it 'requires one of attachments, blocks, text' do
|
70
|
-
expect { client.chat_scheduleMessage(channel: %q[C1234567890], post_at: %q[299876400]) }.to raise_error ArgumentError, /At least one of/
|
71
|
-
|
72
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], post_at: %q[299876400]})
|
73
|
-
client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], post_at: %q[299876400])
|
74
|
-
|
75
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], post_at: %q[299876400]})
|
76
|
-
client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], post_at: %q[299876400])
|
77
|
-
|
78
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400]})
|
79
|
-
client.chat_scheduleMessage(text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400])
|
80
|
-
|
81
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], post_at: %q[299876400]})
|
82
|
-
client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], post_at: %q[299876400])
|
83
|
-
|
84
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400]})
|
85
|
-
client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400])
|
86
|
-
|
87
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400]})
|
88
|
-
client.chat_scheduleMessage(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400])
|
89
|
-
|
90
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400]})
|
91
|
-
client.chat_scheduleMessage(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], post_at: %q[299876400])
|
92
|
-
end
|
93
|
-
it 'encodes attachments, blocks, metadata as json' do
|
94
|
-
expect(client).to receive(:post).with('chat.scheduleMessage', {channel: %q[C1234567890], post_at: %q[299876400], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]})
|
95
|
-
client.chat_scheduleMessage(channel: %q[C1234567890], post_at: %q[299876400], attachments: {:data=>["data"]}, blocks: {:data=>["data"]}, metadata: {:data=>["data"]})
|
96
|
-
end
|
97
|
-
end
|
98
|
-
context 'chat_unfurl' do
|
99
|
-
it 'encodes unfurls, user_auth_blocks as json' do
|
100
|
-
expect(client).to receive(:post).with('chat.unfurl', {channel: %q[C1234567890], ts: %q[], unfurls: %q[{"data":["data"]}], user_auth_blocks: %q[{"data":["data"]}]})
|
101
|
-
client.chat_unfurl(channel: %q[C1234567890], ts: %q[], unfurls: {:data=>["data"]}, user_auth_blocks: {:data=>["data"]})
|
102
|
-
end
|
103
|
-
end
|
104
|
-
context 'chat_update' do
|
105
|
-
it 'requires one of attachments, blocks, text' do
|
106
|
-
expect { client.chat_update(channel: %q[C1234567890], ts: %q["1405894322.002768"]) }.to raise_error ArgumentError, /At least one of/
|
107
|
-
|
108
|
-
expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
109
|
-
client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
110
|
-
|
111
|
-
expect(client).to receive(:post).with('chat.update', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
112
|
-
client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
113
|
-
|
114
|
-
expect(client).to receive(:post).with('chat.update', {text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
115
|
-
client.chat_update(text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
116
|
-
|
117
|
-
expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
118
|
-
client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
119
|
-
|
120
|
-
expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
121
|
-
client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
122
|
-
|
123
|
-
expect(client).to receive(:post).with('chat.update', {blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
124
|
-
client.chat_update(blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
125
|
-
|
126
|
-
expect(client).to receive(:post).with('chat.update', {attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"]})
|
127
|
-
client.chat_update(attachments: %q[[{"pretext": "pre-hello", "text": "text-world"}]], blocks: %q[[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]], text: %q[Hello world], channel: %q[C1234567890], ts: %q["1405894322.002768"])
|
128
|
-
end
|
129
|
-
it 'encodes attachments, blocks, metadata as json' do
|
130
|
-
expect(client).to receive(:post).with('chat.update', {channel: %q[C1234567890], ts: %q["1405894322.002768"], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]})
|
131
|
-
client.chat_update(channel: %q[C1234567890], ts: %q["1405894322.002768"], attachments: {:data=>["data"]}, blocks: {:data=>["data"]}, metadata: {:data=>["data"]})
|
132
|
-
end
|
133
|
-
end
|
134
|
-
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::ConversationsCanvases do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'conversations.canvases_create' do
|
9
|
-
it 'requires channel_id' do
|
10
|
-
expect { client.conversations_canvases_create }.to raise_error ArgumentError, /Required arguments :channel_id missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,19 +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::ConversationsExternalinvitepermissions do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'conversations.externalInvitePermissions_set' do
|
9
|
-
it 'requires action' do
|
10
|
-
expect { client.conversations_externalInvitePermissions_set(channel: %q[C123456], target_team: %q[T726G27TT]) }.to raise_error ArgumentError, /Required arguments :action missing/
|
11
|
-
end
|
12
|
-
it 'requires channel' do
|
13
|
-
expect { client.conversations_externalInvitePermissions_set(action: %q[upgrade], target_team: %q[T726G27TT]) }.to raise_error ArgumentError, /Required arguments :channel missing/
|
14
|
-
end
|
15
|
-
it 'requires target_team' do
|
16
|
-
expect { client.conversations_externalInvitePermissions_set(action: %q[upgrade], channel: %q[C123456]) }.to raise_error ArgumentError, /Required arguments :target_team missing/
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Auth do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
context 'without auth', vcr: { cassette_name: 'web/auth_test_error' } do
|
8
|
-
it 'fails with an exception' do
|
9
|
-
expect { client.auth_test }.to raise_error Slack::Web::Api::Errors::SlackError, 'not_authed'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context 'with auth', vcr: { cassette_name: 'web/auth_test_success' } do
|
14
|
-
it 'succeeds' do
|
15
|
-
expect { client.auth_test }.not_to raise_error
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context '429 error', vcr: { cassette_name: 'web/429_error' } do
|
20
|
-
it 'fails with an specific exception' do
|
21
|
-
client.auth_test
|
22
|
-
rescue Slack::Web::Api::Errors::TooManyRequestsError => e
|
23
|
-
expect(e.message).to eq('Retry after 3600 seconds')
|
24
|
-
expect(e.retry_after).to eq(3600)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,206 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Chat do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
context 'chat_postEphemeral' do
|
8
|
-
let(:user) { OpenStruct.new(user: { id: '123' }) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
allow(described_class).to receive(:users_id).and_return(user)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'automatically converts attachments and blocks into JSON' do
|
15
|
-
expect(client).to receive(:post).with(
|
16
|
-
'chat.postEphemeral',
|
17
|
-
{
|
18
|
-
channel: 'channel',
|
19
|
-
text: 'text',
|
20
|
-
user: '123',
|
21
|
-
attachments: '[]',
|
22
|
-
blocks: '[]'
|
23
|
-
}
|
24
|
-
)
|
25
|
-
client.chat_postEphemeral(
|
26
|
-
channel: 'channel',
|
27
|
-
text: 'text',
|
28
|
-
user: '123',
|
29
|
-
attachments: [],
|
30
|
-
blocks: []
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'text and user arguments' do
|
35
|
-
it 'requires text or attachments' do
|
36
|
-
expect { client.chat_postEphemeral(channel: 'channel', user: '123') }.to(
|
37
|
-
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'requires user' do
|
42
|
-
expect { client.chat_postEphemeral(channel: 'channel', text: 'text') }.to(
|
43
|
-
raise_error(ArgumentError, /Required arguments :user missing/)
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'both text and user' do
|
48
|
-
expect(client).to(
|
49
|
-
receive(:post).with('chat.postEphemeral', hash_including(text: 'text', user: '123'))
|
50
|
-
)
|
51
|
-
expect do
|
52
|
-
client.chat_postEphemeral(channel: 'channel', text: 'text', user: '123')
|
53
|
-
end.not_to raise_error
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'attachments argument' do
|
58
|
-
it 'optional attachments' do
|
59
|
-
expect(client).to(
|
60
|
-
receive(:post).with('chat.postEphemeral', hash_including(attachments: '[]'))
|
61
|
-
)
|
62
|
-
expect do
|
63
|
-
client.chat_postEphemeral(channel: 'channel', text: 'text', user: '123', attachments: [])
|
64
|
-
end.not_to raise_error
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'attachments without text' do
|
68
|
-
expect(client).to(
|
69
|
-
receive(:post).with('chat.postEphemeral', hash_including(attachments: '[]'))
|
70
|
-
)
|
71
|
-
expect do
|
72
|
-
client.chat_postEphemeral(channel: 'channel', attachments: [], user: '123')
|
73
|
-
end.not_to raise_error
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context 'blocks argument' do
|
78
|
-
it 'optional blocks' do
|
79
|
-
expect(client).to receive(:post).with('chat.postEphemeral', hash_including(blocks: '[]'))
|
80
|
-
expect do
|
81
|
-
client.chat_postEphemeral(channel: 'channel', text: 'text', user: '123', blocks: [])
|
82
|
-
end.not_to raise_error
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'blocks without text' do
|
86
|
-
expect(client).to receive(:post).with('chat.postEphemeral', hash_including(blocks: '[]'))
|
87
|
-
expect do
|
88
|
-
client.chat_postEphemeral(channel: 'channel', blocks: [], user: '123')
|
89
|
-
end.not_to raise_error
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'chat_postMessage' do
|
95
|
-
it 'automatically converts attachments and blocks into JSON' do
|
96
|
-
expect(client).to receive(:post).with(
|
97
|
-
'chat.postMessage',
|
98
|
-
{
|
99
|
-
channel: 'channel',
|
100
|
-
text: 'text',
|
101
|
-
attachments: '[]',
|
102
|
-
blocks: '[]'
|
103
|
-
}
|
104
|
-
)
|
105
|
-
client.chat_postMessage(channel: 'channel', text: 'text', attachments: [], blocks: [])
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'text, attachment and blocks arguments' do
|
109
|
-
it 'requires text, attachments or blocks' do
|
110
|
-
expect { client.chat_postMessage(channel: 'channel') }.to(
|
111
|
-
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
it 'only text' do
|
116
|
-
expect(client).to receive(:post).with('chat.postMessage', hash_including(text: 'text'))
|
117
|
-
expect { client.chat_postMessage(channel: 'channel', text: 'text') }.not_to raise_error
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'only attachments' do
|
121
|
-
expect(client).to receive(:post).with('chat.postMessage', hash_including(attachments: '[]'))
|
122
|
-
expect { client.chat_postMessage(channel: 'channel', attachments: []) }.not_to raise_error
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'only blocks' do
|
126
|
-
expect(client).to receive(:post).with('chat.postMessage', hash_including(blocks: '[]'))
|
127
|
-
expect { client.chat_postMessage(channel: 'channel', blocks: []) }.not_to raise_error
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'all text, attachments and blocks' do
|
131
|
-
expect(client).to(
|
132
|
-
receive(:post)
|
133
|
-
.with('chat.postMessage', hash_including(text: 'text', attachments: '[]', blocks: '[]'))
|
134
|
-
)
|
135
|
-
expect do
|
136
|
-
client.chat_postMessage(channel: 'channel', text: 'text', attachments: [], blocks: [])
|
137
|
-
end.not_to raise_error
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
context 'chat_update' do
|
143
|
-
let(:ts) { '1405894322.002768' }
|
144
|
-
|
145
|
-
it 'automatically converts attachments and blocks into JSON' do
|
146
|
-
expect(client).to receive(:post).with(
|
147
|
-
'chat.update',
|
148
|
-
{
|
149
|
-
channel: 'channel',
|
150
|
-
text: 'text',
|
151
|
-
ts: ts,
|
152
|
-
attachments: '[]',
|
153
|
-
blocks: '[]'
|
154
|
-
}
|
155
|
-
)
|
156
|
-
client.chat_update(channel: 'channel', text: 'text', ts: ts, attachments: [], blocks: [])
|
157
|
-
end
|
158
|
-
|
159
|
-
context 'ts arguments' do
|
160
|
-
it 'requires ts' do
|
161
|
-
expect do
|
162
|
-
client.chat_update(channel: 'channel', text: 'text')
|
163
|
-
end.to raise_error(ArgumentError, /Required arguments :ts missing/)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
context 'text, attachment and blocks arguments' do
|
168
|
-
it 'requires text, attachments, blocks or reply_broadcast' do
|
169
|
-
expect { client.chat_update(channel: 'channel', ts: ts) }.to(
|
170
|
-
raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
|
171
|
-
)
|
172
|
-
end
|
173
|
-
|
174
|
-
it 'only text' do
|
175
|
-
expect(client).to receive(:post).with('chat.update', hash_including(text: 'text'))
|
176
|
-
expect do
|
177
|
-
client.chat_update(channel: 'channel', text: 'text', ts: ts)
|
178
|
-
end.not_to raise_error
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'only attachments' do
|
182
|
-
expect(client).to receive(:post).with('chat.update', hash_including(attachments: '[]'))
|
183
|
-
expect do
|
184
|
-
client.chat_update(channel: 'channel', ts: ts, attachments: [])
|
185
|
-
end.not_to raise_error
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'only blocks' do
|
189
|
-
expect(client).to receive(:post).with('chat.update', hash_including(blocks: '[]'))
|
190
|
-
expect do
|
191
|
-
client.chat_update(channel: 'channel', ts: ts, blocks: [])
|
192
|
-
end.not_to raise_error
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'all text, attachments and blocks' do
|
196
|
-
expect(client).to(
|
197
|
-
receive(:post)
|
198
|
-
.with('chat.update', hash_including(text: 'text', attachments: '[]', blocks: '[]'))
|
199
|
-
)
|
200
|
-
expect do
|
201
|
-
client.chat_update(channel: 'channel', text: 'text', ts: ts, attachments: [], blocks: [])
|
202
|
-
end.not_to raise_error
|
203
|
-
end
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Conversations do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
context 'groups' do
|
8
|
-
it 'info', vcr: { cassette_name: 'web/conversations_info' } do
|
9
|
-
json = client.conversations_info(channel: '#mpdm-dblock--rubybot--player1-1')
|
10
|
-
expect(json.channel.name).to eq 'mpdm-dblock--rubybot--player1-1'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Dialog do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
context 'dialog_open' do
|
8
|
-
it 'automatically converts dialog into JSON' do
|
9
|
-
expect(client).to receive(:post).with(
|
10
|
-
'dialog.open',
|
11
|
-
{
|
12
|
-
trigger_id: '12345.98765.abcd2358fdea',
|
13
|
-
dialog: '[]'
|
14
|
-
}
|
15
|
-
)
|
16
|
-
client.dialog_open(trigger_id: '12345.98765.abcd2358fdea', dialog: [])
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'arguments' do
|
20
|
-
it 'requires dialog' do
|
21
|
-
expect { client.dialog_open(trigger_id: '123') }.to(
|
22
|
-
raise_error(ArgumentError, /Required arguments :dialog missing/)
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'requires trigger_id' do
|
27
|
-
expect { client.dialog_open(dialog: []) }.to(
|
28
|
-
raise_error(ArgumentError, /Required arguments :trigger_id missing/)
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'likes both dialog and trigger_id' do
|
33
|
-
expect(client).to(
|
34
|
-
receive(:post).with('dialog.open', hash_including(trigger_id: '123', dialog: '[]'))
|
35
|
-
)
|
36
|
-
expect { client.dialog_open(dialog: [], trigger_id: '123') }.not_to raise_error
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Users do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
|
7
|
-
context 'users' do
|
8
|
-
it 'list', vcr: { cassette_name: 'web/users_list' } do
|
9
|
-
json = client.users_list(presence: true)
|
10
|
-
expect(json.ok).to be true
|
11
|
-
expect(json.members.size).to eq 35
|
12
|
-
expect(json.members.first.presence).to eq 'away'
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'paginated list', vcr: { cassette_name: 'web/paginated_users_list' } do
|
16
|
-
members = []
|
17
|
-
client.users_list(presence: true, limit: 5) do |json|
|
18
|
-
expect(json.ok).to be true
|
19
|
-
members.concat json.members
|
20
|
-
end
|
21
|
-
expect(members.size).to eq 35
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'info', vcr: { cassette_name: 'web/users_info' } do
|
25
|
-
json = client.users_info(user: '@aws')
|
26
|
-
expect(json.user.name).to eq 'aws'
|
27
|
-
end
|
28
|
-
|
29
|
-
if defined?(Picky)
|
30
|
-
it 'search', vcr: { cassette_name: 'web/users_info' } do
|
31
|
-
json = client.users_search(user: 'aws')
|
32
|
-
expect(json.ok).to be true
|
33
|
-
expect(json.members.size).to eq 1
|
34
|
-
expect(json.members.first.name).to eq 'aws'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
RSpec.describe Slack::Web::Api::Endpoints::Views do
|
5
|
-
let(:client) { Slack::Web::Client.new }
|
6
|
-
let(:trigger_id) { '12345.98765.abcd2358fdea' }
|
7
|
-
let(:view_id) { 'abc123567' }
|
8
|
-
|
9
|
-
describe 'views_open' do
|
10
|
-
context 'with a hash for view' do
|
11
|
-
let(:view_str) { '{"celery":"man"}' }
|
12
|
-
|
13
|
-
it 'automatically converts view into JSON' do
|
14
|
-
expect(client).to receive(:post).with('views.open', { trigger_id: trigger_id, view: view_str })
|
15
|
-
client.views_open(trigger_id: trigger_id, view: { celery: 'man' })
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context 'with a string for view' do
|
20
|
-
let(:view_str) { 'celery man' }
|
21
|
-
|
22
|
-
it 'leaves view as is' do
|
23
|
-
expect(client).to receive(:post).with('views.open', { trigger_id: trigger_id, view: view_str })
|
24
|
-
client.views_open(trigger_id: trigger_id, view: 'celery man')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'views_publish' do
|
30
|
-
let(:user_id) { 'U1234' }
|
31
|
-
|
32
|
-
context 'with a hash for view' do
|
33
|
-
let(:view_str) { '{"celery":"man"}' }
|
34
|
-
|
35
|
-
it 'automatically converts view into JSON' do
|
36
|
-
expect(client).to receive(:post).with(
|
37
|
-
'views.publish',
|
38
|
-
{
|
39
|
-
trigger_id: trigger_id,
|
40
|
-
user_id: user_id,
|
41
|
-
view: view_str
|
42
|
-
}
|
43
|
-
)
|
44
|
-
client.views_publish(user_id: user_id, trigger_id: trigger_id, view: { celery: 'man' })
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'with a string for view' do
|
49
|
-
let(:view_str) { 'celery man' }
|
50
|
-
|
51
|
-
it 'leaves view as is' do
|
52
|
-
expect(client).to receive(:post).with(
|
53
|
-
'views.publish',
|
54
|
-
{
|
55
|
-
user_id: user_id,
|
56
|
-
trigger_id: trigger_id,
|
57
|
-
view: view_str
|
58
|
-
}
|
59
|
-
)
|
60
|
-
client.views_publish(user_id: user_id, trigger_id: trigger_id, view: 'celery man')
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe 'views_push' do
|
66
|
-
context 'with a hash for view' do
|
67
|
-
let(:view_str) { '{"celery":"man"}' }
|
68
|
-
|
69
|
-
it 'automatically converts view into JSON' do
|
70
|
-
expect(client).to receive(:post).with('views.push', { trigger_id: trigger_id, view: view_str })
|
71
|
-
client.views_push(trigger_id: trigger_id, view: { celery: 'man' })
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'with a string for view' do
|
76
|
-
let(:view_str) { 'celery man' }
|
77
|
-
|
78
|
-
it 'leaves view as is' do
|
79
|
-
expect(client).to receive(:post).with('views.push', { trigger_id: trigger_id, view: view_str })
|
80
|
-
client.views_push(trigger_id: trigger_id, view: 'celery man')
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe 'views_update' do
|
86
|
-
context 'with a hash for view' do
|
87
|
-
let(:view_str) { '{"celery":"man"}' }
|
88
|
-
|
89
|
-
it 'automatically converts view into JSON' do
|
90
|
-
expect(client).to receive(:post).with('views.update', { view_id: view_id, view: view_str })
|
91
|
-
client.views_update(view_id: view_id, view: { celery: 'man' })
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context 'with a string for view' do
|
96
|
-
let(:view_str) { 'celery man' }
|
97
|
-
|
98
|
-
it 'leaves view as is' do
|
99
|
-
expect(client).to receive(:post).with('views.update', { view_id: view_id, view: view_str })
|
100
|
-
client.views_update(view_id: view_id, view: 'celery man')
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'with both an external_id and view_id' do
|
104
|
-
it 'raises error' do
|
105
|
-
expect do
|
106
|
-
client.views_update(external_id: trigger_id, view_id: view_id, view: 'celery man')
|
107
|
-
end.to raise_error ArgumentError, 'Exactly one of :external_id, :view_id is required'
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
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::Dialog do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'dialog_open' do
|
9
|
-
it 'encodes dialog as json' do
|
10
|
-
expect(client).to receive(:post).with('dialog.open', {dialog: %q[{"data":["data"]}], trigger_id: %q[12345.98765.abcd2358fdea]})
|
11
|
-
client.dialog_open(dialog: {:data=>["data"]}, trigger_id: %q[12345.98765.abcd2358fdea])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
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::Dnd do
|
7
|
-
let(:client) { Slack::Web::Client.new }
|
8
|
-
context 'dnd_setSnooze' do
|
9
|
-
it 'requires num_minutes' do
|
10
|
-
expect { client.dnd_setSnooze }.to raise_error ArgumentError, /Required arguments :num_minutes missing/
|
11
|
-
end
|
12
|
-
end
|
13
|
-
context 'dnd_teamInfo' do
|
14
|
-
it 'requires users' do
|
15
|
-
expect { client.dnd_teamInfo }.to raise_error ArgumentError, /Required arguments :users missing/
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|