slack-ruby-client 1.0.0 → 2.1.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 (239) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/integration_test.yml +45 -0
  4. data/.github/workflows/lint.yml +14 -0
  5. data/.github/workflows/pr_lint.yml +21 -0
  6. data/.github/workflows/test.yml +37 -0
  7. data/.gitignore +4 -3
  8. data/.rubocop.yml +6 -1
  9. data/.rubocop_todo.yml +88 -34
  10. data/.ruby-version +1 -0
  11. data/CHANGELOG.md +36 -0
  12. data/CONTRIBUTING.md +6 -5
  13. data/Gemfile +13 -1
  14. data/Gemfile.danger +6 -0
  15. data/README.md +78 -76
  16. data/RELEASING.md +2 -2
  17. data/SECURITY.md +9 -0
  18. data/UPGRADING.md +28 -0
  19. data/bin/commands/admin_analytics.rb +16 -10
  20. data/bin/commands/admin_apps.rb +48 -42
  21. data/bin/commands/admin_apps_approved.rb +17 -11
  22. data/bin/commands/admin_apps_requests.rb +28 -11
  23. data/bin/commands/admin_apps_restricted.rb +17 -11
  24. data/bin/commands/admin_audit_anomaly_allow.rb +29 -0
  25. data/bin/commands/admin_auth_policy.rb +37 -31
  26. data/bin/commands/admin_barriers.rb +44 -38
  27. data/bin/commands/admin_conversations.rb +221 -163
  28. data/bin/commands/admin_conversations_ekm.rb +17 -11
  29. data/bin/commands/admin_conversations_restrictAccess.rb +35 -29
  30. data/bin/commands/admin_emoji.rb +50 -44
  31. data/bin/commands/admin_inviteRequests.rb +34 -28
  32. data/bin/commands/admin_inviteRequests_approved.rb +16 -10
  33. data/bin/commands/admin_inviteRequests_denied.rb +16 -10
  34. data/bin/commands/admin_roles.rb +46 -0
  35. data/bin/commands/admin_teams.rb +26 -20
  36. data/bin/commands/admin_teams_admins.rb +16 -10
  37. data/bin/commands/admin_teams_owners.rb +16 -10
  38. data/bin/commands/admin_teams_settings.rb +59 -53
  39. data/bin/commands/admin_usergroups.rb +45 -39
  40. data/bin/commands/admin_users.rb +91 -85
  41. data/bin/commands/admin_users_session.rb +72 -66
  42. data/bin/commands/admin_users_unsupportedVersions.rb +21 -0
  43. data/bin/commands/api.rb +14 -8
  44. data/bin/commands/apps.rb +15 -9
  45. data/bin/commands/apps_connections.rb +13 -7
  46. data/bin/commands/apps_event_authorizations.rb +16 -10
  47. data/bin/commands/apps_manifest.rb +48 -41
  48. data/bin/commands/auth.rb +21 -15
  49. data/bin/commands/auth_teams.rb +16 -10
  50. data/bin/commands/bookmarks.rb +59 -0
  51. data/bin/commands/bots.rb +15 -9
  52. data/bin/commands/calls.rb +49 -43
  53. data/bin/commands/calls_participants.rb +24 -18
  54. data/bin/commands/chat.rb +150 -141
  55. data/bin/commands/chat_scheduledMessages.rb +19 -13
  56. data/bin/commands/conversations.rb +233 -225
  57. data/bin/commands/dialog.rb +15 -9
  58. data/bin/commands/dnd.rb +46 -40
  59. data/bin/commands/emoji.rb +14 -7
  60. data/bin/commands/files.rb +112 -83
  61. data/bin/commands/files_comments.rb +15 -9
  62. data/bin/commands/files_remote.rb +73 -67
  63. data/bin/commands/functions_workflows_steps.rb +22 -0
  64. data/bin/commands/functions_workflows_steps_responses.rb +22 -0
  65. data/bin/commands/migration.rb +16 -10
  66. data/bin/commands/oauth.rb +18 -12
  67. data/bin/commands/oauth_v2.rb +28 -22
  68. data/bin/commands/openid_connect.rb +26 -20
  69. data/bin/commands/pins.rb +33 -26
  70. data/bin/commands/reactions.rb +52 -46
  71. data/bin/commands/reminders.rb +53 -47
  72. data/bin/commands/rtm.rb +15 -24
  73. data/bin/commands/search.rb +43 -37
  74. data/bin/commands/stars.rb +38 -32
  75. data/bin/commands/team.rb +47 -38
  76. data/bin/commands/team_billing.rb +13 -7
  77. data/bin/commands/team_preferences.rb +13 -7
  78. data/bin/commands/team_profile.rb +14 -8
  79. data/bin/commands/tooling_tokens.rb +14 -8
  80. data/bin/commands/usergroups.rb +64 -58
  81. data/bin/commands/usergroups_users.rb +27 -21
  82. data/bin/commands/users.rb +111 -105
  83. data/bin/commands/users_admin.rb +28 -22
  84. data/bin/commands/users_prefs.rb +13 -7
  85. data/bin/commands/users_profile.rb +26 -20
  86. data/bin/commands/views.rb +47 -39
  87. data/bin/commands/workflows.rb +36 -30
  88. data/bin/slack +48 -43
  89. data/lib/slack/real_time/api/message.rb +3 -2
  90. data/lib/slack/real_time/api/templates/event_handler.erb +5 -1
  91. data/lib/slack/real_time/api/typing.rb +2 -1
  92. data/lib/slack/real_time/client.rb +10 -28
  93. data/lib/slack/real_time/config.rb +3 -3
  94. data/lib/slack/real_time/models/channel.rb +4 -0
  95. data/lib/slack/real_time/models/{group.rb → mpim.rb} +1 -1
  96. data/lib/slack/real_time/models.rb +2 -1
  97. data/lib/slack/real_time/stores/base.rb +25 -9
  98. data/lib/slack/real_time/stores/starter.rb +323 -309
  99. data/lib/slack/real_time/stores/store.rb +265 -198
  100. data/lib/slack/real_time/stores.rb +1 -7
  101. data/lib/slack/version.rb +1 -1
  102. data/lib/slack/web/api/endpoints/admin_analytics.rb +2 -2
  103. data/lib/slack/web/api/endpoints/admin_apps.rb +2 -2
  104. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +16 -0
  105. data/lib/slack/web/api/endpoints/admin_audit_anomaly_allow.rb +34 -0
  106. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +7 -7
  107. data/lib/slack/web/api/endpoints/admin_barriers.rb +8 -8
  108. data/lib/slack/web/api/endpoints/admin_conversations.rb +110 -28
  109. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +6 -6
  110. data/lib/slack/web/api/endpoints/admin_emoji.rb +9 -9
  111. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +2 -2
  112. data/lib/slack/web/api/endpoints/admin_roles.rb +73 -0
  113. data/lib/slack/web/api/endpoints/admin_teams.rb +2 -2
  114. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +1 -1
  115. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +1 -1
  116. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +11 -11
  117. data/lib/slack/web/api/endpoints/admin_usergroups.rb +7 -7
  118. data/lib/slack/web/api/endpoints/admin_users.rb +16 -16
  119. data/lib/slack/web/api/endpoints/admin_users_session.rb +8 -8
  120. data/lib/slack/web/api/endpoints/admin_users_unsupportedVersions.rb +25 -0
  121. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  122. data/lib/slack/web/api/endpoints/apps_connections.rb +1 -1
  123. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +1 -1
  124. data/lib/slack/web/api/endpoints/apps_manifest.rb +8 -6
  125. data/lib/slack/web/api/endpoints/bookmarks.rb +88 -0
  126. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  127. data/lib/slack/web/api/endpoints/calls.rb +5 -5
  128. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  129. data/lib/slack/web/api/endpoints/chat.rb +37 -31
  130. data/lib/slack/web/api/endpoints/conversations.rb +38 -34
  131. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  132. data/lib/slack/web/api/endpoints/dnd.rb +1 -1
  133. data/lib/slack/web/api/endpoints/emoji.rb +2 -0
  134. data/lib/slack/web/api/endpoints/files.rb +45 -10
  135. data/lib/slack/web/api/endpoints/files_comments.rb +2 -2
  136. data/lib/slack/web/api/endpoints/files_remote.rb +8 -8
  137. data/lib/slack/web/api/endpoints/functions_workflows_steps.rb +28 -0
  138. data/lib/slack/web/api/endpoints/functions_workflows_steps_responses.rb +28 -0
  139. data/lib/slack/web/api/endpoints/migration.rb +1 -1
  140. data/lib/slack/web/api/endpoints/oauth_v2.rb +2 -2
  141. data/lib/slack/web/api/endpoints/pins.rb +5 -3
  142. data/lib/slack/web/api/endpoints/reactions.rb +4 -4
  143. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  144. data/lib/slack/web/api/endpoints/rtm.rb +0 -23
  145. data/lib/slack/web/api/endpoints/search.rb +3 -3
  146. data/lib/slack/web/api/endpoints/team.rb +13 -1
  147. data/lib/slack/web/api/endpoints/tooling_tokens.rb +1 -1
  148. data/lib/slack/web/api/endpoints/usergroups.rb +5 -5
  149. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -3
  150. data/lib/slack/web/api/endpoints/users.rb +4 -4
  151. data/lib/slack/web/api/endpoints/users_admin.rb +2 -2
  152. data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
  153. data/lib/slack/web/api/endpoints/views.rb +16 -11
  154. data/lib/slack/web/api/endpoints/workflows.rb +4 -4
  155. data/lib/slack/web/api/endpoints.rb +12 -0
  156. data/lib/slack/web/api/errors.rb +146 -8
  157. data/lib/slack/web/api/mixins/conversations.id.rb +1 -1
  158. data/lib/slack/web/api/mixins/users.id.rb +1 -1
  159. data/lib/slack/web/api/mixins/users.search.rb +2 -1
  160. data/lib/slack/web/api/patches/{chat.1.patch → chat.attachments-blocks.patch} +13 -14
  161. data/lib/slack/web/api/patches/{dialog.1.open-json-support.patch → dialog.encoded-json.patch} +4 -4
  162. data/lib/slack/web/api/patches/views.view-json.patch +55 -0
  163. data/lib/slack/web/api/templates/command.erb +18 -12
  164. data/lib/slack/web/api/templates/method.erb +1 -1
  165. data/lib/slack/web/config.rb +2 -2
  166. data/lib/slack/web/faraday/connection.rb +4 -4
  167. data/lib/slack/web/faraday/request.rb +2 -0
  168. data/lib/slack/web/faraday/response/raise_error.rb +2 -10
  169. data/lib/slack/web/faraday/response/wrap_error.rb +1 -1
  170. data/lib/slack-ruby-client.rb +2 -1
  171. data/lib/tasks/real_time.rake +44 -24
  172. data/lib/tasks/web.rake +9 -8
  173. data/slack-ruby-client.gemspec +5 -14
  174. data/spec/fixtures/slack/web/rtm_connect.yml +85 -1
  175. data/spec/integration/integration_spec.rb +1 -1
  176. data/spec/slack/events/config_spec.rb +2 -0
  177. data/spec/slack/events/request_spec.rb +5 -1
  178. data/spec/slack/messages/formatting_spec.rb +10 -0
  179. data/spec/slack/real_time/api/message_spec.rb +1 -1
  180. data/spec/slack/real_time/api/ping_spec.rb +1 -1
  181. data/spec/slack/real_time/api/typing_spec.rb +1 -1
  182. data/spec/slack/real_time/client_spec.rb +91 -127
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +19 -17
  184. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +1 -1
  185. data/spec/slack/real_time/event_handlers/im_spec.rb +30 -27
  186. data/spec/slack/real_time/event_handlers/{group_spec.rb → private_channel_spec.rb} +35 -27
  187. data/spec/slack/real_time/event_handlers/{channel_spec.rb → public_channel_spec.rb} +27 -23
  188. data/spec/slack/real_time/event_handlers/team_spec.rb +7 -8
  189. data/spec/slack/real_time/event_handlers/user_spec.rb +6 -5
  190. data/spec/slack/real_time/stores/store_spec.rb +50 -0
  191. data/spec/slack/slack_spec.rb +5 -4
  192. data/spec/slack/version_spec.rb +1 -1
  193. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +5 -0
  194. data/spec/slack/web/api/endpoints/admin_audit_anomaly_allow_spec.rb +8 -0
  195. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +31 -0
  196. data/spec/slack/web/api/endpoints/admin_roles_spec.rb +30 -0
  197. data/spec/slack/web/api/endpoints/admin_users_unsupportedVersions_spec.rb +8 -0
  198. data/spec/slack/web/api/endpoints/bookmarks_spec.rb +40 -0
  199. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +45 -17
  200. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +6 -2
  201. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +33 -16
  202. data/spec/slack/web/api/endpoints/files_spec.rb +13 -0
  203. data/spec/slack/web/api/endpoints/functions_workflows_steps_responses_spec.rb +13 -0
  204. data/spec/slack/web/api/endpoints/functions_workflows_steps_spec.rb +13 -0
  205. data/spec/slack/web/api/mixins/conversations_spec.rb +2 -0
  206. data/spec/slack/web/api/mixins/users_spec.rb +2 -0
  207. data/spec/slack/web/api/pagination/cursor_spec.rb +11 -7
  208. data/spec/slack/web/client_spec.rb +39 -11
  209. data/spec/slack/web/faraday/response/raise_error_spec.rb +1 -1
  210. data/spec/support/real_time/connected_client.rb +1 -1
  211. data/spec/support/real_time/loaded_client.rb +120 -0
  212. metadata +45 -197
  213. data/.travis.yml +0 -29
  214. data/bin/commands/admin_conversations_whitelist.rb +0 -37
  215. data/bin/commands/apps_permissions.rb +0 -23
  216. data/bin/commands/apps_permissions_resources.rb +0 -15
  217. data/bin/commands/apps_permissions_scopes.rb +0 -13
  218. data/bin/commands/apps_permissions_users.rb +0 -26
  219. data/bin/commands/channels.rb +0 -23
  220. data/bin/commands/groups.rb +0 -14
  221. data/bin/commands/im.rb +0 -6
  222. data/bin/commands/mpim.rb +0 -6
  223. data/bin/commands.rb +0 -66
  224. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +0 -64
  225. data/lib/slack/web/api/endpoints/apps_permissions.rb +0 -36
  226. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +0 -31
  227. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +0 -21
  228. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +0 -50
  229. data/lib/slack/web/api/endpoints/channels.rb +0 -25
  230. data/lib/slack/web/api/endpoints/groups.rb +0 -13
  231. data/lib/slack/web/api/endpoints/im.rb +0 -13
  232. data/lib/slack/web/api/endpoints/mpim.rb +0 -13
  233. data/lib/slack/web/api/endpoints/presence.rb +0 -23
  234. data/lib/slack/web/api/patches/views.1.view-json.patch +0 -40
  235. data/lib/slack/web/api/patches/views.1.views-published.patch +0 -16
  236. data/lib/slack/web/api/templates/commands.erb +0 -6
  237. data/spec/fixtures/slack/web/rtm_start.yml +0 -815
  238. data/spec/slack/real_time/rtm_start_spec.rb +0 -14
  239. data/spec/slack/real_time/store_spec.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fa18d8339ff27661d942ef4d0cee003ff8e1146db504063a736374c5f5bf940
