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.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +22 -12
  3. data/.github/workflows/update_api.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/.rubocop_todo.yml +43 -13
  6. data/CHANGELOG.md +19 -0
  7. data/CONTRIBUTING.md +7 -7
  8. data/Gemfile +1 -0
  9. data/README.md +68 -25
  10. data/bin/commands/admin_conversations.rb +21 -0
  11. data/bin/commands/admin_emoji.rb +1 -1
  12. data/bin/commands/admin_users.rb +4 -4
  13. data/bin/commands/admin_users_session.rb +1 -1
  14. data/bin/commands/admin_workflows.rb +6 -2
  15. data/bin/commands/admin_workflows_triggers_types_permissions.rb +31 -0
  16. data/bin/commands/apps_datastore.rb +46 -0
  17. data/bin/commands/assistant_threads.rb +45 -0
  18. data/bin/commands/bookmarks.rb +1 -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 +7 -3
  23. data/bin/commands/conversations.rb +6 -6
  24. data/bin/commands/conversations_canvases.rb +21 -0
  25. data/bin/commands/conversations_externalInvitePermissions.rb +22 -0
  26. data/bin/commands/conversations_requestSharedInvite.rb +48 -0
  27. data/bin/commands/files.rb +2 -1
  28. data/bin/commands/functions_distributions_permissions.rb +59 -0
  29. data/bin/commands/oauth.rb +2 -2
  30. data/bin/commands/oauth_v2.rb +2 -2
  31. data/bin/commands/reminders.rb +1 -1
  32. data/bin/commands/team_externalTeams.rb +35 -0
  33. data/bin/commands/usergroups.rb +5 -0
  34. data/bin/commands/usergroups_users.rb +2 -0
  35. data/bin/commands/users_discoverableContacts.rb +20 -0
  36. data/bin/commands/workflows_triggers_permissions.rb +60 -0
  37. data/examples/files_upload_v2/.env.example +1 -0
  38. data/examples/files_upload_v2/Gemfile +5 -0
  39. data/examples/files_upload_v2/README.md +13 -0
  40. data/examples/files_upload_v2/files_upload_v2.rb +37 -0
  41. data/examples/oauth_v2/.env.example +4 -0
  42. data/examples/oauth_v2/Gemfile +7 -0
  43. data/examples/oauth_v2/README.md +33 -0
  44. data/examples/oauth_v2/oauth_v2.rb +60 -0
  45. data/lib/slack/messages/formatting.rb +13 -0
  46. data/lib/slack/version.rb +1 -1
  47. data/lib/slack/web/api/endpoints/admin_conversations.rb +35 -0
  48. data/lib/slack/web/api/endpoints/admin_emoji.rb +1 -1
  49. data/lib/slack/web/api/endpoints/admin_users.rb +2 -2
  50. data/lib/slack/web/api/endpoints/admin_users_session.rb +2 -3
  51. data/lib/slack/web/api/endpoints/admin_workflows.rb +10 -2
  52. data/lib/slack/web/api/endpoints/admin_workflows_triggers_types_permissions.rb +41 -0
  53. data/lib/slack/web/api/endpoints/apps_datastore.rb +71 -0
  54. data/lib/slack/web/api/endpoints/assistant_threads.rb +68 -0
  55. data/lib/slack/web/api/endpoints/bookmarks.rb +2 -0
  56. data/lib/slack/web/api/endpoints/canvases.rb +52 -0
  57. data/lib/slack/web/api/endpoints/canvases_access.rb +47 -0
  58. data/lib/slack/web/api/endpoints/canvases_sections.rb +27 -0
  59. data/lib/slack/web/api/endpoints/chat.rb +12 -3
  60. data/lib/slack/web/api/endpoints/conversations.rb +5 -5
  61. data/lib/slack/web/api/endpoints/conversations_canvases.rb +26 -0
  62. data/lib/slack/web/api/endpoints/conversations_externalInvitePermissions.rb +31 -0
  63. data/lib/slack/web/api/endpoints/conversations_requestSharedInvite.rb +73 -0
  64. data/lib/slack/web/api/endpoints/dnd.rb +1 -0
  65. data/lib/slack/web/api/endpoints/files.rb +3 -1
  66. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +80 -0
  67. data/lib/slack/web/api/endpoints/oauth.rb +2 -2
  68. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  69. data/lib/slack/web/api/endpoints/reminders.rb +1 -1
  70. data/lib/slack/web/api/endpoints/team_externalTeams.rb +53 -0
  71. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  72. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  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 +24 -0
  76. data/lib/slack/web/api/errors.rb +118 -8
  77. data/lib/slack/web/api/helpers/files.rb +87 -0
  78. data/lib/slack/web/api/helpers.rb +13 -0
  79. data/lib/slack/web/api/templates/method.erb +1 -0
  80. data/lib/slack/web/api/templates/method_spec.erb +6 -4
  81. data/lib/slack/web/client.rb +1 -0
  82. data/lib/slack/web/faraday/connection.rb +13 -26
  83. data/lib/slack/web/faraday/options.rb +24 -0
  84. data/lib/slack/web/faraday/request.rb +2 -1
  85. data/lib/slack-ruby-client.rb +2 -0
  86. data/slack-ruby-client.gemspec +2 -1
  87. metadata +52 -144
  88. data/screenshots/create-app.png +0 -0
  89. data/spec/fixtures/slack/web/429_error.yml +0 -81
  90. data/spec/fixtures/slack/web/auth_test_error.yml +0 -81
  91. data/spec/fixtures/slack/web/auth_test_success.yml +0 -81
  92. data/spec/fixtures/slack/web/conversations_info.yml +0 -167
  93. data/spec/fixtures/slack/web/conversations_setTopic.yml +0 -84
  94. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +0 -172
  95. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +0 -253
  96. data/spec/fixtures/slack/web/paginated_users_list.yml +0 -613
  97. data/spec/fixtures/slack/web/rtm_connect.yml +0 -391
  98. data/spec/fixtures/slack/web/users_info.yml +0 -214
  99. data/spec/fixtures/slack/web/users_list.yml +0 -133
  100. data/spec/fixtures/slack/web/views_open_error.yml +0 -83
  101. data/spec/integration/integration_spec.rb +0 -207
  102. data/spec/slack/config_spec.rb +0 -16
  103. data/spec/slack/events/config_spec.rb +0 -35
  104. data/spec/slack/events/request_spec.rb +0 -199
  105. data/spec/slack/messages/formatting_spec.rb +0 -124
  106. data/spec/slack/real_time/api/message_spec.rb +0 -20
  107. data/spec/slack/real_time/api/ping_spec.rb +0 -17
  108. data/spec/slack/real_time/api/typing_spec.rb +0 -19
  109. data/spec/slack/real_time/client_spec.rb +0 -601
  110. data/spec/slack/real_time/concurrency/clients/async_spec.rb +0 -16
  111. data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +0 -21
  112. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +0 -10
  113. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +0 -10
  114. data/spec/slack/real_time/event_handlers/bot_spec.rb +0 -47
  115. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +0 -16
  116. data/spec/slack/real_time/event_handlers/im_spec.rb +0 -51
  117. data/spec/slack/real_time/event_handlers/private_channel_spec.rb +0 -99
  118. data/spec/slack/real_time/event_handlers/public_channel_spec.rb +0 -123
  119. data/spec/slack/real_time/event_handlers/team_spec.rb +0 -63
  120. data/spec/slack/real_time/event_handlers/user_spec.rb +0 -65
  121. data/spec/slack/real_time/rtm_connect_spec.rb +0 -14
  122. data/spec/slack/real_time/stores/store_spec.rb +0 -50
  123. data/spec/slack/slack_spec.rb +0 -93
  124. data/spec/slack/version_spec.rb +0 -8
  125. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +0 -13
  126. data/spec/slack/web/api/endpoints/admin_apps_activities_spec.rb +0 -8
  127. data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +0 -8
  128. data/spec/slack/web/api/endpoints/admin_apps_config_spec.rb +0 -18
  129. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +0 -13
  130. data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +0 -8
  131. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +0 -18
  132. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +0 -8
  133. data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +0 -35
  134. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +0 -38
  135. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +0 -8
  136. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +0 -32
  137. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -133
  138. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +0 -37
  139. data/spec/slack/web/api/endpoints/admin_functions_permissions_spec.rb +0 -21
  140. data/spec/slack/web/api/endpoints/admin_functions_spec.rb +0 -13
  141. data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +0 -8
  142. data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +0 -8
  143. data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +0 -18
  144. data/spec/slack/web/api/endpoints/admin_roles_spec.rb +0 -30
  145. data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +0 -13
  146. data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +0 -13
  147. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +0 -53
  148. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +0 -16
  149. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +0 -37
  150. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +0 -41
  151. data/spec/slack/web/api/endpoints/admin_users_spec.rb +0 -67
  152. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +0 -8
  153. data/spec/slack/web/api/endpoints/admin_workflows_collaborators_spec.rb +0 -24
  154. data/spec/slack/web/api/endpoints/admin_workflows_permissions_spec.rb +0 -13
  155. data/spec/slack/web/api/endpoints/admin_workflows_spec.rb +0 -13
  156. data/spec/slack/web/api/endpoints/api_spec.rb +0 -8
  157. data/spec/slack/web/api/endpoints/apps_activities_spec.rb +0 -13
  158. data/spec/slack/web/api/endpoints/apps_auth_external_spec.rb +0 -13
  159. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +0 -8
  160. data/spec/slack/web/api/endpoints/apps_datastore_spec.rb +0 -45
  161. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +0 -13
  162. data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +0 -44
  163. data/spec/slack/web/api/endpoints/apps_spec.rb +0 -16
  164. data/spec/slack/web/api/endpoints/auth_spec.rb +0 -8
  165. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +0 -8
  166. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +0 -40
  167. data/spec/slack/web/api/endpoints/bots_spec.rb +0 -8
  168. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +0 -24
  169. data/spec/slack/web/api/endpoints/calls_spec.rb +0 -31
  170. data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +0 -8
  171. data/spec/slack/web/api/endpoints/chat_spec.rb +0 -134
  172. data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -8
  173. data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +0 -27
  174. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +0 -206
  175. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +0 -13
  176. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +0 -40
  177. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +0 -38
  178. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +0 -112
  179. data/spec/slack/web/api/endpoints/dialog_spec.rb +0 -14
  180. data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -13
  181. data/spec/slack/web/api/endpoints/emoji_spec.rb +0 -8
  182. data/spec/slack/web/api/endpoints/files_comments_spec.rb +0 -16
  183. data/spec/slack/web/api/endpoints/files_remote_spec.rb +0 -24
  184. data/spec/slack/web/api/endpoints/files_spec.rb +0 -57
  185. data/spec/slack/web/api/endpoints/functions_spec.rb +0 -28
  186. data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +0 -13
  187. data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +0 -13
  188. data/spec/slack/web/api/endpoints/migration_spec.rb +0 -13
  189. data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -8
  190. data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +0 -16
  191. data/spec/slack/web/api/endpoints/openid_connect_spec.rb +0 -8
  192. data/spec/slack/web/api/endpoints/pins_spec.rb +0 -23
  193. data/spec/slack/web/api/endpoints/reactions_spec.rb +0 -24
  194. data/spec/slack/web/api/endpoints/reminders_spec.rb +0 -31
  195. data/spec/slack/web/api/endpoints/rtm_spec.rb +0 -8
  196. data/spec/slack/web/api/endpoints/search_spec.rb +0 -23
  197. data/spec/slack/web/api/endpoints/stars_spec.rb +0 -8
  198. data/spec/slack/web/api/endpoints/team_billing_spec.rb +0 -8
  199. data/spec/slack/web/api/endpoints/team_preferences_spec.rb +0 -8
  200. data/spec/slack/web/api/endpoints/team_profile_spec.rb +0 -8
  201. data/spec/slack/web/api/endpoints/team_spec.rb +0 -8
  202. data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +0 -13
  203. data/spec/slack/web/api/endpoints/usergroups_spec.rb +0 -28
  204. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +0 -21
  205. data/spec/slack/web/api/endpoints/users_admin_spec.rb +0 -18
  206. data/spec/slack/web/api/endpoints/users_prefs_spec.rb +0 -8
  207. data/spec/slack/web/api/endpoints/users_profile_spec.rb +0 -14
  208. data/spec/slack/web/api/endpoints/users_spec.rb +0 -8
  209. data/spec/slack/web/api/endpoints/views_spec.rb +0 -65
  210. data/spec/slack/web/api/endpoints/workflows_spec.rb +0 -34
  211. data/spec/slack/web/api/error_spec.rb +0 -14
  212. data/spec/slack/web/api/errors/slack_error_spec.rb +0 -33
  213. data/spec/slack/web/api/mixins/conversations_list_spec.rb +0 -21
  214. data/spec/slack/web/api/mixins/conversations_spec.rb +0 -45
  215. data/spec/slack/web/api/mixins/users_spec.rb +0 -52
  216. data/spec/slack/web/api/options_spec.rb +0 -69
  217. data/spec/slack/web/api/pagination/cursor_spec.rb +0 -102
  218. data/spec/slack/web/client_spec.rb +0 -359
  219. data/spec/slack/web/faraday/request_spec.rb +0 -80
  220. data/spec/slack/web/faraday/response/raise_error_spec.rb +0 -86
  221. data/spec/spec_helper.rb +0 -30
  222. data/spec/support/queue_with_timeout.rb +0 -35
  223. data/spec/support/real_time/concurrency/mock.rb +0 -31
  224. data/spec/support/real_time/connected_client.rb +0 -21
  225. data/spec/support/real_time/event.rb +0 -12
  226. data/spec/support/real_time/loaded_client.rb +0 -120
  227. data/spec/support/token.rb +0 -11
  228. data/spec/support/vcr.rb +0 -45
