slack-ruby-client 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/{integtest.yml → integration_test.yml} +6 -5
  3. data/.github/workflows/{rubocop.yml → lint.yml} +5 -4
  4. data/.github/workflows/{danger.yml → pr_lint.yml} +8 -6
  5. data/.github/workflows/test.yml +4 -2
  6. data/.gitignore +0 -1
  7. data/.rubocop.yml +4 -0
  8. data/.rubocop_todo.yml +8 -14
  9. data/.ruby-version +1 -0
  10. data/CHANGELOG.md +14 -0
  11. data/CONTRIBUTING.md +5 -4
  12. data/Gemfile +1 -6
  13. data/README.md +60 -63
  14. data/RELEASING.md +1 -1
  15. data/UPGRADING.md +28 -0
  16. data/bin/commands/admin_audit_anomaly_allow.rb +23 -0
  17. data/bin/commands/admin_conversations.rb +12 -11
  18. data/bin/commands/admin_users.rb +1 -1
  19. data/bin/commands/admin_users_session.rb +1 -1
  20. data/bin/commands/apps_connections.rb +2 -2
  21. data/bin/commands/bookmarks.rb +1 -0
  22. data/bin/commands/chat.rb +9 -6
  23. data/bin/commands/conversations.rb +8 -6
  24. data/bin/commands/files.rb +24 -0
  25. data/bin/commands/rtm.rb +0 -15
  26. data/bin/commands/views.rb +4 -2
  27. data/bin/commands.rb +1 -0
  28. data/bin/slack +1 -1
  29. data/lib/slack/real_time/api/message.rb +3 -2
  30. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  31. data/lib/slack/real_time/api/typing.rb +2 -1
  32. data/lib/slack/real_time/client.rb +8 -26
  33. data/lib/slack/real_time/config.rb +3 -3
  34. data/lib/slack/real_time/models/channel.rb +4 -0
  35. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  36. data/lib/slack/real_time/models.rb +2 -1
  37. data/lib/slack/real_time/stores/base.rb +25 -9
  38. data/lib/slack/real_time/stores/starter.rb +323 -309
  39. data/lib/slack/real_time/stores/store.rb +265 -198
  40. data/lib/slack/real_time/stores.rb +1 -7
  41. data/lib/slack/version.rb +1 -1
  42. data/lib/slack/web/api/endpoints/admin_analytics.rb +1 -1
  43. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  44. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +1 -1
  45. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  46. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  47. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  48. data/lib/slack/web/api/endpoints/admin_conversations.rb +30 -28
  49. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  50. data/lib/slack/web/api/endpoints/admin_emoji.rb +7 -7
  51. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  52. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  53. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  54. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  55. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  56. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  57. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  58. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  59. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  60. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  61. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  62. data/lib/slack/web/api/endpoints/apps_manifest.rb +6 -6
  63. data/lib/slack/web/api/endpoints/bookmarks.rb +10 -8
  64. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  65. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  66. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  67. data/lib/slack/web/api/endpoints/chat.rb +36 -30
  68. data/lib/slack/web/api/endpoints/conversations.rb +37 -33
  69. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  70. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  71. data/lib/slack/web/api/endpoints/files.rb +45 -8
  72. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  73. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  74. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  75. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  76. data/lib/slack/web/api/endpoints/pins.rb +3 -3
  77. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  78. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  79. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  80. data/lib/slack/web/api/endpoints/search.rb +3 -3
  81. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  82. data/lib/slack/web/api/endpoints/usergroups.rb +4 -4
  83. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  84. data/lib/slack/web/api/endpoints/users.rb +4 -4
  85. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  86. data/lib/slack/web/api/endpoints/views.rb +16 -11
  87. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  88. data/lib/slack/web/api/endpoints.rb +2 -0
  89. data/lib/slack/web/api/errors.rb +56 -6
  90. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  91. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  92. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  93. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  94. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  95. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  96. data/lib/slack/web/api/templates/method.erb +1 -1
  97. data/lib/slack/web/config.rb +2 -2
  98. data/lib/tasks/real_time.rake +44 -22
  99. data/lib/tasks/web.rake +9 -2
  100. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  101. data/spec/slack/events/config_spec.rb +2 -0
  102. data/spec/slack/events/request_spec.rb +4 -0
  103. data/spec/slack/messages/formatting_spec.rb +10 -0
  104. data/spec/slack/real_time/api/message_spec.rb +1 -1
  105. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  106. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  107. data/spec/slack/real_time/client_spec.rb +73 -111
  108. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  109. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  110. data/spec/slack/real_time/event_handlers/im_spec.rb +28 -25
  111. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  112. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +24 -20
  113. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  114. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  115. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  116. data/spec/slack/slack_spec.rb +1 -0
  117. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  118. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +17 -1
  119. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +2 -0
  120. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +13 -4
  121. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  122. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  123. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  124. data/spec/slack/web/api/pagination/cursor_spec.rb +4 -0
  125. data/spec/slack/web/client_spec.rb +14 -4
  126. data/spec/support/real_time/loaded_client.rb +120 -0
  127. metadata +18 -35
  128. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  129. data/bin/commands/apps_permissions.rb +0 -23
  130. data/bin/commands/apps_permissions_resources.rb +0 -15
  131. data/bin/commands/apps_permissions_scopes.rb +0 -13
  132. data/bin/commands/apps_permissions_users.rb +0 -26
  133. data/bin/commands/channels.rb +0 -23
  134. data/bin/commands/groups.rb +0 -14
  135. data/bin/commands/im.rb +0 -6
  136. data/bin/commands/mpim.rb +0 -6
  137. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  138. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  139. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  140. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  141. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  142. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  143. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  144. data/lib/slack/web/api/endpoints/im.rb +0 -13
  145. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  146. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  147. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  148. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  149. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  150. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  151. data/spec/slack/real_time/store_spec.rb +0 -12
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- module Slack
5
- module Web
6
- module Api
7
- module Endpoints
8
- module AppsPermissionsUsers
9
- #
10
- # Returns list of user grants and corresponding scopes this app has on a team.
11
- #
12
- # @option options [Object] :cursor
13
- # Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
14
- # @option options [Object] :limit
15
- # The maximum number of items to return.
16
- # @see https://api.slack.com/methods/apps.permissions.users.list
17
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.list.json
18
- def apps_permissions_users_list(options = {})
19
- if block_given?
20
- Pagination::Cursor.new(self, :apps_permissions_users_list, options).each do |page|
21
- yield page
22
- end
23
- else
24
- post('apps.permissions.users.list', options)
25
- end
26
- end
27
-
28
- #
29
- # Enables an app to trigger a permissions modal to grant an app access to a user access scope.
30
- #
31
- # @option options [Object] :scopes
32
- # A comma separated list of user scopes to request for.
33
- # @option options [Object] :trigger_id
34
- # Token used to trigger the request.
35
- # @option options [user] :user
36
- # The user this scope is being requested for.
37
- # @see https://api.slack.com/methods/apps.permissions.users.request
38
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.request.json
39
- def apps_permissions_users_request(options = {})
40
- throw ArgumentError.new('Required arguments :scopes missing') if options[:scopes].nil?
41
- throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
42
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
43
- options = options.merge(user: users_id(options)['user']['id']) if options[:user]
44
- post('apps.permissions.users.request', options)
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- module Slack
5
- module Web
6
- module Api
7
- module Endpoints
8
- module Channels
9
- #
10
- # Delete a channel (undocumented)
11
- #
12
- # @option options [channel] :channel
13
- # Channel to delete.
14
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/undocumented/channels/channels.delete.json
15
- def channels_delete(options = {})
16
- throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
17
- options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
18
- logger.warn('The channels.delete method is undocumented.')
19
- post('channels.delete', options)
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
- # This file was auto-generated by lib/tasks/web.rake
3
-
4
- module Slack
5
- module Web
6
- module Api
7
- module Endpoints
8
- module Groups
9
- end
10
- end
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
- module Slack
5
- module Web
6
- module Api
7
- module Endpoints
8
- module Im
9
- end
10
- end
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
- module Slack
5
- module Web
6
- module Api
7
- module Endpoints
8
- module Mpim
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,23 +0,0 @@
1
- # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
-
3
- module Slack
4
- module Web
5
- module Api
6
- module Endpoints
7
- module Presence
8
- #
9
- # Manually set user presence.
10
- #
11
- # @option options [Object] :presence
12
- # Either `active` or `away`.
13
- # @see https://api.slack.com/methods/presence.set
14
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/presence.set.json
15
- def presence_set(options = {})
16
- throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
17
- post('presence.set', options)
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,40 +0,0 @@
1
- diff --git a/lib/slack/web/api/endpoints/views.rb b/lib/slack/web/api/endpoints/views.rb
2
- index 3d7ac8e..10de15c 100644
3
- --- a/lib/slack/web/api/endpoints/views.rb
4
- +++ b/lib/slack/web/api/endpoints/views.rb
5
- @@ -18,6 +18,11 @@ module Slack
6
- def views_open(options = {})
7
- throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
8
- throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
9
- + if options.key?(:view)
10
- + view = options[:view]
11
- + view = JSON.dump(view) unless view.is_a?(String)
12
- + options = options.merge(view: view)
13
- + end
14
- post('views.open', options)
15
- end
16
-
17
- @@ -33,6 +38,11 @@ module Slack
18
- def views_push(options = {})
19
- throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
20
- throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
21
- + if options.key?(:view)
22
- + view = options[:view]
23
- + view = JSON.dump(view) unless view.is_a?(String)
24
- + options = options.merge(view: view)
25
- + end
26
- post('views.push', options)
27
- end
28
-
29
- @@ -51,6 +61,11 @@ module Slack
30
- # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.update.json
31
- def views_update(options = {})
32
- throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
33
- + if options.key?(:view)
34
- + view = options[:view]
35
- + view = JSON.dump(view) unless view.is_a?(String)
36
- + options = options.merge(view: view)
37
- + end
38
- post('views.update', options)
39
- end
40
- end
@@ -1,16 +0,0 @@
1
- diff --git a/lib/slack/web/api/endpoints/views.rb b/lib/slack/web/api/endpoints/views.rb
2
- index 31626b9..8182a9c 100644
3
- --- a/lib/slack/web/api/endpoints/views.rb
4
- +++ b/lib/slack/web/api/endpoints/views.rb
5
- @@ -40,6 +40,11 @@ module Slack
6
- def views_publish(options = {})
7
- throw ArgumentError.new('Required arguments :user_id missing') if options[:user_id].nil?
8
- throw ArgumentError.new('Required arguments :view missing') if options[:view].nil?
9
- + if options.key?(:view)
10
- + view = options[:view]
11
- + view = JSON.dump(view) unless view.is_a?(String)
12
- + options = options.merge(view: view)
13
- + end
14
- post('views.publish', options)
15
- end
16
-