4
- data.tar.gz: fc3bca990c3ad938a23db950b2008932a29518363360ada378856e71f2c1b477
3
+ metadata.gz: ea3cc0e5082af70d6b464bfcdf1b3c980380b356348818d2c98b9f9b1abe9be8
4
+ data.tar.gz: 39e8cc3adc65e06b34fb906face6f7eab61f6f5f5d265c7a3022d8ffc656b553
5
5
  SHA512:
6
- metadata.gz: 932b6be224f16a7873a24907074944eea9ac8fcb47e35f7f9ef876d11df396197771c44727738b63267e4da45cd5c2050084972844a76fa6134fc54e2a9aa0d6
7
- data.tar.gz: 8a5904155cd7b3d52fbeca8c9a0887bca7eabe4bb4b668174aa4accb5cfefb7784ec91f3e3d9182fef44d6a994168b72c4530c36a74cf2d7564eec6a0e204ea5
6
+ metadata.gz: a1e9755f1a189388376479c74e616ec4dc035195f28ae861f9a8ae8bc0c3a6ea50b11dc00d814b870ea7f7ac5784cbe936a6a575ba70f5aeb86741338d83553f
7
+ data.tar.gz: 80255ba98558914d209543e0c7e2440cef49f8bac0873e62948f3d8d9e96e0b42b624517ead794724b913e4d5afbc6826de597084c63b8128be68f894b40a395
data/.github/FUNDING.yml CHANGED
@@ -1 +1,2 @@
1
1
  github: [dblock]