@@ -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,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::Dnd do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'dnd_teamInfo' do
9
- it 'requires users' do
10
- expect { client.dnd_teamInfo }.to raise_error ArgumentError, /Required arguments :users missing/
11
- end
12
- end
13
- end
@@ -1,8 +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::Emoji do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,16 +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::FilesComments do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'files.comments_delete' do
9
- it 'requires file' do
10
- expect { client.files_comments_delete(id: %q[Fc1234567890]) }.to raise_error ArgumentError, /Required arguments :file missing/
11
- end
12
- it 'requires id' do
13
- expect { client.files_comments_delete(file: %q[F1234567890]) }.to raise_error ArgumentError, /Required arguments :id missing/
14
- end
15
- end
16
- 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::FilesRemote do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'files.remote_add' do
9
- it 'requires external_id' do
10
- expect { client.files_remote_add(external_url: %q[http://example.com/my_cloud_service_file/abc123], title: %q[Danger, High Voltage!]) }.to raise_error ArgumentError, /Required arguments :external_id missing/
11
- end
12
- it 'requires external_url' do
13
- expect { client.files_remote_add(external_id: %q[123456], title: %q[Danger, High Voltage!]) }.to raise_error ArgumentError, /Required arguments :external_url missing/
14
- end
15
- it 'requires title' do
16
- expect { client.files_remote_add(external_id: %q[123456], external_url: %q[http://example.com/my_cloud_service_file/abc123]) }.to raise_error ArgumentError, /Required arguments :title missing/
17
- end
18
- end
19
- context 'files.remote_share' do
20
- it 'requires channels' do
21
- expect { client.files_remote_share }.to raise_error ArgumentError, /Required arguments :channels missing/
22
- end
23
- end
24
- end
@@ -1,57 +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::Files do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'files_completeUploadExternal' do
9
- it 'requires files' do
10
- expect { client.files_completeUploadExternal }.to raise_error ArgumentError, /Required arguments :files missing/
11
- end
12
- end
13
- context 'files_delete' do
14
- it 'requires file' do
15
- expect { client.files_delete }.to raise_error ArgumentError, /Required arguments :file missing/
16
- end
17
- end
18
- context 'files_edit' do
19
- it 'requires file' do
20
- expect { client.files_edit(title: %q[Brand new title]) }.to raise_error ArgumentError, /Required arguments :file missing/
21
- end
22
- it 'requires title' do
23
- expect { client.files_edit(file: %q[F2147483862]) }.to raise_error ArgumentError, /Required arguments :title missing/
24
- end
25
- end
26
- context 'files_getUploadURLExternal' do
27
- it 'requires filename' do
28
- expect { client.files_getUploadURLExternal(length: %q[53072]) }.to raise_error ArgumentError, /Required arguments :filename missing/
29
- end
30
- it 'requires length' do
31
- expect { client.files_getUploadURLExternal(filename: %q[laughingoutloudcat.jpg]) }.to raise_error ArgumentError, /Required arguments :length missing/
32
- end
33
- end
34
- context 'files_info' do
35
- it 'requires file' do
36
- expect { client.files_info }.to raise_error ArgumentError, /Required arguments :file missing/
37
- end
38
- end
39
- context 'files_revokePublicURL' do
40
- it 'requires file' do
41
- expect { client.files_revokePublicURL }.to raise_error ArgumentError, /Required arguments :file missing/
42
- end
43
- end
44
- context 'files_share' do
45
- it 'requires file' do
46
- expect { client.files_share(channel: %q[C1234567890]) }.to raise_error ArgumentError, /Required arguments :file missing/
47
- end
48
- it 'requires channel' do
49
- expect { client.files_share(file: %q[F2147483862]) }.to raise_error ArgumentError, /Required arguments :channel missing/
50
- end
51
- end
52
- context 'files_sharedPublicURL' do
53
- it 'requires file' do
54
- expect { client.files_sharedPublicURL }.to raise_error ArgumentError, /Required arguments :file missing/
55
- end
56
- end
57
- 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::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
@@ -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::FunctionsWorkflowsStepsResponses do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'functions.workflows.steps.responses_export' do
9
- it 'requires step_id' do
10
- expect { client.functions_workflows_steps_responses_export }.to raise_error ArgumentError, /Required arguments :step_id missing/
11
- end
12
- end
13
- 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::FunctionsWorkflowsSteps do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'functions.workflows.steps_list' do
9
- it 'requires function_id' do
10
- expect { client.functions_workflows_steps_list }.to raise_error ArgumentError, /Required arguments :function_id missing/
11
- end
12
- end
13
- 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::Migration do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'migration_exchange' do
9
- it 'requires users' do
10
- expect { client.migration_exchange }.to raise_error ArgumentError, /Required arguments :users missing/
11
- end
12
- end
13
- end
@@ -1,8 +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::Oauth do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,16 +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::OauthV2 do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'oauth.v2_exchange' do
9
- it 'requires client_id' do
10
- expect { client.oauth_v2_exchange(client_secret: %q[e1b9e11dfcd19c1982d5de12921e17e8c]) }.to raise_error ArgumentError, /Required arguments :client_id missing/
11
- end
12
- it 'requires client_secret' do
13
- expect { client.oauth_v2_exchange(client_id: %q[4123121235.9872358710]) }.to raise_error ArgumentError, /Required arguments :client_secret missing/
14
- end
15
- end
16
- end
@@ -1,8 +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::OpenidConnect do
7
- let(:client) { Slack::Web::Client.new }
8
- end