slack-ruby-client 2.2.0 → 2.4.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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/integration_test.yml +1 -1
  4. data/.github/workflows/lint.yml +1 -1
  5. data/.github/workflows/pr_lint.yml +1 -1
  6. data/.github/workflows/test.yml +23 -13
  7. data/.github/workflows/update_api.yml +8 -3
  8. data/.gitignore +1 -0
  9. data/CHANGELOG.md +14 -0
  10. data/README.md +27 -2
  11. data/bin/commands/admin_apps_activities.rb +4 -4
  12. data/bin/commands/admin_apps_config.rb +2 -2
  13. data/bin/commands/admin_conversations.rb +2 -1
  14. data/bin/commands/admin_emoji.rb +1 -1
  15. data/bin/commands/admin_users.rb +6 -4
  16. data/bin/commands/admin_workflows.rb +4 -2
  17. data/bin/commands/admin_workflows_triggers_types_permissions.rb +31 -0
  18. data/bin/commands/apps_datastore.rb +46 -0
  19. data/bin/commands/canvases.rb +40 -0
  20. data/bin/commands/canvases_access.rb +34 -0
  21. data/bin/commands/canvases_sections.rb +21 -0
  22. data/bin/commands/chat.rb +9 -9
  23. data/bin/commands/conversations.rb +3 -2
  24. data/bin/commands/conversations_canvases.rb +21 -0
  25. data/bin/commands/conversations_externalInvitePermissions.rb +22 -0
  26. data/bin/commands/functions.rb +31 -0
  27. data/bin/commands/functions_distributions_permissions.rb +59 -0
  28. data/bin/commands/oauth.rb +2 -2
  29. data/bin/commands/oauth_v2.rb +2 -2
  30. data/bin/commands/pins.rb +0 -1
  31. data/bin/commands/reminders.rb +1 -1
  32. data/bin/commands/team.rb +2 -2
  33. data/bin/commands/team_externalTeams.rb +35 -0
  34. data/bin/commands/usergroups.rb +10 -10
  35. data/bin/commands/usergroups_users.rb +8 -8
  36. data/bin/commands/users_discoverableContacts.rb +20 -0
  37. data/bin/commands/workflows_triggers_permissions.rb +60 -0
  38. data/lib/slack/events/request.rb +4 -2
  39. data/lib/slack/messages/formatting.rb +13 -0
  40. data/lib/slack/version.rb +1 -1
  41. data/lib/slack/web/api/endpoints/admin_apps_activities.rb +5 -5
  42. data/lib/slack/web/api/endpoints/admin_apps_config.rb +3 -3
  43. data/lib/slack/web/api/endpoints/admin_conversations.rb +3 -1
  44. data/lib/slack/web/api/endpoints/admin_emoji.rb +1 -1
  45. data/lib/slack/web/api/endpoints/admin_functions_permissions.rb +1 -1
  46. data/lib/slack/web/api/endpoints/admin_users.rb +6 -2
  47. data/lib/slack/web/api/endpoints/admin_workflows.rb +9 -5
  48. data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +41 -0
  49. data/lib/slack/web/api/endpoints/apps_activities.rb +1 -1
  50. data/lib/slack/web/api/endpoints/apps_datastore.rb +71 -0
  51. data/lib/slack/web/api/endpoints/canvases.rb +52 -0
  52. data/lib/slack/web/api/endpoints/canvases_access.rb +47 -0
  53. data/lib/slack/web/api/endpoints/canvases_sections.rb +27 -0
  54. data/lib/slack/web/api/endpoints/chat.rb +21 -21
  55. data/lib/slack/web/api/endpoints/conversations.rb +4 -2
  56. data/lib/slack/web/api/endpoints/conversations_canvases.rb +26 -0
  57. data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +31 -0
  58. data/lib/slack/web/api/endpoints/dnd.rb +1 -0
  59. data/lib/slack/web/api/endpoints/functions.rb +43 -0
  60. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +80 -0
  61. data/lib/slack/web/api/endpoints/oauth.rb +2 -2
  62. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  63. data/lib/slack/web/api/endpoints/openid_connect.rb +1 -1
  64. data/lib/slack/web/api/endpoints/pins.rb +0 -2
  65. data/lib/slack/web/api/endpoints/reminders.rb +1 -1
  66. data/lib/slack/web/api/endpoints/search.rb +3 -3
  67. data/lib/slack/web/api/endpoints/team.rb +3 -3
  68. data/lib/slack/web/api/endpoints/team_externalTeams.rb +53 -0
  69. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  70. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  71. data/lib/slack/web/api/endpoints/usergroups_users.rb +6 -6
  72. data/lib/slack/web/api/endpoints/users.rb +1 -1
  73. data/lib/slack/web/api/endpoints/users_discoverableContacts.rb +24 -0
  74. data/lib/slack/web/api/endpoints/workflows_triggers_permissions.rb +87 -0
  75. data/lib/slack/web/api/endpoints.rb +22 -0
  76. data/lib/slack/web/api/errors.rb +84 -4
  77. data/lib/slack/web/api/patches/.gitkeep +0 -0
  78. data/lib/slack/web/api/templates/method.erb +1 -0
  79. data/lib/slack/web/api/templates/method_spec.erb +2 -1
  80. data/spec/slack/events/request_spec.rb +11 -0
  81. data/spec/slack/messages/formatting_spec.rb +32 -0
  82. data/spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb +21 -0
  83. data/spec/slack/web/api/endpoints/apps_datastore_spec.rb +29 -0
  84. data/spec/slack/web/api/endpoints/canvases_access_spec.rb +21 -0
  85. data/spec/slack/web/api/endpoints/canvases_sections_spec.rb +16 -0
  86. data/spec/slack/web/api/endpoints/canvases_spec.rb +21 -0
  87. data/spec/slack/web/api/endpoints/chat_spec.rb +76 -4
  88. data/spec/slack/web/api/endpoints/conversations_canvases_spec.rb +13 -0
  89. data/spec/slack/web/api/endpoints/conversations_externalInvitePermissions_spec.rb +19 -0
  90. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +2 -9
  91. data/spec/slack/web/api/endpoints/dnd_spec.rb +5 -0
  92. data/spec/slack/web/api/endpoints/functions_distributions_permissions_spec.rb +10 -0
  93. data/spec/slack/web/api/endpoints/functions_spec.rb +28 -0
  94. data/spec/slack/web/api/endpoints/team_externalTeams_spec.rb +13 -0
  95. data/spec/slack/web/api/endpoints/users_discoverableContacts_spec.rb +13 -0
  96. data/spec/slack/web/api/endpoints/workflows_triggers_permissions_spec.rb +31 -0
  97. metadata +37 -3
  98. data/lib/slack/web/api/patches/chat.attachments-blocks.patch +0 -21