2
+ tidelift: rubygems/slack-ruby-client
@@ -0,0 +1,45 @@
1
+ name: Integration Tests
2
+ on: push
3
+ jobs:
4
+ check-slack-api-token:
5
+ runs-on: ubuntu-latest
6
+ outputs:
7
+ SLACK_API_TOKEN_EXISTS: ${{ steps.check-slack-api-token.outputs.SLACK_API_TOKEN_EXISTS }}
8
+ steps:
9
+ - name: Check for SLACK_API_TOKEN availability
10
+ id: check-slack-api-token
11
+ shell: bash
12
+ run: |
13
+ if [ "${{ secrets.SLACK_API_TOKEN }}" != '' ]; then
14
+ echo "SLACK_API_TOKEN_EXISTS=true" >> $GITHUB_OUTPUT;
15
+ else
16
+ echo "SLACK_API_TOKEN_EXISTS=false" >> $GITHUB_OUTPUT;
17
+ fi
18
+
19
+ test:
20
+ runs-on: ubuntu-latest
21
+ needs: [check-slack-api-token]
22
+ if: needs.check-slack-api-token.outputs.SLACK_API_TOKEN_EXISTS == 'true'
23
+ strategy:
24
+ matrix:
25
+ entry:
26
+ - { ruby: 2.7, concurrency: async-websocket }
27
+ name: test (ruby=${{ matrix.entry.ruby }}, concurrency=${{ matrix.entry.concurrency || 'none' }})
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@v3
31
+ - name: Set up Ruby
32
+ uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.entry.ruby }}
35
+ bundler-cache: true
36
+ - name: Run Tests
37
+ env:
38
+ CONCURRENCY: ${{ matrix.entry.concurrency }}
39
+ SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
40
+ RACK_ENV: test
41
+ SPEC: "--pattern spec/**/integration/*_spec.rb"
42
+ SPEC_OPTS: "--pattern spec/**/integration/*_spec.rb"
43
+ run: |
44
+ bundle install
45
+ bundle exec rake
@@ -0,0 +1,14 @@
1
+ name: Lint
2
+ on: [push, pull_request]
3
+ jobs:
4
+ rubocop:
5
+ name: RuboCop
6
+ runs-on: ubuntu-latest
7
+ steps:
8
+ - name: Checkout
9
+ uses: actions/checkout@v3
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ bundler-cache: true
14
+ - run: bundle exec rubocop
@@ -0,0 +1,21 @@
1
+ name: PR Lint
2
+ on: pull_request
3
+ jobs:
4
+ danger:
5
+ name: Dangerfile
6
+ runs-on: ubuntu-latest
7
+ env:
8
+ BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.danger
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v3
12
+ with:
13
+ fetch-depth: 0
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ bundler-cache: true
18
+ - run: |
19
+ # Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub
20
+ TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
21
+ DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -0,0 +1,37 @@
1
+ name: Tests
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ runs-on: ubuntu-latest
6
+ strategy:
7
+ matrix:
8
+ entry:
9
+ - { ruby: "2.7" }
10
+ - { ruby: "2.7", concurrency: async-websocket }
11
+ - { ruby: "3.0" }
12
+ - { ruby: "3.1" }
13
+ - { ruby: "3.2" }
14
+ - { ruby: ruby-head, ignore: true }
15
+ - { ruby: jruby-head, ignore: true }
16
+ name: test (ruby=${{ matrix.entry.ruby }}, concurrency=${{ matrix.entry.concurrency || 'none' }})
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v3
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.entry.ruby }}
24
+ bundler-cache: true
25
+ - name: Set Concurrency
26
+ run: |
27
+ if [[ ! -z "${{ matrix.entry.concurrency }}" ]]; then
28
+ echo "Setting concurrency to ${{ matrix.entry.concurrency }}."
29
+ echo "CONCURRENCY=${{ matrix.entry.concurrency }}" >> $GITHUB_ENV
30
+ fi
31
+ - name: Run Tests
32
+ continue-on-error: ${{ matrix.entry.ignore || false }}
33
+ env:
34
+ RACK_ENV: test
35
+ run: |
36
+ bundle install
37
+ bundle exec rake
data/.gitignore CHANGED
@@ -1,7 +1,8 @@
1
- .env
2
- pkg
3
- Gemfile.lock
4
1
  .DS_Store
