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,23 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Pins do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'pins_add' do
9
- it 'requires channel' do
10
- expect { client.pins_add }.to raise_error ArgumentError, /Required arguments :channel missing/
11
- end
12
- end
13
- context 'pins_list' do
14
- it 'requires channel' do
15
- expect { client.pins_list }.to raise_error ArgumentError, /Required arguments :channel missing/
16
- end
17
- end
18
- context 'pins_remove' do
19
- it 'requires channel' do
20
- expect { client.pins_remove }.to raise_error ArgumentError, /Required arguments :channel missing/
21
- end
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Reactions do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'reactions_add' do
9
- it 'requires channel' do
10
- expect { client.reactions_add(name: %q[thumbsup], timestamp: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :channel missing/
11
- end
12
- it 'requires name' do
13
- expect { client.reactions_add(channel: %q[C1234567890], timestamp: %q[1234567890.123456]) }.to raise_error ArgumentError, /Required arguments :name missing/
14
- end
15
- it 'requires timestamp' do
16
- expect { client.reactions_add(channel: %q[C1234567890], name: %q[thumbsup]) }.to raise_error ArgumentError, /Required arguments :timestamp missing/
17
- end
18
- end
19
- context 'reactions_remove' do
20
- it 'requires name' do
21
- expect { client.reactions_remove }.to raise_error ArgumentError, /Required arguments :name missing/
22
- end
23
- end
24
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Reminders do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'reminders_add' do
9
- it 'requires text' do
10
- expect { client.reminders_add(time: %q[1602288000]) }.to raise_error ArgumentError, /Required arguments :text missing/
11
- end
12
- it 'requires time' do
13
- expect { client.reminders_add(text: %q[eat a banana]) }.to raise_error ArgumentError, /Required arguments :time missing/
14
- end
15
- end
16
- context 'reminders_complete' do
17
- it 'requires reminder' do
18
- expect { client.reminders_complete }.to raise_error ArgumentError, /Required arguments :reminder missing/
19
- end
20
- end
21
- context 'reminders_delete' do
22
- it 'requires reminder' do
23
- expect { client.reminders_delete }.to raise_error ArgumentError, /Required arguments :reminder missing/
24
- end
25
- end
26
- context 'reminders_info' do
27
- it 'requires reminder' do
28
- expect { client.reminders_info }.to raise_error ArgumentError, /Required arguments :reminder missing/
29
- end
30
- end
31
- end
@@ -1,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::Rtm do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Search do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'search_all' do
9
- it 'requires query' do
10
- expect { client.search_all }.to raise_error ArgumentError, /Required arguments :query missing/
11
- end
12
- end
13
- context 'search_files' do
14
- it 'requires query' do
15
- expect { client.search_files }.to raise_error ArgumentError, /Required arguments :query missing/
16
- end
17
- end
18
- context 'search_messages' do
19
- it 'requires query' do
20
- expect { client.search_messages }.to raise_error ArgumentError, /Required arguments :query missing/
21
- end
22
- end
23
- end
@@ -1,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::Stars do
7
- let(:client) { Slack::Web::Client.new }
8
- 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::TeamBilling do
7
- let(:client) { Slack::Web::Client.new }
8
- 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::TeamPreferences do
7
- let(:client) { Slack::Web::Client.new }
8
- 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::TeamProfile do
7
- let(:client) { Slack::Web::Client.new }
8
- 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::Team do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::ToolingTokens do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'tooling.tokens_rotate' do
9
- it 'requires refresh_token' do
10
- expect { client.tooling_tokens_rotate }.to raise_error ArgumentError, /Required arguments :refresh_token missing/
11
- end
12
- end
13
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Usergroups do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'usergroups_create' do
9
- it 'requires name' do
10
- expect { client.usergroups_create }.to raise_error ArgumentError, /Required arguments :name missing/
11
- end
12
- end
13
- context 'usergroups_disable' do
14
- it 'requires usergroup' do
15
- expect { client.usergroups_disable }.to raise_error ArgumentError, /Required arguments :usergroup missing/
16
- end
17
- end
18
- context 'usergroups_enable' do
19
- it 'requires usergroup' do
20
- expect { client.usergroups_enable }.to raise_error ArgumentError, /Required arguments :usergroup missing/
21
- end
22
- end
23
- context 'usergroups_update' do
24
- it 'requires usergroup' do
25
- expect { client.usergroups_update }.to raise_error ArgumentError, /Required arguments :usergroup missing/
26
- end
27
- end
28
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::UsergroupsUsers do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'usergroups.users_list' do
9
- it 'requires usergroup' do
10
- expect { client.usergroups_users_list }.to raise_error ArgumentError, /Required arguments :usergroup missing/
11
- end
12
- end
13
- context 'usergroups.users_update' do
14
- it 'requires usergroup' do
15
- expect { client.usergroups_users_update(users: %q[U060R4BJ4,U060RNRCZ]) }.to raise_error ArgumentError, /Required arguments :usergroup missing/
16
- end
17
- it 'requires users' do
18
- expect { client.usergroups_users_update(usergroup: %q[S0604QSJC]) }.to raise_error ArgumentError, /Required arguments :users missing/
19
- end
20
- end
21
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::UsersAdmin do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'users.admin_invite' do
9
- it 'requires email' do
10
- expect { client.users_admin_invite }.to raise_error ArgumentError, /Required arguments :email missing/
11
- end
12
- end
13
- context 'users.admin_setInactive' do
14
- it 'requires user' do
15
- expect { client.users_admin_setInactive }.to raise_error ArgumentError, /Required arguments :user missing/
16
- end
17
- end
18
- end
@@ -1,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::UsersPrefs do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::UsersProfile do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'users.profile_set' do
9
- it 'encodes profile as json' do
10
- expect(client).to receive(:post).with('users.profile.set', {profile: %q[{"data":["data"]}]})
11
- client.users_profile_set(profile: {:data=>["data"]})
12
- end
13
- end
14
- end
@@ -1,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::Users do
7
- let(:client) { Slack::Web::Client.new }
8
- end
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Views do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'views_open' do
9
- it 'requires one of trigger_id, interactivity_pointer' do
10
- expect { client.views_open(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
11
-
12
- expect(client).to receive(:post).with('views.open', {trigger_id: %q[12345.98765.abcd2358fdea], view: %q[]})
13
- client.views_open(trigger_id: %q[12345.98765.abcd2358fdea], view: %q[])
14
-
15
- expect(client).to receive(:post).with('views.open', {interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]})
16
- client.views_open(interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[])
17
-
18
- expect { client.views_open(trigger_id: %q[12345.98765.abcd2358fdea], interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
19
- end
20
- it 'encodes view as json' do
21
- expect(client).to receive(:post).with('views.open', {view: %q[{"data":["data"]}], trigger_id: %q[12345.98765.abcd2358fdea]})
22
- client.views_open(view: {:data=>["data"]}, trigger_id: %q[12345.98765.abcd2358fdea])
23
- end
24
- end
25
- context 'views_publish' do
26
- it 'encodes view as json' do
27
- expect(client).to receive(:post).with('views.publish', {user_id: %q[U0BPQUNTA], view: %q[{"data":["data"]}]})
28
- client.views_publish(user_id: %q[U0BPQUNTA], view: {:data=>["data"]})
29
- end
30
- end
31
- context 'views_push' do
32
- it 'requires one of trigger_id, interactivity_pointer' do
33
- expect { client.views_push(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
34
-
35
- expect(client).to receive(:post).with('views.push', {trigger_id: %q[12345.98765.abcd2358fdea], view: %q[]})
36
- client.views_push(trigger_id: %q[12345.98765.abcd2358fdea], view: %q[])
37
-
38
- expect(client).to receive(:post).with('views.push', {interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]})
39
- client.views_push(interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[])
40
-
41
- expect { client.views_push(trigger_id: %q[12345.98765.abcd2358fdea], interactivity_pointer: %q[12345.98765.abcd2358fdea], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
42
- end
43
- it 'encodes view as json' do
44
- expect(client).to receive(:post).with('views.push', {view: %q[{"data":["data"]}], trigger_id: %q[12345.98765.abcd2358fdea]})
45
- client.views_push(view: {:data=>["data"]}, trigger_id: %q[12345.98765.abcd2358fdea])
46
- end
47
- end
48
- context 'views_update' do
49
- it 'requires one of external_id, view_id' do
50
- expect { client.views_update(view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
51
-
52
- expect(client).to receive(:post).with('views.update', {external_id: %q[bmarley_view2], view: %q[]})
53
- client.views_update(external_id: %q[bmarley_view2], view: %q[])
54
-
55
- expect(client).to receive(:post).with('views.update', {view_id: %q[VMM512F2U], view: %q[]})
56
- client.views_update(view_id: %q[VMM512F2U], view: %q[])
57
-
58
- expect { client.views_update(external_id: %q[bmarley_view2], view_id: %q[VMM512F2U], view: %q[]) }.to raise_error ArgumentError, /Exactly one of/
59
- end
60
- it 'encodes view as json' do
61
- expect(client).to receive(:post).with('views.update', {view: %q[{"data":["data"]}], external_id: %q[bmarley_view2]})
62
- client.views_update(view: {:data=>["data"]}, external_id: %q[bmarley_view2])
63
- end
64
- end
65
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- require 'spec_helper'
5
-
6
- RSpec.describe Slack::Web::Api::Endpoints::Workflows do
7
- let(:client) { Slack::Web::Client.new }
8
- context 'workflows_stepCompleted' do
9
- it 'requires workflow_step_execute_id' do
10
- expect { client.workflows_stepCompleted }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/
11
- end
12
- end
13
- context 'workflows_stepFailed' do
14
- it 'requires error' do
15
- expect { client.workflows_stepFailed(workflow_step_execute_id: %q[]) }.to raise_error ArgumentError, /Required arguments :error missing/
16
- end
17
- it 'requires workflow_step_execute_id' do
18
- expect { client.workflows_stepFailed(error: %q[]) }.to raise_error ArgumentError, /Required arguments :workflow_step_execute_id missing/
19
- end
20
- it 'encodes error as json' do
21
- expect(client).to receive(:post).with('workflows.stepFailed', {error: %q[{"data":["data"]}], workflow_step_execute_id: %q[]})
22
- client.workflows_stepFailed(error: {:data=>["data"]}, workflow_step_execute_id: %q[])
23
- end
24
- end
25
- context 'workflows_updateStep' do
26
- it 'requires workflow_step_edit_id' do
27
- expect { client.workflows_updateStep }.to raise_error ArgumentError, /Required arguments :workflow_step_edit_id missing/
28
- end
29
- it 'encodes inputs, outputs as json' do
30
- expect(client).to receive(:post).with('workflows.updateStep', {workflow_step_edit_id: %q[], inputs: %q[{"data":["data"]}], outputs: %q[{"data":["data"]}]})
31
- client.workflows_updateStep(workflow_step_edit_id: %q[], inputs: {:data=>["data"]}, outputs: {:data=>["data"]})
32
- end
33
- end
34
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Api::Error do
5
- let(:client) { Slack::Web::Client.new }
6
-
7
- it 'provides access to the response object', vcr: { cassette_name: 'web/auth_test_error' } do
8
- client.auth_test
9
- raise 'Expected to receive Slack::Web::Api::Error.'
10
- rescue described_class => e
11
- expect(e.response).not_to be_nil
12
- expect(e.response.status).to eq 200
13
- end
14
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Api::Errors::SlackError do
5
- let(:client) { Slack::Web::Client.new }
6
-
7
- it 'provides access to the response object', vcr: { cassette_name: 'web/auth_test_error' } do
8
- client.auth_test
9
- raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
10
- rescue described_class => e
11
- expect(e.response).not_to be_nil
12
- expect(e.response.status).to eq 200
13
- expect(e.message).to eql 'not_authed'
14
- expect(e.error).to eql 'not_authed'
15
- expect(e.response_metadata).to be_nil
16
- end
17
-
18
- it 'provides access to any response_metadata', vcr: { cassette_name: 'web/views_open_error' } do
19
- client.views_open(trigger_id: 'trigger_id', view: {})
20
- raise 'Expected to receive Slack::Web::Api::Errors::SlackError.'
21
- rescue described_class => e
22
- expect(e.response).not_to be_nil
23
- expect(e.response.status).to eq 200
24
- expect(e.message).to eql 'invalid_arguments'
25
- expect(e.error).to eql 'invalid_arguments'
26
- expect(e.response_metadata).to eq(
27
- 'messages' => [
28
- '[ERROR] failed to match all allowed schemas [json-pointer:/view]',
29
- '[ERROR] missing required field: type [json-pointer:/view]'
30
- ]
31
- )
32
- end
33
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Client do
5
- context 'conversations_setTopic' do
6
- it 'does not invoke conversations_list', vcr: { cassette_name: 'web/conversations_setTopic' } do
7
- rc = subject.conversations_setTopic({ channel: 'C019CV63UTC', topic: 'new topic' })
8
- expect(rc.channel.topic.value).to eq 'new topic'
9
- end
10
-
11
- it 'resolves IDs via conversations_list', vcr: { cassette_name: 'web/conversations_setTopic_one_page' } do
12
- rc = subject.conversations_setTopic({ channel: '#1', topic: 'new topic' })
13
- expect(rc.channel.topic.value).to eq 'new topic'
14
- end
15
-
16
- it 'paginates to resolve IDs', vcr: { cassette_name: 'web/conversations_setTopic_paginated' } do
17
- rc = subject.conversations_setTopic({ channel: '#topic', topic: 'new topic' })
18
- expect(rc.channel.topic.value).to eq 'new topic'
19
- end
20
- end
21
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Api::Mixins::Conversations do
5
- subject(:conversations) do
6
- klass.new
7
- end
8
-
9
- let(:klass) do
10
- Class.new do
11
- include Slack::Web::Api::Mixins::Conversations
12
- end
13
- end
14
-
15
- before do
16
- allow(conversations).to receive(:conversations_list).and_yield(
17
- Slack::Messages::Message.new(
18
- 'channels' => [{
19
- 'id' => 'CDEADBEEF',
20
- 'name' => 'general'
21
- }]
22
- )
23
- )
24
- end
25
-
26
- describe '#conversations_id' do
27
- it 'leaves channels specified by ID alone' do
28
- expect(conversations.conversations_id(channel: 'C123456')).to(
29
- eq('ok' => true, 'channel' => { 'id' => 'C123456' })
30
- )
31
- end
32
-
33
- it 'translates a channel that starts with a #' do
34
- expect(conversations.conversations_id(channel: '#general')).to(
35
- eq('ok' => true, 'channel' => { 'id' => 'CDEADBEEF' })
36
- )
37
- end
38
-
39
- it 'fails with an exception' do
40
- expect { conversations.conversations_id(channel: '#invalid') }.to(
41
- raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found')
42
- )
43
- end
44
- end
45
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Api::Mixins::Users do
5
- subject(:users) do
6
- klass.new
7
- end
8
-
9
- let(:klass) do
10
- Class.new do
11
- include Slack::Web::Api::Mixins::Users
12
- end
13
- end
14
-
15
- before do
16
- allow(users).to receive(:users_list).and_yield(
17
- Slack::Messages::Message.new(
18
- 'members' => [{
19
- 'id' => 'UDEADBEEF',
20
- 'name' => 'aws',
21
- 'profile' => {}
22
- }]
23
- )
24
- )
25
- end
26
-
27
- context '#users_id' do
28
- it 'leaves users specified by ID alone' do
29
- expect(users.users_id(user: 'U123456')).to eq('ok' => true, 'user' => { 'id' => 'U123456' })
30
- end
31
-
32
- it 'translates a user that starts with a #' do
33
- expect(users.users_id(user: '@aws')).to eq('ok' => true, 'user' => { 'id' => 'UDEADBEEF' })
34
- end
35
-
36
- it 'fails with an exception' do
37
- expect { users.users_id(user: '@foo') }.to(
38
- raise_error(Slack::Web::Api::Errors::SlackError, 'user_not_found')
39
- )
40
- end
41
- end
42
-
43
- if defined?(Picky)
44
- context '#users_search' do
45
- it 'finds a user' do
46
- expect(users.users_search(user: 'aws')).to(
47
- eq('ok' => true, 'members' => [{ 'id' => 'UDEADBEEF', 'name' => 'aws', 'profile' => {} }])
48
- )
49
- end
50
- end
51
- end
52
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::Web::Api::Error do
5
- let(:client) { Slack::Web::Client.new }
6
-
7
- describe '#encode_options_as_json' do
8
- let(:encoded_options) { client.encode_options_as_json(options, keys) }
9
-
10
- let(:keys) { %i[attachments blocks metadata] }
11
-
12
- context 'with some of the keys present in the options' do
13
- let(:options) do
14
- {
15
- text: 'Hello, world!',
16
- blocks: blocks,
17
- metadata: metadata
18
- }
19
- end
20
-
21
- context 'and non-string objects in those keys' do
22
- let(:blocks) { [{ type: 'section' }, { type: 'actions' }] }
23
- let(:metadata) { { external_id: SecureRandom.uuid } }
24
-
25
- it 'encodes the named keys into json' do
26
- expect(encoded_options).to eql(
27
- text: 'Hello, world!',
28
- blocks: JSON.dump(blocks),
29
- metadata: JSON.dump(metadata)
30
- )
31
- end
32
- end
33
-
34
- context 'and string objects in those keys' do
35
- let(:blocks) { JSON.dump([{ type: 'section' }, { type: 'actions' }]) }
36
- let(:metadata) { JSON.dump({ external_id: SecureRandom.uuid }) }
37
-
38
- it 'returns the original options' do
39
- expect(encoded_options).to eql(options)
40
- end
41
- end
42
- end
43
-
44
- context 'with none of the keys present in the options' do
45
- let(:options) do
46
- {
47
- text: 'Hello, world!'
48
- }
49
- end
50
-
51
- it 'returns the original options' do
52
- expect(encoded_options).to eql(options)
53
- end
54
- end
55
-
56
- context 'with no keys given' do
57
- let(:options) do
58
- {
59
- text: 'Hello, world!'
60
- }
61
- end
62
- let(:keys) { [] }
63
-
64
- it 'returns the original options' do
65
- expect(encoded_options).to eql(options)
66
- end
67
- end
68
- end
69
- end