@@ -0,0 +1,21 @@
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::Canvases do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'canvases_delete' do
9
+ it 'requires canvas_id' do
10
+ expect { client.canvases_delete }.to raise_error ArgumentError, /Required arguments :canvas_id missing/
11
+ end
12
+ end
13
+ context 'canvases_edit' do
14
+ it 'requires canvas_id' do
15
+ expect { client.canvases_edit(changes: %q[[{"operation":"insert_before","document_content":{"type":"markdown","markdown":"Example content"},"section_id":"temp:C:AAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]]) }.to raise_error ArgumentError, /Required arguments :canvas_id missing/
16
+ end
17
+ it 'requires changes' do
18
+ expect { client.canvases_edit(canvas_id: %q[F1234ABCD]) }.to raise_error ArgumentError, /Required arguments :changes missing/
19
+ end
20
+ end
21
+ end
@@ -6,9 +6,33 @@ require 'spec_helper'
6
6
  RSpec.describe Slack::Web::Api::Endpoints::Chat do
7
7
  let(:client) { Slack::Web::Client.new }
8
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
9
33
  it 'encodes attachments, blocks as json' do
10
- expect(client).to receive(:post).with('chat.postEphemeral', {channel: %q[C1234567890], text: %q[Hello world], user: %q[U0BPQUNTA], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}]})
11
- client.chat_postEphemeral(channel: %q[C1234567890], text: %q[Hello world], user: %q[U0BPQUNTA], attachments: {:data=>["data"]}, blocks: {:data=>["data"]})
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"]})
12
36
  end
13
37
  end
14
38
  context 'chat_postMessage' do
@@ -42,9 +66,33 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
42
66
  end
43
67
  end
44
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
45
93
  it 'encodes attachments, blocks, metadata as json' do
46
- expect(client).to receive(:post).with('chat.scheduleMessage', {channel: %q[C1234567890], post_at: %q[299876400], text: %q[Hello world], attachments: %q[{"data":["data"]}], blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]})
47
- client.chat_scheduleMessage(channel: %q[C1234567890], post_at: %q[299876400], text: %q[Hello world], attachments: {:data=>["data"]}, blocks: {:data=>["data"]}, metadata: {:data=>["data"]})
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"]})
48
96
  end
49
97
  end
50
98
  context 'chat_unfurl' do
@@ -54,6 +102,30 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
54
102
  end
55
103
  end
56
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
57
129
  it 'encodes attachments, blocks, metadata as json' do
58
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"]}]})
59
131
  client.chat_update(channel: %q[C1234567890], ts: %q["1405894322.002768"], attachments: {:data=>["data"]}, blocks: {:data=>["data"]}, metadata: {:data=>["data"]})
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,19 @@
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
@@ -33,7 +33,7 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
33
33
 
34
34
  context 'text and user arguments' do
35
35
  it 'requires text or attachments' do
36
- expect { client.chat_postEphemeral(channel: 'channel') }.to(
36
+ expect { client.chat_postEphemeral(channel: 'channel', user: '123') }.to(
37
37
  raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
38
38
  )
39
39
  end
@@ -167,7 +167,7 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
167
167
  context 'text, attachment and blocks arguments' do
168
168
  it 'requires text, attachments, blocks or reply_broadcast' do
169
169
  expect { client.chat_update(channel: 'channel', ts: ts) }.to(
170
- raise_error(ArgumentError, /At least one of :attachments, :blocks, :text, :reply_broadcast is required/)
170
+ raise_error(ArgumentError, /At least one of :attachments, :blocks, :text is required/)
171
171
  )
172
172
  end
173
173
 
@@ -192,13 +192,6 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do
192
192
  end.not_to raise_error
193
193
  end
194
194
 
195
- it 'only reply_broadcast' do
196
- expect(client).to receive(:post).with('chat.update', hash_including(reply_broadcast: true))
197
- expect do
198
- client.chat_update(channel: 'channel', ts: ts, reply_broadcast: true)
199
- end.not_to raise_error
200
- end
201
-
202
195
  it 'all text, attachments and blocks' do
203
196
  expect(client).to(
204
197
  receive(:post)
@@ -5,6 +5,11 @@ require 'spec_helper'
5
5
 
6
6
  RSpec.describe Slack::Web::Api::Endpoints::Dnd do
7
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
8
13
  context 'dnd_teamInfo' do
9
14
  it 'requires users' do
10
15
  expect { client.dnd_teamInfo }.to raise_error ArgumentError, /Required arguments :users missing/
@@ -0,0 +1,10 @@
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::FunctionsDistributionsPermissions do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'functions.distributions.permissions_set' do
9
+ end
10
+ end
@@ -0,0 +1,28 @@
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::Functions do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'functions_completeError' do
9
+ it 'requires error' do
10
+ expect { client.functions_completeError(function_execution_id: %q[Fx12345ABCDE]) }.to raise_error ArgumentError, /Required arguments :error missing/
11
+ end
12
+ it 'requires function_execution_id' do
13
+ expect { client.functions_completeError(error: %q[]) }.to raise_error ArgumentError, /Required arguments :function_execution_id missing/
14
+ end
15
+ end
16
+ context 'functions_completeSuccess' do
17
+ it 'requires function_execution_id' do
18
+ expect { client.functions_completeSuccess(outputs: %q[{"customer_id": "U0BPQUNTA"}]) }.to raise_error ArgumentError, /Required arguments :function_execution_id missing/
19
+ end
20
+ it 'requires outputs' do
21
+ expect { client.functions_completeSuccess(function_execution_id: %q[Fx12345ABCDE]) }.to raise_error ArgumentError, /Required arguments :outputs missing/
22
+ end
23
+ it 'encodes outputs as json' do
24
+ expect(client).to receive(:post).with('functions.completeSuccess', {function_execution_id: %q[Fx12345ABCDE], outputs: %q[{"data":["data"]}]})
25
+ client.functions_completeSuccess(function_execution_id: %q[Fx12345ABCDE], outputs: {:data=>["data"]})
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,13 @@
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::TeamExternalteams do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'team.externalTeams_disconnect' do
9
+ it 'requires target_team' do
10
+ expect { client.team_externalTeams_disconnect }.to raise_error ArgumentError, /Required arguments :target_team missing/
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
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::UsersDiscoverablecontacts do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'users.discoverableContacts_lookup' do
9
+ it 'requires email' do
10
+ expect { client.users_discoverableContacts_lookup }.to raise_error ArgumentError, /Required arguments :email missing/
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,31 @@
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::WorkflowsTriggersPermissions do
7
+ let(:client) { Slack::Web::Client.new }
8
+ context 'workflows.triggers.permissions_add' do
9
+ it 'requires trigger_id' do
10
+ expect { client.workflows_triggers_permissions_add }.to raise_error ArgumentError, /Required arguments :trigger_id missing/
11
+ end
12
+ end
13
+ context 'workflows.triggers.permissions_list' do
14
+ it 'requires trigger_id' do
15
+ expect { client.workflows_triggers_permissions_list }.to raise_error ArgumentError, /Required arguments :trigger_id missing/
16
+ end
17
+ end
18
+ context 'workflows.triggers.permissions_remove' do
19
+ it 'requires trigger_id' do
20
+ expect { client.workflows_triggers_permissions_remove }.to raise_error ArgumentError, /Required arguments :trigger_id missing/
21
+ end
22
+ end
23
+ context 'workflows.triggers.permissions_set' do
24
+ it 'requires permission_type' do
25
+ expect { client.workflows_triggers_permissions_set(trigger_id: %q[Ft0000000001]) }.to raise_error ArgumentError, /Required arguments :permission_type missing/
26
+ end
27
+ it 'requires trigger_id' do
28
+ expect { client.workflows_triggers_permissions_set(permission_type: %q[]) }.to raise_error ArgumentError, /Required arguments :trigger_id missing/
29
+ end
30
+ end
31
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-17 00:00:00.000000000 Z
11
+ date: 2024-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".coveralls.yml"
91
91
  - ".github/FUNDING.yml"
92
+ - ".github/dependabot.yml"
92
93
  - ".github/workflows/integration_test.yml"
93
94
  - ".github/workflows/lint.yml"
94
95
  - ".github/workflows/pr_lint.yml"
@@ -142,6 +143,7 @@ files:
142
143
  - bin/commands/admin_workflows.rb
143
144
  - bin/commands/admin_workflows_collaborators.rb
144
145
  - bin/commands/admin_workflows_permissions.rb
146
+ - bin/commands/admin_workflows_triggers_types_permissions.rb
145
147
  - bin/commands/api.rb
146
148
  - bin/commands/apps.rb
147
149
  - bin/commands/apps_activities.rb
@@ -156,15 +158,22 @@ files:
156
158
  - bin/commands/bots.rb
157
159
  - bin/commands/calls.rb
158
160
  - bin/commands/calls_participants.rb
161
+ - bin/commands/canvases.rb
162
+ - bin/commands/canvases_access.rb
163
+ - bin/commands/canvases_sections.rb
159
164
  - bin/commands/chat.rb
160
165
  - bin/commands/chat_scheduledMessages.rb
161
166
  - bin/commands/conversations.rb
167
+ - bin/commands/conversations_canvases.rb
168
+ - bin/commands/conversations_externalInvitePermissions.rb
162
169
  - bin/commands/dialog.rb
163
170
  - bin/commands/dnd.rb
164
171
  - bin/commands/emoji.rb
165
172
  - bin/commands/files.rb
166
173
  - bin/commands/files_comments.rb
167
174
  - bin/commands/files_remote.rb
175
+ - bin/commands/functions.rb
176
+ - bin/commands/functions_distributions_permissions.rb
168
177
  - bin/commands/functions_workflows_steps.rb
169
178
  - bin/commands/functions_workflows_steps_responses.rb
170
179
  - bin/commands/migration.rb
@@ -179,6 +188,7 @@ files:
179
188
  - bin/commands/stars.rb
180
189
  - bin/commands/team.rb
181
190
  - bin/commands/team_billing.rb
191
+ - bin/commands/team_externalTeams.rb
182
192
  - bin/commands/team_preferences.rb
183
193
  - bin/commands/team_profile.rb
184
194
  - bin/commands/tooling_tokens.rb
@@ -186,10 +196,12 @@ files:
186
196
  - bin/commands/usergroups_users.rb
187
197
  - bin/commands/users.rb
188
198
  - bin/commands/users_admin.rb
199
+ - bin/commands/users_discoverableContacts.rb
189
200
  - bin/commands/users_prefs.rb
190
201
  - bin/commands/users_profile.rb
191
202
  - bin/commands/views.rb
192
203
  - bin/commands/workflows.rb
204
+ - bin/commands/workflows_triggers_permissions.rb
193
205
  - bin/slack
194
206
  - examples/hi_real_time_and_web/Gemfile
195
207
  - examples/hi_real_time_and_web/hi.gif
@@ -266,6 +278,7 @@ files:
266
278
  - lib/slack/web/api/endpoints/admin_workflows.rb
267
279
  - lib/slack/web/api/endpoints/admin_workflows_collaborators.rb
268
280
  - lib/slack/web/api/endpoints/admin_workflows_permissions.rb
281
+ - lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb
269
282
  - lib/slack/web/api/endpoints/api.rb
270
283
  - lib/slack/web/api/endpoints/apps.rb
271
284
  - lib/slack/web/api/endpoints/apps_activities.rb
@@ -280,15 +293,22 @@ files:
280
293
  - lib/slack/web/api/endpoints/bots.rb
281
294
  - lib/slack/web/api/endpoints/calls.rb
282
295
  - lib/slack/web/api/endpoints/calls_participants.rb
296
+ - lib/slack/web/api/endpoints/canvases.rb
297
+ - lib/slack/web/api/endpoints/canvases_access.rb
298
+ - lib/slack/web/api/endpoints/canvases_sections.rb
283
299
  - lib/slack/web/api/endpoints/chat.rb
284
300
  - lib/slack/web/api/endpoints/chat_scheduledMessages.rb
285
301
  - lib/slack/web/api/endpoints/conversations.rb
302
+ - lib/slack/web/api/endpoints/conversations_canvases.rb
303
+ - lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb
286
304
  - lib/slack/web/api/endpoints/dialog.rb
287
305
  - lib/slack/web/api/endpoints/dnd.rb
288
306
  - lib/slack/web/api/endpoints/emoji.rb
289
307
  - lib/slack/web/api/endpoints/files.rb
290
308
  - lib/slack/web/api/endpoints/files_comments.rb
291
309
  - lib/slack/web/api/endpoints/files_remote.rb
310
+ - lib/slack/web/api/endpoints/functions.rb
311
+ - lib/slack/web/api/endpoints/functions_distributions_permissions.rb
292
312
  - lib/slack/web/api/endpoints/functions_workflows_steps.rb
293
313
  - lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb
294
314
  - lib/slack/web/api/endpoints/migration.rb
@@ -303,6 +323,7 @@ files:
303
323
  - lib/slack/web/api/endpoints/stars.rb
304
324
  - lib/slack/web/api/endpoints/team.rb
305
325
  - lib/slack/web/api/endpoints/team_billing.rb
326
+ - lib/slack/web/api/endpoints/team_externalTeams.rb
306
327
  - lib/slack/web/api/endpoints/team_preferences.rb
307
328
  - lib/slack/web/api/endpoints/team_profile.rb
308
329
  - lib/slack/web/api/endpoints/tooling_tokens.rb
@@ -310,10 +331,12 @@ files:
310
331
  - lib/slack/web/api/endpoints/usergroups_users.rb
311
332
  - lib/slack/web/api/endpoints/users.rb
312
333
  - lib/slack/web/api/endpoints/users_admin.rb
334
+ - lib/slack/web/api/endpoints/users_discoverableContacts.rb
313
335
  - lib/slack/web/api/endpoints/users_prefs.rb
314
336
  - lib/slack/web/api/endpoints/users_profile.rb
315
337
  - lib/slack/web/api/endpoints/views.rb
316
338
  - lib/slack/web/api/endpoints/workflows.rb
339
+ - lib/slack/web/api/endpoints/workflows_triggers_permissions.rb
317
340
  - lib/slack/web/api/error.rb
318
341
  - lib/slack/web/api/errors.rb
319
342
  - lib/slack/web/api/errors/server_error.rb
@@ -327,7 +350,7 @@ files:
327
350
  - lib/slack/web/api/mixins/users.search.json
328
351
  - lib/slack/web/api/mixins/users.search.rb
329
352
  - lib/slack/web/api/options.rb
330
- - lib/slack/web/api/patches/chat.attachments-blocks.patch
353
+ - lib/slack/web/api/patches/.gitkeep
331
354
  - lib/slack/web/api/schema/group.json
332
355
  - lib/slack/web/api/schema/method.json
333
356
  - lib/slack/web/api/templates/command.erb
@@ -417,6 +440,7 @@ files:
417
440
  - spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb
418
441
  - spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb
419
442
  - spec/slack/web/api/endpoints/admin_workflows_spec.rb
443
+ - spec/slack/web/api/endpoints/admin_workflows_triggers_types_permissions_spec.rb
420
444
  - spec/slack/web/api/endpoints/api_spec.rb
421
445
  - spec/slack/web/api/endpoints/apps_activities_spec.rb
422
446
  - spec/slack/web/api/endpoints/apps_auth_external_spec.rb
@@ -431,8 +455,13 @@ files:
431
455
  - spec/slack/web/api/endpoints/bots_spec.rb
432
456
  - spec/slack/web/api/endpoints/calls_participants_spec.rb
433
457
  - spec/slack/web/api/endpoints/calls_spec.rb
458
+ - spec/slack/web/api/endpoints/canvases_access_spec.rb
459
+ - spec/slack/web/api/endpoints/canvases_sections_spec.rb
460
+ - spec/slack/web/api/endpoints/canvases_spec.rb
434
461
  - spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb
435
462
  - spec/slack/web/api/endpoints/chat_spec.rb
463
+ - spec/slack/web/api/endpoints/conversations_canvases_spec.rb
464
+ - spec/slack/web/api/endpoints/conversations_externalInvitePermissions_spec.rb
436
465
  - spec/slack/web/api/endpoints/conversations_spec.rb
437
466
  - spec/slack/web/api/endpoints/custom_specs/auth_spec.rb
438
467
  - spec/slack/web/api/endpoints/custom_specs/chat_spec.rb
@@ -446,6 +475,8 @@ files:
446
475
  - spec/slack/web/api/endpoints/files_comments_spec.rb
447
476
  - spec/slack/web/api/endpoints/files_remote_spec.rb
448
477
  - spec/slack/web/api/endpoints/files_spec.rb
478
+ - spec/slack/web/api/endpoints/functions_distributions_permissions_spec.rb
479
+ - spec/slack/web/api/endpoints/functions_spec.rb
449
480
  - spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb
450
481
  - spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb
451
482
  - spec/slack/web/api/endpoints/migration_spec.rb
@@ -459,6 +490,7 @@ files:
459
490
  - spec/slack/web/api/endpoints/search_spec.rb
460
491
  - spec/slack/web/api/endpoints/stars_spec.rb
461
492
  - spec/slack/web/api/endpoints/team_billing_spec.rb
493
+ - spec/slack/web/api/endpoints/team_externalTeams_spec.rb
462
494
  - spec/slack/web/api/endpoints/team_preferences_spec.rb
463
495
  - spec/slack/web/api/endpoints/team_profile_spec.rb
464
496
  - spec/slack/web/api/endpoints/team_spec.rb
@@ -466,11 +498,13 @@ files:
466
498
  - spec/slack/web/api/endpoints/usergroups_spec.rb
467
499
  - spec/slack/web/api/endpoints/usergroups_users_spec.rb
468
500
  - spec/slack/web/api/endpoints/users_admin_spec.rb
501
+ - spec/slack/web/api/endpoints/users_discoverableContacts_spec.rb
469
502
  - spec/slack/web/api/endpoints/users_prefs_spec.rb
470
503
  - spec/slack/web/api/endpoints/users_profile_spec.rb
471
504
  - spec/slack/web/api/endpoints/users_spec.rb
472
505
  - spec/slack/web/api/endpoints/views_spec.rb
473
506
  - spec/slack/web/api/endpoints/workflows_spec.rb
507
+ - spec/slack/web/api/endpoints/workflows_triggers_permissions_spec.rb
474
508
  - spec/slack/web/api/error_spec.rb
475
509
  - spec/slack/web/api/errors/slack_error_spec.rb
476
510
  - spec/slack/web/api/mixins/conversations_list_spec.rb
@@ -1,21 +0,0 @@
1
- diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb
2
- index b49065a..bf202f1 100644
3
- --- a/lib/slack/web/api/endpoints/chat.rb
4
- +++ b/lib/slack/web/api/endpoints/chat.rb
5
- @@ -122,7 +122,7 @@ module Slack
6
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
7
- def chat_postEphemeral(options = {})
8
- raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
9
- - raise ArgumentError, 'Required arguments :text missing' if options[:text].nil?
10
- + raise ArgumentError, 'At least one of :attachments, :blocks, :text is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil?
11
- raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
12
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
13
- options = encode_options_as_json(options, %i[attachments blocks])
14
- @@ -274,6 +274,7 @@ module Slack
15
- def chat_update(options = {})
16
- raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
17
- raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
18
- + raise ArgumentError, 'At least one of :attachments, :blocks, :text, :reply_broadcast is required' if options[:attachments].nil? && options[:blocks].nil? && options[:text].nil? && options[:reply_broadcast].nil?
19
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
20
- options = encode_options_as_json(options, %i[attachments blocks metadata])
21
- post('chat.update', options)