5
2
  .bundle
3
+ .byebug_history
4
+ .env
6
5
  .idea
7
6
  .rspec_status
7
+ Gemfile.lock
8
+ pkg
data/.rubocop.yml CHANGED
@@ -2,10 +2,11 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  require:
4
4
  - rubocop-performance
5
+ - rubocop-rake
5
6
  - rubocop-rspec
6
7
 
7
8
  AllCops:
8
- TargetRubyVersion: 2.5
9
+ TargetRubyVersion: 2.7
9
10
  NewCops: enable
10
11
  DisplayCopNames: true
11
12
  Exclude:
@@ -34,6 +35,10 @@ Style/Documentation:
34
35
  Style/ModuleFunction:
35
36
  Enabled: false
36
37
 
38
+ Style/NumericLiterals:
39
+ Exclude:
40
+ - 'spec/**/*'
41
+
37
42
  RSpec/InstanceVariable:
38
43
  Enabled: false
39
44
 
data/.rubocop_todo.yml CHANGED
@@ -1,22 +1,29 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-12-21 14:31:33 UTC using RuboCop version 0.93.1.
3
+ # on 2022-10-02 05:05:29 UTC using RuboCop version 1.26.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
10
+ # Configuration parameters: AllowedMethods.
11
+ # AllowedMethods: enums
12
+ Lint/ConstantDefinitionInBlock:
13
13
  Exclude:
