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,14 +0,0 @@
1
- # frozen_string_literal: true
2
- # require 'spec_helper'
3
-
4
- #
5
- # to re-record a rtm_start fixture run with
6
- # SLACK_API_TOKEN=... CONCURRENCY=async-websocket rspec spec/slack/real_time/rtm_start_spec.rb
7
- # edit rtm_start.yml and remove the token, fix wss:// path (run specs, fix failures)
8
- #
9
-
10
- # RSpec.describe Slack::RealTime::Client, vcr: { cassette_name: 'web/rtm_start' } do
11
- # it 'connects' do
12
- # Slack::Web::Client.new.rtm_start(mpim_aware: true)
13
- # end
14
- # end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
- require 'spec_helper'
3
-
4
- RSpec.describe Slack::RealTime::Store do
5
- it 'can be initialized with an empty hash' do
6
- store = described_class.new(Hashie::Mash.new)
7
- expect(store.self).to be_nil
8
- expect(store.groups.count).to eq 0
9
- expect(store.team).to be_nil
10
- expect(store.teams.count).to eq 0
11
- end
12
- end