14
- - 'slack-ruby-client.gemspec'
14
+ - 'lib/tasks/real_time.rake'
15
15
 
16
16
  # Offense count: 1
17
- Lint/ConstantDefinitionInBlock:
17
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
18
+ Lint/EmptyBlock:
18
19
  Exclude:
19
- - 'lib/tasks/real_time.rake'
20
+ - 'spec/support/real_time/concurrency/mock.rb'
21
+
22
+ # Offense count: 1
23
+ # Configuration parameters: AllowComments.
24
+ Lint/EmptyClass:
25
+ Exclude:
26
+ - 'spec/support/real_time/concurrency/mock.rb'
20
27
 
21
28
  # Offense count: 2
22
29
  Lint/MissingSuper:
@@ -25,19 +32,19 @@ Lint/MissingSuper:
25
32
  - 'lib/slack/real_time/stores/store.rb'
26
33
 
27
34
  # Offense count: 1
28
- # Cop supports --auto-correct.
35
+ # This cop supports unsafe auto-correction (--auto-correct-all).
29
36
  Lint/NonDeterministicRequireOrder:
30
37
  Exclude:
31
38
  - 'spec/spec_helper.rb'
32
39
 
33
40
  # Offense count: 2
34
- # Cop supports --auto-correct.
41
+ # This cop supports safe auto-correction (--auto-correct).
35
42
  Lint/RedundantCopDisableDirective:
36
43
  Exclude:
37
44
  - 'lib/slack-ruby-client.rb'
38
45
 
39
46
  # Offense count: 12
40
- # Configuration parameters: IgnoredMethods.
47
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
41
48
  Metrics/AbcSize:
42
49
  Max: 48
43
50
 
@@ -47,12 +54,12 @@ Metrics/CyclomaticComplexity:
47
54
  Max: 14
48
55
 
49
56
  # Offense count: 12
50
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
57
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
51
58
  Metrics/MethodLength:
52
59
  Max: 32
53
60
 
54
61
  # Offense count: 1
55
- # Configuration parameters: CountKeywordArgs.
62
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
56
63
  Metrics/ParameterLists:
57
64
  Max: 6
58
65
 
@@ -61,68 +68,95 @@ Metrics/ParameterLists:
61
68
  Metrics/PerceivedComplexity:
62
69
  Max: 16
63
70
 
71
+ # Offense count: 1
72
+ # Configuration parameters: MinSize.
73
+ Performance/CollectionLiteralInLoop:
74
+ Exclude:
75
+ - 'lib/tasks/real_time.rake'
76
+
64
77
  # Offense count: 2
65
- # Cop supports --auto-correct.
78
+ # This cop supports safe auto-correction (--auto-correct).
66
79
  Performance/RegexpMatch:
67
80
  Exclude:
68
81
  - 'lib/tasks/web.rake'
69
82
 
70
83
  # Offense count: 3
71
- # Cop supports --auto-correct.
84
+ # This cop supports safe auto-correction (--auto-correct).
85
+ Performance/StringInclude:
86
+ Exclude:
87
+ - 'lib/tasks/web.rake'
88
+
89
+ # Offense count: 3
90
+ # This cop supports safe auto-correction (--auto-correct).
72
91
  RSpec/ContextMethod:
73
92
  Exclude:
74
93
  - 'spec/slack/messages/formatting_spec.rb'
75
94
  - 'spec/slack/web/api/mixins/users_spec.rb'
76
95
 
77
- # Offense count: 77
96
+ # Offense count: 74
78
97
  # Configuration parameters: Prefixes.
79
98
  # Prefixes: when, with, without
80
99
  RSpec/ContextWording:
81
100
  Enabled: false
82
101
 
83
- # Offense count: 127
84
- # Cop supports --auto-correct.
85
- # Configuration parameters: AllowConsecutiveOneLiners.
86
- RSpec/EmptyLineAfterExample:
87
- Enabled: false
88
-
89
- # Offense count: 62
90
- # Configuration parameters: Max.
102
+ # Offense count: 63
103
+ # Configuration parameters: CountAsOne.
91
104
  RSpec/ExampleLength:
92
- Enabled: false
105
+ Max: 18
93
106
 
94
- # Offense count: 16
95
- # Configuration parameters: CustomTransform, IgnoreMethods.
107
+ # Offense count: 17
108
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
109
+ # Include: **/*_spec*rb*, **/spec/**/*
96
110
  RSpec/FilePath:
97
111
  Enabled: false
98
112
 
99
- # Offense count: 65
113
+ # Offense count: 63
100
114
  # Configuration parameters: .
101
115
  # SupportedStyles: have_received, receive
102
116
  RSpec/MessageSpies:
103
117
  EnforcedStyle: receive
104
118
 
105
- # Offense count: 95
119
+ # Offense count: 92
106
120
  RSpec/MultipleExpectations:
107
121
  Max: 5
108
122
 
123
+ # Offense count: 5
124
+ # Configuration parameters: AllowSubject.
125
+ RSpec/MultipleMemoizedHelpers:
126
+ Max: 9
127
+
109
128
  # Offense count: 3
110
129
  # Configuration parameters: IgnoreSharedExamples.
111
130
  RSpec/NamedSubject:
112
131
  Exclude:
113
132
  - 'spec/slack/web/api/mixins/conversations_list_spec.rb'
114
133
 
115
- # Offense count: 48
134
+ # Offense count: 44
116
135
  RSpec/NestedGroups:
117
136
  Max: 6
118
137
 
138
+ # Offense count: 5
139
+ RSpec/StubbedMock:
140
+ Exclude:
141
+ - 'spec/slack/real_time/client_spec.rb'
142
+ - 'spec/slack/real_time/event_handlers/event_handlers_spec.rb'
143
+ - 'spec/slack/web/api/pagination/cursor_spec.rb'
144
+ - 'spec/slack/web/client_spec.rb'
145
+
119
146
  # Offense count: 2
120
147
  RSpec/SubjectStub:
121
148
  Exclude:
122
149
  - 'spec/slack/web/api/mixins/conversations_spec.rb'
123
150
  - 'spec/slack/web/api/mixins/users_spec.rb'
124
151
 
125
- # Offense count: 12
152
+ # Offense count: 4
153
+ # This cop supports safe auto-correction (--auto-correct).
154
+ # Configuration parameters: .
155
+ # SupportedStyles: constant, string
156
+ RSpec/VerifiedDoubleReference:
157
+ EnforcedStyle: string
158
+
159
+ # Offense count: 10
126
160
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
127
161
  RSpec/VerifiedDoubles:
128
162
  Exclude:
@@ -131,14 +165,20 @@ RSpec/VerifiedDoubles:
131
165
  - 'spec/slack/web/faraday/response/raise_error_spec.rb'
132
166
  - 'spec/support/real_time/connected_client.rb'
133
167
 
168
+ # Offense count: 1
169
+ # This cop supports safe auto-correction (--auto-correct).
170
+ Rake/Desc:
171
+ Exclude:
172
+ - 'lib/tasks/git.rake'
173
+
134
174
  # Offense count: 4
135
- # Configuration parameters: .
175
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
136
176
  # SupportedStyles: annotated, template, unannotated
137
177
  Style/FormatStringToken:
138
178
  EnforcedStyle: unannotated
139
179
 
140
180
  # Offense count: 6
141
- # Cop supports --auto-correct.
181
+ # This cop supports safe auto-correction (--auto-correct).
142
182
  Style/GlobalStdStream:
143
183
  Exclude:
144
184
  - 'lib/slack/logger.rb'
@@ -147,11 +187,18 @@ Style/GlobalStdStream:
147
187
  - 'spec/slack/web/client_spec.rb'
148
188
 
149
189
  # Offense count: 1
150
- # Cop supports --auto-correct.
190
+ # This cop supports safe auto-correction (--auto-correct).
151
191
  Style/MultilineTernaryOperator:
152
192
  Exclude:
153
193
  - 'spec/support/vcr.rb'
154
194
 
195
+ # Offense count: 3
196
+ Style/OpenStructUse:
197
+ Exclude:
198
+ - 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
199
+ - 'spec/slack/web/api/pagination/cursor_spec.rb'
200
+ - 'spec/slack/web/faraday/response/raise_error_spec.rb'
201
+
155
202
  # Offense count: 1
156
203
  # Configuration parameters: AllowedMethods.
157
204
  # AllowedMethods: respond_to_missing?
@@ -160,7 +207,14 @@ Style/OptionalBooleanParameter:
160
207
  - 'spec/support/queue_with_timeout.rb'
161
208
 
162
209
  # Offense count: 1
163
- # Cop supports --auto-correct.
210
+ # This cop supports unsafe auto-correction (--auto-correct-all).
211
+ Style/SlicingWithRange:
212
+ Exclude:
213
+ - 'lib/slack/web/api/mixins/ids.id.rb'
214
+
215
+ # Offense count: 1
216
+ # This cop supports unsafe auto-correction (--auto-correct-all).
217
+ # Configuration parameters: Mode.
164
218
  Style/StringConcatenation:
165
219
  Exclude:
166
220
  - 'lib/tasks/real_time.rake'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ ### 2.1.0 (2023/03/17)
2
+
3
+ * [#440](https://github.com/ruby-grape/slack-ruby-client/pull/440): Added Enterprise support [via TideLift](https://tidelift.com/subscription/request-a-demo?utm_source=rubygems-slack-ruby-client&utm_medium=referral&utm_campaign=enterprise) - [@dblock](https://github.com/dblock).
4
+ * [#436](https://github.com/slack-ruby/slack-ruby-client/pull/436): Removed dependency on unused websocket-driver - [@blowfishpro](https://github.com/blowfishpro).
5
+ * [#434](https://github.com/slack-ruby/slack-ruby-client/pull/434): Fixed incompatibility with Faraday >= 2.7.0 and GLI usage in the `slack` script - [@blowfishpro](https://github.com/blowfishpro).
6
+ * [#446](https://github.com/slack-ruby/slack-ruby-client/pull/446): Added support for Ruby 3.2 - [@duffn](https://github.com/duffn).
7
+ * [#447](https://github.com/slack-ruby/slack-ruby-client/pull/447): Added `admin_conversations_bulkArchive`, `admin_conversations_bulkDelete`, `admin_conversations_bulkMove`, `admin_conversations_convertToPublic`, `admin_conversations_lookup`, `admin_roles_addAssignments`, `admin_roles_listAssignments`, `admin_roles_removeAssignments`, `functions_workflows_steps_list`, and `functions_workflows_steps_responses_export` - [@dblock](https://github.com/dblock).
8
+ * [#447](https://github.com/slack-ruby/slack-ruby-client/pull/447): Added pagination to `team_accessLogs` - [@dblock](https://github.com/dblock).
9
+
10
+ ### 2.0.0 (2022/10/19)
11
+
12
+ * [#416](https://github.com/slack-ruby/slack-ruby-client/pull/416): Removes default values for Faraday's SSL settings `ca_file` and `ca_path` - [@irphilli](https://github.com/irphilli).
13
+ * [#417](https://github.com/slack-ruby/slack-ruby-client/pull/417): Raise rescuable errors - [@zachahn](https://github.com/zachahn).
14
+ * [#419](https://github.com/slack-ruby/slack-ruby-client/pull/419): Use `rtm.connect` instead of `rtm.start` - [@kstole](https://github.com/kstole).
15
+ * [#420](https://github.com/slack-ruby/slack-ruby-client/pull/420): Fix default store missing event hooks - [@kstole](https://github.com/kstole).
16
+ * [#421](https://github.com/slack-ruby/slack-ruby-client/pull/421): Added `admin_audit_anomaly_allow_getItem`, `admin_audit_anomaly_allow_updateItem`, `files_completeUploadExternal`, `files_getUploadURLExternal` - [@kstole](https://github.com/kstole).
17
+ * [#421](https://github.com/slack-ruby/slack-ruby-client/pull/421): Raise error for mutually exclusive required options in views methods - [@kstole](https://github.com/kstole).
18
+ * [#424](https://github.com/slack-ruby/slack-ruby-client/pull/424): Updated real_time.rake to remove outdated event hooks and organize alphabetically - [@kstole](https://github.com/kstole).
19
+ * [#423](https://github.com/slack-ruby/slack-ruby-client/pull/423): Changed default store to `Slack::RealTime::Stores::Starter` and removed `Slack::RealTime::Store` - [@kstole](https://github.com/kstole).
20
+ * [#423](https://github.com/slack-ruby/slack-ruby-client/pull/423): Replaced `channels` and `groups` caches with `public_channels` and `private_channels` - [@kstole](https://github.com/kstole).
21
+ * [#423](https://github.com/slack-ruby/slack-ruby-client/pull/423): Added configurable `hello` hook to initialize `Slack::RealTime::Stores::Store` upon successful connection - [@kstole](https://github.com/kstole).
22
+ * [#425](https://github.com/slack-ruby/slack-ruby-client/pull/425): Updated web.rake to remove outdated endpoints and commands - [@kstole](https://github.com/kstole).
23
+
24
+ ### 1.1.0 (2022/06/05)
25
+
26
+ * [#400](https://github.com/slack-ruby/slack-ruby-client/pull/400): Replace Travis-CI with GitHub Actions - [@dblock](https://github.com/dblock).
27
+ * [#401](https://github.com/slack-ruby/slack-ruby-client/pull/401): Upgraded RuboCop to 1.26.0 - [@dblock](https://github.com/dblock).
28
+ * [#401](https://github.com/slack-ruby/slack-ruby-client/pull/401): Added support for Ruby 3.1.1 - [@dblock](https://github.com/dblock).
29
+ * [#405](https://github.com/slack-ruby/slack-ruby-client/pull/405): Added `admin_apps_requests_cancel`, `admin_users_unsupportedVersions_export`, `bookmarks_add`, `bookmarks_edit`, `bookmarks_list`, `bookmarks_remove` - [@dblock](https://github.com/dblock).
30
+ * [#404](https://github.com/slack-ruby/slack-ruby-client/pull/404): Update `chat_update` method not to raise error with parameter which contains only `reply_broadcast` - [@colorbox](https://github.com/colorbox).
31
+ * [#406](https://github.com/slack-ruby/slack-ruby-client/pull/406): Update Faraday to `>= 2.0` - [@schinery](https://github.com/slack-ruby/slack-ruby-client/pull/406).
32
+ * [#406](https://github.com/slack-ruby/slack-ruby-client/pull/406): Removed support for Ruby 2.5 and 2.6 - [@schinery](https://github.com/slack-ruby/slack-ruby-client/pull/406).
33
+ * [#406](https://github.com/slack-ruby/slack-ruby-client/pull/406): Test against latest Ruby 2.7, 3.0 and 3.1 - [@schinery](https://github.com/slack-ruby/slack-ruby-client/pull/406).
34
+ * [#406](https://github.com/slack-ruby/slack-ruby-client/pull/406): Upgraded RuboCop to 1.26.1 and lock to version - [@schinery](https://github.com/slack-ruby/slack-ruby-client/pull/406).
35
+ * [#406](https://github.com/slack-ruby/slack-ruby-client/pull/406): Updated Danger PR Linter GitHub action to use separate `Gemfile` - [@schinery](https://github.com/slack-ruby/slack-ruby-client/pull/406).
36
+
1
37
  ### 1.0.0 (2021/12/21)
2
38
 
3
39
  * [#394](https://github.com/slack-ruby/slack-ruby-client/pull/394): Added support for Ruby 3.0 - [@dblock](https://github.com/dblock).
data/CONTRIBUTING.md CHANGED
@@ -35,7 +35,7 @@ Create a new App under [https://api.slack.com/apps](https://api.slack.com/apps).
35
35
 
36
36
  On the next screen, note the API token.
37
37
 
38
- To run [the example in examples/hi_real_time](examples/hi_real_time/hi.rb), open a terminal, cd into _examples/hi_real_time_, run `bundle install`, followed by `SLACK_API_TOKEN=<your API token> bundle exec ruby hi.rb`.
38
+ To run [the example in examples/hi_real_time_and_web](examples/hi_real_time_and_web/hi.rb), open a terminal, cd into _examples/hi_real_time_and_web_, run `bundle install`, followed by `SLACK_API_TOKEN=<your API token> bundle exec ruby hi.rb`.
39
39
 
40
40
  ## Contribute Code
41
41
 
@@ -59,7 +59,7 @@ We definitely appreciate pull requests that highlight or reproduce a problem, ev
59
59
 
60
60
  Implement your feature or bug fix.
61
61
 
62
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ingored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
62
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop). Run `bundle exec rubocop` and fix any style issues highlighted, auto-correct issues when possible with `bundle exec rubocop -a`. To silence generally ignored issues, including line lengths or code complexity metrics, run `bundle exec rubocop --auto-gen-config`.
63
63
 
64
64
  Make sure that `bundle exec rake` completes without errors.
65
65
 
@@ -82,7 +82,7 @@ The broad steps are:
82
82
  2. Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb`.
83
83
  3. Generate a patch:
84
84
  ```
85
- git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
85
+ git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.added-support.patch
86
86
  ```
87
87
  4. Run `rake slack:api:update` to ensure that the patch is cleanly applied. Implement a test for the added or modified functionality and commit the patch file.
88
88
 
@@ -90,7 +90,8 @@ The broad steps are:
90
90
 
91
91
  The auto-generated method files may drift overtime e.g. new arguments may be added or descriptions changed. Since previous patches were based on the older auto-generated files, git may be unable to apply them to the new files. Resolving them requires some good ol' splicing:
92
92
  1. Run `rake slack:api:update SKIP_PATCH=true` to create the raw auto-generated files. Commit the files that you are updating, so we can run `git diff` later.
93
- 2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.1.patch`), copying code into the new files.
93
+ 2. Go through the old patches for the files (e.g. in `lib/slack/web/api/patches/chat.added-support.patch`), copying code into the new files.
94
+ - Run `git apply --reject path/to/patch-file.patch` to see hunks that couldn't be applied.
94
95
  3. Continue with Step 2 [above](#patching-slack-web-api).
95
96
 
96
97
 
@@ -157,7 +158,7 @@ git push origin my-feature-branch -f
157
158
 
158
159
  ### Check on Your Pull Request
159
160
 
160
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
161
+ Go back to your pull request after a few minutes and see whether it passed muster with CI. Everything should look green, otherwise fix issues and amend your commit as described above.
161
162
 
162
163
  ### Be Patient
163
164
 
data/Gemfile CHANGED
@@ -13,5 +13,17 @@ if ENV.key?('CONCURRENCY')
13
13
  end
14
14
 
15
15
  group :test do
16
- gem 'slack-ruby-danger', '~> 0.2.0', require: false
16
+ gem 'activesupport'
17
+ gem 'erubis'
18
+ gem 'faraday-typhoeus'
19
+ gem 'json-schema'
20
+ gem 'rake', '~> 13'
21
+ gem 'rspec'
22
+ gem 'rubocop', '1.26.1' # Lock to specific version to avoid breaking cops/changes
23
+ gem 'rubocop-performance'
24
+ gem 'rubocop-rake'
25
+ gem 'rubocop-rspec'
26
+ gem 'timecop'
27
+ gem 'vcr'
28
+ gem 'webmock'
17
29
  end
data/Gemfile.danger ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'danger-toc', '~> 0.2.0', require: false
5
+ gem 'slack-ruby-danger', '~> 0.2.0', require: false
6
+ end