slack-ruby-client 0.14.5 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.rubocop.yml +11 -3
  4. data/.rubocop_todo.yml +61 -23
  5. data/.travis.yml +1 -5
  6. data/CHANGELOG.md +43 -4
  7. data/CONTRIBUTING.md +17 -6
  8. data/Dangerfile +1 -1
  9. data/Gemfile +1 -2
  10. data/LICENSE.md +1 -1
  11. data/README.md +86 -52
  12. data/UPGRADING.md +20 -2
  13. data/bin/commands.rb +23 -0
  14. data/bin/commands/admin_analytics.rb +16 -0
  15. data/bin/commands/admin_apps.rb +15 -2
  16. data/bin/commands/admin_apps_approved.rb +17 -0
  17. data/bin/commands/admin_apps_restricted.rb +17 -0
  18. data/bin/commands/admin_barriers.rb +47 -0
  19. data/bin/commands/admin_conversations.rb +159 -0
  20. data/bin/commands/admin_conversations_ekm.rb +17 -0
  21. data/bin/commands/admin_conversations_restrictAccess.rb +37 -0
  22. data/bin/commands/admin_conversations_whitelist.rb +37 -0
  23. data/bin/commands/admin_emoji.rb +54 -0
  24. data/bin/commands/admin_inviteRequests.rb +36 -0
  25. data/bin/commands/admin_inviteRequests_approved.rb +16 -0
  26. data/bin/commands/admin_inviteRequests_denied.rb +16 -0
  27. data/bin/commands/admin_teams.rb +27 -0
  28. data/bin/commands/admin_teams_admins.rb +16 -0
  29. data/bin/commands/admin_teams_owners.rb +16 -0
  30. data/bin/commands/admin_teams_settings.rb +64 -0
  31. data/bin/commands/admin_usergroups.rb +48 -0
  32. data/bin/commands/admin_users.rb +97 -0
  33. data/bin/commands/admin_users_session.rb +22 -0
  34. data/bin/commands/api.rb +0 -1
  35. data/bin/commands/apps_connections.rb +13 -0
  36. data/bin/commands/apps_event_authorizations.rb +16 -0
  37. data/bin/commands/auth_teams.rb +16 -0
  38. data/bin/commands/bots.rb +1 -0
  39. data/bin/commands/calls.rb +52 -0
  40. data/bin/commands/calls_participants.rb +25 -0
  41. data/bin/commands/channels.rb +1 -155
  42. data/bin/commands/chat.rb +14 -12
  43. data/bin/commands/chat_scheduledMessages.rb +1 -0
  44. data/bin/commands/conversations.rb +15 -4
  45. data/bin/commands/dnd.rb +3 -1
  46. data/bin/commands/files.rb +7 -5
  47. data/bin/commands/files_remote.rb +3 -3
  48. data/bin/commands/groups.rb +1 -162
  49. data/bin/commands/im.rb +1 -63
  50. data/bin/commands/migration.rb +1 -0
  51. data/bin/commands/mpim.rb +1 -61
  52. data/bin/commands/oauth.rb +1 -1
  53. data/bin/commands/pins.rb +0 -2
  54. data/bin/commands/reactions.rb +1 -0
  55. data/bin/commands/search.rb +4 -1
  56. data/bin/commands/team.rb +3 -0
  57. data/bin/commands/usergroups.rb +6 -1
  58. data/bin/commands/usergroups_users.rb +2 -0
  59. data/bin/commands/users.rb +5 -3
  60. data/bin/commands/users_profile.rb +5 -5
  61. data/bin/commands/views.rb +1 -1
  62. data/bin/commands/workflows.rb +38 -0
  63. data/lib/slack-ruby-client.rb +5 -4
  64. data/lib/slack/events/request.rb +7 -3
  65. data/lib/slack/messages/message.rb +0 -4
  66. data/lib/slack/real_time/client.rb +2 -1
  67. data/lib/slack/real_time/concurrency.rb +0 -2
  68. data/lib/slack/real_time/concurrency/async.rb +1 -3
  69. data/lib/slack/real_time/config.rb +5 -14
  70. data/lib/slack/real_time/models/base.rb +0 -4
  71. data/lib/slack/real_time/socket.rb +2 -2
  72. data/lib/slack/real_time/stores/base.rb +3 -1
  73. data/lib/slack/version.rb +1 -1
  74. data/lib/slack/web/api/endpoints.rb +47 -0
  75. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  76. data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
  77. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +35 -0
  78. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +35 -0
  79. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  80. data/lib/slack/web/api/endpoints/admin_conversations.rb +246 -0
  81. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  82. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +61 -0
  83. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +64 -0
  84. data/lib/slack/web/api/endpoints/admin_emoji.rb +88 -0
  85. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +61 -0
  86. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +33 -0
  87. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +33 -0
  88. data/lib/slack/web/api/endpoints/admin_teams.rb +50 -0
  89. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +34 -0
  90. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +34 -0
  91. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +99 -0
  92. data/lib/slack/web/api/endpoints/admin_usergroups.rb +77 -0
  93. data/lib/slack/web/api/endpoints/admin_users.rb +161 -0
  94. data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
  95. data/lib/slack/web/api/endpoints/api.rb +0 -2
  96. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  97. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  98. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  99. data/lib/slack/web/api/endpoints/bots.rb +2 -0
  100. data/lib/slack/web/api/endpoints/calls.rb +83 -0
  101. data/lib/slack/web/api/endpoints/calls_participants.rb +42 -0
  102. data/lib/slack/web/api/endpoints/channels.rb +1 -245
  103. data/lib/slack/web/api/endpoints/chat.rb +23 -19
  104. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +3 -1
  105. data/lib/slack/web/api/endpoints/conversations.rb +37 -19
  106. data/lib/slack/web/api/endpoints/dnd.rb +4 -0
  107. data/lib/slack/web/api/endpoints/files.rb +8 -4
  108. data/lib/slack/web/api/endpoints/files_remote.rb +4 -4
  109. data/lib/slack/web/api/endpoints/groups.rb +0 -253
  110. data/lib/slack/web/api/endpoints/im.rb +0 -101
  111. data/lib/slack/web/api/endpoints/migration.rb +2 -0
  112. data/lib/slack/web/api/endpoints/mpim.rb +0 -96
  113. data/lib/slack/web/api/endpoints/oauth.rb +1 -4
  114. data/lib/slack/web/api/endpoints/pins.rb +3 -8
  115. data/lib/slack/web/api/endpoints/reactions.rb +5 -3
  116. data/lib/slack/web/api/endpoints/search.rb +6 -0
  117. data/lib/slack/web/api/endpoints/stars.rb +2 -2
  118. data/lib/slack/web/api/endpoints/team.rb +6 -0
  119. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  120. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  121. data/lib/slack/web/api/endpoints/users.rb +7 -5
  122. data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
  123. data/lib/slack/web/api/endpoints/views.rb +1 -1
  124. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  125. data/lib/slack/web/api/errors.rb +848 -0
  126. data/lib/slack/web/api/errors/internal_error.rb +14 -0
  127. data/lib/slack/web/api/errors/slack_error.rb +12 -0
  128. data/lib/slack/web/api/mixins.rb +1 -0
  129. data/lib/slack/web/api/mixins/channels.id.rb +1 -3
  130. data/lib/slack/web/api/mixins/conversations.id.rb +25 -0
  131. data/lib/slack/web/api/mixins/groups.id.rb +1 -3
  132. data/lib/slack/web/api/mixins/ids.id.rb +3 -5
  133. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  134. data/lib/slack/web/api/patches/{chat.6.block-kit-support.patch → chat.1.patch} +26 -24
  135. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  136. data/lib/slack/web/api/templates/errors.erb +20 -0
  137. data/lib/slack/web/api/templates/method.erb +4 -1
  138. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  139. data/lib/slack/web/client.rb +1 -1
  140. data/lib/slack/web/config.rb +2 -0
  141. data/lib/slack/web/faraday/connection.rb +23 -20
  142. data/lib/slack/web/faraday/response/raise_error.rb +16 -2
  143. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  144. data/lib/slack/web/pagination/cursor.rb +2 -2
  145. data/lib/tasks/real_time.rake +1 -1
  146. data/lib/tasks/web.rake +21 -4
  147. data/slack-ruby-client.gemspec +5 -5
  148. data/spec/fixtures/slack/web/channels_info.yml +108 -15
  149. data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
  150. data/spec/fixtures/slack/web/conversations_setTopic.yml +69 -0
  151. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +142 -0
  152. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +208 -0
  153. data/spec/fixtures/slack/web/views_open_error.yml +76 -0
  154. data/spec/slack/events/request_spec.rb +13 -8
  155. data/spec/slack/real_time/client_spec.rb +18 -1
  156. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  157. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  158. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  159. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  160. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  161. data/spec/slack/web/api/endpoints/admin_apps_approved_spec.rb +8 -0
  162. data/spec/slack/web/api/endpoints/admin_apps_restricted_spec.rb +8 -0
  163. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  164. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  165. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
  166. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +32 -0
  167. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +93 -0
  168. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +37 -0
  169. data/spec/slack/web/api/endpoints/admin_inviteRequests_approved_spec.rb +8 -0
  170. data/spec/slack/web/api/endpoints/admin_inviteRequests_denied_spec.rb +8 -0
  171. data/spec/slack/web/api/endpoints/admin_inviteRequests_spec.rb +18 -0
  172. data/spec/slack/web/api/endpoints/admin_teams_admins_spec.rb +13 -0
  173. data/spec/slack/web/api/endpoints/admin_teams_owners_spec.rb +13 -0
  174. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +53 -0
  175. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +16 -0
  176. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +37 -0
  177. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
  178. data/spec/slack/web/api/endpoints/admin_users_spec.rb +67 -0
  179. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
  180. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  181. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
  182. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
  183. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  184. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  185. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +24 -0
  186. data/spec/slack/web/api/endpoints/calls_spec.rb +31 -0
  187. data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
  188. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  189. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  190. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  191. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  192. data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
  193. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
  194. data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -14
  195. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  196. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  197. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  198. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  199. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  200. data/spec/slack/web/api/errors/slack_error_spec.rb +22 -0
  201. data/spec/slack/web/api/mixins/channels_spec.rb +1 -1
  202. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  203. data/spec/slack/web/api/mixins/conversations_spec.rb +43 -0
  204. data/spec/slack/web/api/mixins/groups_spec.rb +1 -1
  205. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  206. data/spec/slack/web/client_spec.rb +121 -0
  207. data/spec/slack/web/faraday/response/raise_error_spec.rb +33 -9
  208. data/spec/support/vcr.rb +4 -0
  209. metadata +145 -55
  210. data/examples/hi_real_time/Gemfile +0 -6
  211. data/examples/hi_real_time/hi.gif +0 -0
  212. data/examples/hi_real_time/hi.rb +0 -41
  213. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  214. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  215. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  216. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  217. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  218. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  219. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  220. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  221. data/lib/slack/web/api/patches/chat.1.text-attachments-required.patch +0 -13
  222. data/lib/slack/web/api/patches/chat.2.attachments-json.patch +0 -17
  223. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +0 -21
  224. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +0 -17
  225. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +0 -15
  226. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  227. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  228. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  229. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  230. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  231. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96288d9306b0d60b597f038d66aa5ffcfd2b643c0c85d4f0d974138462a47698
4
- data.tar.gz: b41ec139a4543ba972c845b373cf8b5a304f0ad1ed128d8a7d2057ef507721a8
3
+ metadata.gz: 568ad92dd27f6edd04fc00905af2a928c9f03f2d08105637b9ffc9f01319eaa3
4
+ data.tar.gz: 579f9004c9b1b9e3608bb2b59e55f0d09f0dbcba6761ad8035e367d4b9f06f4f
5
5
  SHA512:
6
- metadata.gz: f270c3ee301ecbfb6498b60b2e5d6d349f351cc0615156682a881e0b13b1a0a36dd574c45b37d69022da634865021cba4cb0f5dd0b2416c848e4ca9f1b5cb362
7
- data.tar.gz: 418a7f3e2076d7bfd0dc275d08b4e1ed31cf673a1e82ba47a7f875404c3b9704181ae695ebe76b1ccb720ff0a1da9b7e9fd3d206d537730cf238ead2a55e513d
6
+ metadata.gz: ab4943fb7a0bf3e1a75141943ee97324dfded3c6e5d691fc1ffa939c43c82f105f4763fed7496f45a1bf1b2b119ffeefa272df484d0e46bcb6f000cbd0906a78
7
+ data.tar.gz: '0857c64cf4544b3c0b744662ba38f94daad70b38069334a7b59beb4cf0999a47c9ec19e225a899f01e9cfd6c2336823e26b97ba0fce1ebbd498585952fec305d'
@@ -0,0 +1 @@
1
+ github: [dblock]
data/.rubocop.yml CHANGED
@@ -11,19 +11,27 @@ AllCops:
11
11
  - vendor/**/*
12
12
  - lib/slack/web/api/slack-api-ref/**/*
13
13
  - lib/slack/web/api/endpoints/* # Auto-generated
14
+ - lib/slack/web/api/errors.rb # Auto-generated
14
15
  - spec/slack/web/api/endpoints/* # Auto-generated
16
+
15
17
  Layout/EmptyLineAfterMagicComment:
16
18
  Enabled: false
19
+
17
20
  Metrics/BlockLength:
18
- Max: 250
21
+ Enabled: false
22
+
19
23
  Metrics/ClassLength:
20
24
  Max: 250
21
- Metrics/LineLength:
22
- Max: 100
25
+
26
+ Layout/LineLength:
27
+ Max: 128
28
+
23
29
  Style/Documentation:
24
30
  Enabled: false
31
+
25
32
  Style/ModuleFunction:
26
33
  Enabled: false
34
+
27
35
  Naming/FileName:
28
36
  Exclude:
29
37
  - lib/slack-ruby-client.rb # Required to match gemspec name
data/.rubocop_todo.yml CHANGED
@@ -1,24 +1,30 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-12-23 15:50:03 -0500 using RuboCop version 0.73.0.
3
+ # on 2020-08-24 10:08:11 -0400 using RuboCop version 0.82.0.
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
- # Offense count: 3
10
- # Configuration parameters: AllowComments.
11
- Lint/HandleExceptions:
9
+ # Offense count: 1
10
+ # Cop supports --auto-correct.
11
+ Lint/NonDeterministicRequireOrder:
12
+ Exclude:
13
+ - 'spec/spec_helper.rb'
14
+
15
+ # Offense count: 2
16
+ # Cop supports --auto-correct.
17
+ Lint/RedundantCopDisableDirective:
12
18
  Exclude:
13
- - 'lib/slack/real_time/concurrency/async.rb'
14
- - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
15
- - 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
19
+ - 'lib/slack-ruby-client.rb'
16
20
 
17
- # Offense count: 10
21
+ # Offense count: 11
22
+ # Configuration parameters: IgnoredMethods.
18
23
  Metrics/AbcSize:
19
24
  Max: 39
20
25
 
21
- # Offense count: 1
26
+ # Offense count: 2
27
+ # Configuration parameters: IgnoredMethods.
22
28
  Metrics/CyclomaticComplexity:
23
29
  Max: 9
24
30
 
@@ -28,31 +34,53 @@ Metrics/MethodLength:
28
34
  Max: 32
29
35
 
30
36
  # Offense count: 1
37
+ # Configuration parameters: CountKeywordArgs.
38
+ Metrics/ParameterLists:
39
+ Max: 6
40
+
41
+ # Offense count: 1
42
+ # Configuration parameters: IgnoredMethods.
31
43
  Metrics/PerceivedComplexity:
32
44
  Max: 9
33
45
 
34
- # Offense count: 1
35
- RSpec/AnyInstance:
46
+ # Offense count: 2
47
+ # Cop supports --auto-correct.
48
+ Performance/RegexpMatch:
49
+ Exclude:
50
+ - 'lib/tasks/web.rake'
51
+
52
+ # Offense count: 5
53
+ # Cop supports --auto-correct.
54
+ RSpec/ContextMethod:
36
55
  Exclude:
37
- - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
56
+ - 'spec/slack/messages/formatting_spec.rb'
57
+ - 'spec/slack/web/api/mixins/channels_spec.rb'
58
+ - 'spec/slack/web/api/mixins/groups_spec.rb'
59
+ - 'spec/slack/web/api/mixins/users_spec.rb'
38
60
 
39
- # Offense count: 70
61
+ # Offense count: 72
40
62
  # Configuration parameters: Prefixes.
41
63
  # Prefixes: when, with, without
42
64
  RSpec/ContextWording:
43
65
  Enabled: false
44
66
 
45
- # Offense count: 64
67
+ # Offense count: 131
68
+ # Cop supports --auto-correct.
69
+ # Configuration parameters: AllowConsecutiveOneLiners.
70
+ RSpec/EmptyLineAfterExample:
71
+ Enabled: false
72
+
73
+ # Offense count: 66
46
74
  # Configuration parameters: Max.
47
75
  RSpec/ExampleLength:
48
76
  Enabled: false
49
77
 
50
- # Offense count: 17
78
+ # Offense count: 18
51
79
  # Configuration parameters: CustomTransform, IgnoreMethods.
52
80
  RSpec/FilePath:
53
81
  Enabled: false
54
82
 
55
- # Offense count: 13
83
+ # Offense count: 14
56
84
  # Configuration parameters: AssignmentOnly.
57
85
  RSpec/InstanceVariable:
58
86
  Exclude:
@@ -60,25 +88,31 @@ RSpec/InstanceVariable:
60
88
  - 'spec/slack/real_time/client_spec.rb'
61
89
  - 'spec/slack/slack_spec.rb'
62
90
 
63
- # Offense count: 75
91
+ # Offense count: 77
64
92
  # Configuration parameters: .
65
93
  # SupportedStyles: have_received, receive
66
94
  RSpec/MessageSpies:
67
95
  EnforcedStyle: receive
68
96
 
69
- # Offense count: 93
70
- # Configuration parameters: AggregateFailuresByDefault.
97
+ # Offense count: 95
71
98
  RSpec/MultipleExpectations:
72
99
  Max: 5
73
100
 
74
- # Offense count: 34
101
+ # Offense count: 2
102
+ # Configuration parameters: IgnoreSharedExamples.
103
+ RSpec/NamedSubject:
104
+ Exclude:
105
+ - 'spec/slack/web/api/mixins/conversations_list_spec.rb'
106
+
107
+ # Offense count: 37
75
108
  RSpec/NestedGroups:
76
109
  Max: 6
77
110
 
78
- # Offense count: 3
111
+ # Offense count: 4
79
112
  RSpec/SubjectStub:
80
113
  Exclude:
81
114
  - 'spec/slack/web/api/mixins/channels_spec.rb'
115
+ - 'spec/slack/web/api/mixins/conversations_spec.rb'
82
116
  - 'spec/slack/web/api/mixins/groups_spec.rb'
83
117
  - 'spec/slack/web/api/mixins/users_spec.rb'
84
118
 
@@ -88,7 +122,11 @@ RSpec/VerifiedDoubles:
88
122
  Exclude:
89
123
  - 'spec/slack/events/request_spec.rb'
90
124
  - 'spec/slack/real_time/client_spec.rb'
91
- - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
92
- - 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
93
125
  - 'spec/slack/web/faraday/response/raise_error_spec.rb'
94
126
  - 'spec/support/real_time/connected_client.rb'
127
+
128
+ # Offense count: 4
129
+ # Configuration parameters: .
130
+ # SupportedStyles: annotated, template, unannotated
131
+ Style/FormatStringToken:
132
+ EnforcedStyle: unannotated
data/.travis.yml CHANGED
@@ -3,9 +3,9 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.3.8
7
6
  - 2.5.3
8
7
  - 2.6.0
8
+ - 2.7.1
9
9
  - ruby-head
10
10
  - jruby-head
11
11
 
@@ -14,10 +14,6 @@ matrix:
14
14
  - rvm: 2.4.1
15
15
  script:
16
16
  - bundle exec danger
17
- - rvm: 2.4.1
18
- env: CONCURRENCY=celluloid-io
19
- - rvm: 2.4.1
20
- env: CONCURRENCY=faye-websocket
21
17
  - rvm: 2.5.3
22
18
  env: CONCURRENCY=async-websocket
23
19
  allow_failures:
data/CHANGELOG.md CHANGED
@@ -1,9 +1,48 @@
1
+ ### 0.17.0 (2021/03/07)
2
+
3
+ * [#370](https://github.com/slack-ruby/slack-ruby-client/pull/370): Removed deprecated `im_`, `mpim_`, `channels_`, and `groups_` methods - [@dblock](https://github.com/dblock).
4
+ * [#368](https://github.com/slack-ruby/slack-ruby-client/pull/368): Removed `admin_conversations_whitelist` and `admin_conversations_disconnectShared` - [@dblock](https://github.com/dblock).
5
+ * [#359](https://github.com/slack-ruby/slack-ruby-client/pull/359): Handle non-JSON 500 errors - [@agrobbin](https://github.com/agrobbin).
6
+ * [#360](https://github.com/slack-ruby/slack-ruby-client/pull/360): Remove faye-websocket from the concurrency detection error message - [@dblock](https://github.com/dblock).
7
+ * [#369](https://github.com/slack-ruby/slack-ruby-client/pull/369): Support rack requests in `Slack::Events::Request` - [@wedgex](https://github.com/wedgex).
8
+
9
+ ### 0.16.0 (2021/01/24)
10
+
11
+ * [#350](https://github.com/slack-ruby/slack-ruby-client/pull/350): Handle server errors such as timeouts & non-JSON responses - [@ojab](https://github.com/ojab).
12
+ * [#354](https://github.com/slack-ruby/slack-ruby-client/pull/354): Rewind body after checking request signature - [@sunny](https://github.com/sunny).
13
+ * [#355](https://github.com/slack-ruby/slack-ruby-client/pull/355), [#357](https://github.com/slack-ruby/slack-ruby-client/pull/357): Removed `celluloid-io` and `faye-websocket` support - [@wasabigeek](https://github.com/wasabigeek).
14
+ * [#356](https://github.com/slack-ruby/slack-ruby-client/pull/356): Added `admin_apps_clearResolution`, `admin_conversations_getCustomRetention`, `admin_conversations_removeCustomRetention`, `admin_conversations_setCustomRetention`, `admin_users_session_list` and `auth_teams_list` endpoints - [@dblock](https://github.com/dblock).
15
+ * [#348](https://github.com/slack-ruby/slack-ruby-client/pull/348): Added `admin_conversations_archive`, `admin_conversations_convertToPrivate`, `admin_conversations_create`, `admin_conversations_delete`, `admin_conversations_disconnectShared`, `admin_conversations_getConversationPrefs`, `admin_conversations_getTeams`, `admin_conversations_invite`, `admin_conversations_rename`, `admin_conversations_search`, `admin_conversations_setConversationPrefs`, `admin_conversations_unarchive`, `admin_conversations_ekm_listOriginalConnectedChannelInfo`, `admin_users_session_invalidate`, `apps_event_authorizations_list`, `conversations_mark`, `workflows_stepCompleted`, `workflows_stepFailed` and `workflows_updateStep` endpoints - [@wasabigeek](https://github.com/wasabigeek).
16
+
17
+ ### 0.15.1 (2020/9/3)
18
+
19
+ * [#336](https://github.com/slack-ruby/slack-ruby-client/pull/336): Fix: handle nil events - [@pyama86](https://github.com/pyama86).
20
+ * [#339](https://github.com/slack-ruby/slack-ruby-client/pull/339): Fix: `channel_not_found` resolving channel IDs with 100+ channels - [@dblock](https://github.com/dblock).
21
+ * [#340](https://github.com/slack-ruby/slack-ruby-client/pull/340): Added `adapter` configuration setting to change the `Faraday` HTTP adapter - [@watsonjon](https://github.com/watsonjon).
22
+
23
+ ### 0.15.0 (2020/7/26)
24
+
25
+ * [#322](https://github.com/slack-ruby/slack-ruby-client/pull/322): Cache `Faraday::Connection` for persistent adapters - [@drbrain](https://github.com/drbrain).
26
+ * [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Require Faraday >= 1.0 - [@dblock](https://github.com/dblock).
27
+ * [#324](https://github.com/slack-ruby/slack-ruby-client/pull/324): Upgrade slack-ruby-danger, rubocop, rubocop-rspec and rubocop-performance - [@dblock](https://github.com/dblock).
28
+ * [#327](https://github.com/slack-ruby/slack-ruby-client/pull/327), [#326](https://github.com/slack-ruby/slack-ruby-client/pull/326): Added `admin_conversations_whitelist`, `admin_usergroups`, `calls` and `calls_participants` endpoints - [@wasabigeek](https://github.com/wasabigeek).
29
+ * [#329](https://github.com/slack-ruby/slack-ruby-client/pull/329): Log when methods are deprecated - [@wasabigeek](https://github.com/wasabigeek).
30
+ * [#325](https://github.com/slack-ruby/slack-ruby-client/pull/325): Remove activesupport dependency - [@ianks](https://github.com/ianks).
31
+ * [#331](https://github.com/slack-ruby/slack-ruby-client/pull/331): Use `conversations_list` instead of deprecated `channels_list`. Added `admin_conversations_restrictAccess_addGroup`, `admin_conversations_restrictAccess_listGroups` and `admin_conversations_restrictAccess_removeGroup` endpoints - [@wasabigeek](https://github.com/wasabigeek).
32
+
33
+ ### 0.14.6 (2020/3/28)
34
+
35
+ * [#305](https://github.com/slack-ruby/slack-ruby-client/pull/305): Added `admin_inviteRequests_approve`, `admin_inviteRequests_deny`, `admin_inviteRequests_list`, `admin_inviteRequests_approved_list`, `admin_inviteRequests_denied_list`, `admin_teams_create`, `admin_teams_list`, `admin_teams_admins_list`, `admin_teams_owners_list`, `admin_teams_settings`, `admin_teams_settings_setIcon`, `admin_teams_settings_setName`, `admin_teams_settings_setDescription`, `admin_users_assign`, `admin_users_invite`, `admin_users_remove`, `admin_users_setAdmin`, `admin_users_setOwner` and `admin_users_setRegular` endpoints - [@manuelmeurer](https://github.com/manuelmeurer).
36
+ * [#311](https://github.com/slack-ruby/slack-ruby-client/pull/311): Made Web API `response_metadata` more accessible in errors - [@jmanian](https://github.com/jmanian).
37
+ * [#312](https://github.com/slack-ruby/slack-ruby-client/pull/312): Added specific error classes for Web API - [@jmanian](https://github.com/jmanian).
38
+ * [#313](https://github.com/slack-ruby/slack-ruby-client/pull/313): Added `admin_teams_settings_info`, `admin_users_list`, `admin_users_setExpiration`, `admin_apps_approved_list`, `admin_apps_restricted_list`, `admin_conversations_setTeams`, `admin_emoji_add`, `admin_emoji_addAlias`, `admin_emoji_list`, `admin_emoji_remove` and `admin_emoji_rename` endpoints - [@dblock](https://github.com/dblock).
39
+
1
40
  ### 0.14.5 (2019/12/23)
2
41
 
3
42
  * [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
4
43
  * [#297](https://github.com/slack-ruby/slack-ruby-client/pull/297): Various Rubocop fixes - [@jcraigk](https://github.com/jcraigk).
5
- * [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Add `admin.apps`, `admin.app.requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
6
- * [#302](https://github.com/slack-ruby/slack-ruby-client/pull/302): Add `oauth.v2.access` and `views.published` endpoints - [@jwright](https://github.com/jwright).
44
+ * [#298](https://github.com/slack-ruby/slack-ruby-client/pull/298): Added `admin_apps`, `admin_app_requests` and `views` endpoints - [@jmanian](https://github.com/jmanian).
45
+ * [#303](https://github.com/slack-ruby/slack-ruby-client/pull/303): Added `oauth_v2_access` and `views_publish` endpoints - [@jwright](https://github.com/jwright).
7
46
  * [#309](https://github.com/slack-ruby/slack-ruby-client/pull/309): Stop ping on `inactive_account` and `invalid_auth` - [@dblock](https://github.com/dblock).
8
47
 
9
48
  ### 0.14.4 (2019/7/28)
@@ -167,8 +206,8 @@
167
206
  ### 0.7.1 (2016/5/2)
168
207
 
169
208
  * [#82](https://github.com/slack-ruby/slack-ruby-client/pull/82): Fix `usergroups.users.{list,update}` and `files.comments.{add,edit,delete}` APIs - [@masatomo](https://github.com/masatomo).
170
- * [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Add a `closed` event - [@rkadyb](https://github.com/rkadyb).
171
- * [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Add attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
209
+ * [#73](https://github.com/slack-ruby/slack-ruby-client/issues/73): Added a `closed` event - [@rkadyb](https://github.com/rkadyb).
210
+ * [#69](https://github.com/slack-ruby/slack-ruby-client/issues/69): Added attachments support for `Slack::Web::Api::Endpoints::Chat.chat_update` - [@nicka](https://github.com/nicka).
172
211
  * [#85](https://github.com/slack-ruby/slack-ruby-client/issues/85): Compatibility with WebMock 2.0 - [@dblock](https://github.com/dblock).
173
212
  * Added `as_user` to `chat_delete` Web API - [@dblock](https://github.com/dblock).
174
213
  * Added `reminders_add`, `reminders_complete`, `reminders_delete`, `reminders_info` and `reminders_list` to Web API - [@dblock](https://github.com/dblock).
data/CONTRIBUTING.md CHANGED
@@ -75,13 +75,24 @@ rake slack:api:update
75
75
 
76
76
  Sometimes it's necessary to patch auto-generated Slack Web API methods. For example, we want to help clients with calling `to_json` on the `attachments` parameter sent to `chat_postMessage`. See [#20](https://github.com/slack-ruby/slack-ruby-client/issues/20).
77
77
 
78
- Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb` and generate a patch.
78
+ The broad steps are:
79
+ 1. Run `rake slack:api:update` to check that existing patches are still valid.
80
+ - If you run into a `failed to apply patch` error, the auto-generated methods likely drifted from the last patch. Follow the steps [below](#resolving-patch-errors).
81
+ - This may add new methods if the API has updated, please split them up into multiple PRs if so.
82
+ 2. Make a change to a generated file, for example `lib/slack/web/api/endpoints/chat.rb`.
83
+ 3. Generate a patch:
84
+ ```
85
+ git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
86
+ ```
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
+
89
+ ##### Resolving Patch Errors
90
+
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
+ 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.
94
+ 3. Continue with Step 2 [above](#patching-slack-web-api).
79
95
 
80
- ```
81
- git diff --no-color HEAD lib/slack/web/api/endpoints/chat.rb > lib/slack/web/api/patches/chat.1.patch
82
- ```
83
-
84
- 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.
85
96
 
86
97
  ### Write Documentation
87
98
 
data/Dangerfile CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  danger.import_dangerfile(gem: 'slack-ruby-danger')
3
- toc.check
data/Gemfile CHANGED
@@ -13,6 +13,5 @@ if ENV.key?('CONCURRENCY')
13
13
  end
14
14
 
15
15
  group :test do
16
- gem 'danger-toc', '~> 0.1.3', require: false
17
- gem 'slack-ruby-danger', '~> 0.1.0', require: false
16
+ gem 'slack-ruby-danger', '~> 0.2.0', require: false
18
17
  end
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2015-2019 Daniel Doubrovkine, Artsy and Contributors
3
+ Copyright (c) 2015-2021 Daniel Doubrovkine, Artsy and Contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -20,17 +20,22 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
20
20
  - [Using the Legacy API Token](#using-the-legacy-api-token)
21
21
  - [Global Settings](#global-settings)
22
22
  - [Web Client](#web-client)
23
- - [Test Auth](#test-auth)
24
- - [Send Messages](#send-messages)
25
- - [List Channels](#list-channels)
26
- - [Upload a File](#upload-a-file)
27
- - [Get Channel Info](#get-channel-info)
28
- - [Get User Info](#get-user-info)
29
- - [Search for a User](#search-for-a-user)
30
- - [Other](#other)
23
+ - [Web Client Examples](#web-client-examples)
24
+ - [Test Auth](#test-auth)
25
+ - [Send Messages](#send-messages)
26
+ - [List Channels](#list-channels)
27
+ - [Upload a File](#upload-a-file)
28
+ - [Get Channel Info](#get-channel-info)
29
+ - [Get User Info](#get-user-info)
30
+ - [Search for a User](#search-for-a-user)
31
+ - [Other](#other)
31
32
  - [Web Client Options](#web-client-options)
32
33
  - [Pagination Support](#pagination-support)
34
+ - [Character Encoding](#character-encoding)
33
35
  - [Error Handling](#error-handling)
36
+ - [Slack Errors](#slack-errors)
37
+ - [Rate Limiting](#rate-limiting)
38
+ - [Other Errors](#other-errors)
34
39
  - [RealTime Client](#realtime-client)
35
40
  - [Slack::RealTime::Stores::Store](#slackrealtimestoresstore)
36
41
  - [Slack::RealTime::Stores::Starter](#slackrealtimestoresstarter)
@@ -42,8 +47,6 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
42
47
  - [Large Team Considerations](#large-team-considerations)
43
48
  - [Concurrency](#concurrency)
44
49
  - [Async](#async)
45
- - [Faye::Websocket with Eventmachine](#fayewebsocket-with-eventmachine)
46
- - [Celluloid](#celluloid)
47
50
  - [Events API](#events-api)
48
51
  - [Configuring Slack::Events](#configuring-slackevents)
49
52
  - [Verifying the Request Signature](#verifying-the-request-signature)
@@ -67,7 +70,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
67
70
 
68
71
  ## Stable Release
69
72
 
70
- You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.5. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
73
+ You're reading the documentation for the **stable** release of slack-ruby-client, 0.17.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
71
74
 
72
75
  ## Installation
73
76
 
@@ -77,7 +80,7 @@ Add to Gemfile.
77
80
  gem 'slack-ruby-client'
78
81
  ```
79
82
 
80
- If you're going to be using the RealTime client, add either `async-websocket`, `eventmachine` and `faye-websocket` or `celluloid-io`. See below for more information about concurrency. We recommend you use `async-websocket`.
83
+ If you're going to be using the RealTime client, add `async-websocket`. See below for more information about concurrency.
81
84
 
82
85
  ```
83
86
  gem 'async-websocket', '~> 0.8.0'
@@ -122,14 +125,18 @@ logger | An optional logger, defaults to `::Logger.new(STDOUT)` at `Logger
122
125
 
123
126
  The Slack Web API allows you to build applications that interact with Slack.
124
127
 
125
- #### Test Auth
128
+ #### Web Client Examples
129
+
130
+ Here are some examples of how to use the web client with the Web API.
131
+
132
+ ##### Test Auth
126
133
 
127
134
  ```ruby
128
135
  client = Slack::Web::Client.new
129
136
  client.auth_test
130
137
  ```
131
138
 
132
- #### Send Messages
139
+ ##### Send Messages
133
140
 
134
141
  Send messages with [chat_PostMessage](https://api.slack.com/methods/chat.postMessage).
135
142
 
@@ -141,17 +148,17 @@ See a fully working example in [examples/hi_web](examples/hi_web/hi.rb).
141
148
 
142
149
  ![](examples/hi_web/hi.gif)
143
150
 
144
- #### List Channels
151
+ ##### List Channels
145
152
 
146
- List channels with [channels_list](https://api.slack.com/methods/channels.list).
153
+ List channels with [conversations_list](https://api.slack.com/methods/conversations.list).
147
154
 
148
155
  ```ruby
149
- channels = client.channels_list.channels
156
+ channels = client.conversations_list.channels
150
157
 
151
158
  general_channel = channels.detect { |c| c.name == 'general' }
152
159
  ```
153
160
 
154
- #### Upload a File
161
+ ##### Upload a File
155
162
 
156
163
  Upload a file with [files_upload](https://api.slack.com/methods/files.upload).
157
164
 
@@ -166,19 +173,19 @@ client.files_upload(
166
173
  )
167
174
  ```
168
175
 
169
- ### Get Channel Info
176
+ ##### Get Channel Info
170
177
 
171
- You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `channels_list` in order to locate the channel ID.
178
+ You can use a channel ID or name (prefixed with `#`) in all functions that take a `:channel` argument. Lookup by name is not supported by the Slack API and the `channels_id` method called invokes `conversations_list` in order to locate the channel ID.
172
179
 
173
180
  ```ruby
174
- client.channels_info(channel: 'C04KB5X4D') # calls channels_info
181
+ client.conversations_info(channel: 'C04KB5X4D') # calls conversations_info
175
182
  ```
176
183
 
177
184
  ```ruby
178
- client.channels_info(channel: '#general') # calls channels_list followed by channels_info
185
+ client.conversations_info(channel: '#general') # calls conversations_list followed by conversations_info
179
186
  ```
180
187
 
181
- ### Get User Info
188
+ ##### Get User Info
182
189
 
183
190
  You can use a user ID or name (prefixed with `@`) in all functions that take a `:user` argument. Lookup by name is not supported by the Slack API and the `users_id` method called invokes `users_list` in order to locate the user ID.
184
191
 
@@ -190,7 +197,7 @@ client.users_info(user: 'U092BDCLV') # calls users_info
190
197
  client.users_info(user: '@dblock') # calls users_list followed by users_info
191
198
  ```
192
199
 
193
- ### Search for a User
200
+ ##### Search for a User
194
201
 
195
202
  Constructs an in-memory index of users and searches it. If you want to use this functionality, add the [picky](https://github.com/floere/picky) gem to your project's Gemfile.
196
203
 
@@ -198,7 +205,7 @@ Constructs an in-memory index of users and searches it. If you want to use this
198
205
  client.users_search(user: 'dblock')
199
206
  ```
200
207
 
201
- #### Other
208
+ ##### Other
202
209
 
203
210
  Refer to the [Slack Web API Method Reference](https://api.slack.com/methods) for the list of all available functions.
204
211
 
@@ -231,11 +238,12 @@ timeout | Optional open/read timeout in seconds.
231
238
  open_timeout | Optional connection open timeout in seconds.
232
239
  default_page_size | Optional page size for paginated requests, default is _100_.
233
240
  default_max_retries | Optional number of retries for paginated requests, default is _100_.
241
+ adapter | Optional HTTP adapter to use, defaults to `Faraday.default_adapter`.
234
242
 
235
243
  You can also pass request options, including `timeout` and `open_timeout` into individual calls.
236
244
 
237
245
  ```ruby
238
- client.channels_list(request: { timeout: 180 })
246
+ client.conversations_list(request: { timeout: 180 })
239
247
  ```
240
248
 
241
249
  You can also control what proxy options are used by modifying the `http_proxy` environment variable per [Net::HTTP's documentation](https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html#class-Net::HTTP-label-Proxies).
@@ -268,13 +276,59 @@ end
268
276
  all_members # many thousands of team members retrieved 10 at a time
269
277
  ```
270
278
 
279
+ #### Character Encoding
280
+
281
+ Note that Slack expects `text` to be UTF-8 encoded. If your messages appear with text such as `BAD+11` in Slack, check `text.encoding` and `.encode(Encoding::UTF_8)` your messages before sending them to Slack.
282
+
283
+ ```ruby
284
+ text = 'characters such as "Ñ", "Á", "É"'
285
+ text.encoding
286
+ => #<Encoding:UTF-8>
287
+ client.chat_postMessage(channel: '#general', text: text, as_user: true)
288
+ # renders 'characters such as "Ñ", "Á", "É"' in Slack
289
+
290
+ text = text.encode(Encoding::ISO_8859_1)
291
+ text.encoding
292
+ # => #<Encoding:ISO-8859-1>
293
+ client.chat_postMessage(channel: '#general', text: text, as_user: true)
294
+ # renders 'characters such as "BAD+11", "", "BAD+9"' in Slack
295
+ ```
296
+
271
297
  #### Error Handling
272
298
 
273
- If a request fails, a `Slack::Web::Api::Errors::SlackError` will be raised. The error message contains the error code. In case of multiple errors, the error codes are separated by commas. The original response is also accessible using the `response` attribute.
299
+ ##### Slack Errors
300
+
301
+ If Slack returns an error for the request, then an error will be raised. The error class is specific to the type of error that Slack returns. For instance if Slack returns `account_inactive` then the error will be `Slack::Web::Api::Errors::AccountInactive`. This allows you to handle certain types of errors as needed:
302
+
303
+ ```ruby
304
+ rescue Slack::Web::Api::Errors::AccountInactive => e
305
+ # deal with inactive account
306
+ end
307
+ ```
308
+
309
+ All of these errors inherit from `Slack::Web::Api::Errors::SlackError`, so you can handle or silence all errors if necessary:
310
+
311
+ ```ruby
312
+ rescue Slack::Web::Api::Errors::SlackError => e
313
+ # capture all Slack errors
314
+ end
315
+ ```
316
+
317
+ If there's a new error type that is not yet known by this library, then it will raise `Slack::Web::Api::Errors::SlackError`. (Update the Web API if you find that errors are missing — see [CONTRIBUTING](CONTRIBUTING.md).)
318
+
319
+ In all of these cases the error message contains the error code, which is also accessible with `slack_error.error`. In case of multiple errors, the error message contains the error codes separated by commas, or they are accessible as an array with `slack_error.errors`. The original response is also accessible using the `response` attribute. The `response_metadata` is accessible with `slack_error.response_metadata`.
320
+
321
+ ##### Rate Limiting
322
+
323
+ If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead. (This does not inherit from `Slack::Web::Api::Errors::SlackError`.)
324
+
325
+ ##### Other Errors
274
326
 
275
- If you exceed [Slack’s rate limits](https://api.slack.com/docs/rate-limits), a `Slack::Web::Api::Errors::TooManyRequestsError` will be raised instead.
327
+ In case of Slack temporarily unavailability a `Slack::Web::Api::Errors::ServerError` (`Slack::Web::Api::Errors::SlackError` subclass) subclasses will be raised and original `Faraday::Error` will be accesible via `exception.cause`.
276
328
 
277
- In any other case, a `Faraday::ClientError` will be raised. This may be the case if Slack is temporarily unavailable, for example.
329
+ Specifically `Slack::Web::Api::Errors::ParsingError` will be raised on non-json response (i. e. 200 OK with `Slack unavailable` HTML page) and `Slack::Web::Api::Errors::HttpRequestError` subclasses for connection failures (`Slack::Web::Api::Errors::TimeoutError` for read/open timeouts & `Slack::Web::Api::Errors::UnavailableError` for 5xx HTTP responses).
330
+
331
+ In any other case, a `Faraday::ClientError` will be raised.
278
332
 
279
333
  ### RealTime Client
280
334
 
@@ -439,7 +493,7 @@ See [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134) for a dis
439
493
 
440
494
  #### Concurrency
441
495
 
442
- `Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async), [Faye::WebSocket](https://github.com/faye/faye-websocket-ruby) with [Eventmachine](https://github.com/eventmachine/eventmachine) and [Celluloid](https://github.com/celluloid/celluloid). It will auto-detect one or the other depending on the gems in your Gemfile, but you can also set concurrency explicitly.
496
+ `Slack::RealTime::Client` needs help from a concurrency library and supports [Async](https://github.com/socketry/async).
443
497
 
444
498
  ```ruby
445
499
  Slack::RealTime.configure do |config|
@@ -457,7 +511,7 @@ client.start_async
457
511
 
458
512
  ##### Async
459
513
 
460
- This is the recommended library. Add `async-websocket` to your Gemfile.
514
+ Add `async-websocket` to your Gemfile.
461
515
 
462
516
  ```
463
517
  gem 'async-websocket'
@@ -465,26 +519,6 @@ gem 'async-websocket'
465
519
 
466
520
  See a fully working example in [examples/hi_real_time_async_async](examples/hi_real_time_async_async/hi.rb).
467
521
 
468
- ##### Faye::Websocket with Eventmachine
469
-
470
- Add the following to your Gemfile.
471
-
472
- ```
473
- gem 'faye-websocket'
474
- ```
475
-
476
- See a fully working example in [examples/hi_real_time_async_eventmachine](examples/hi_real_time_async_eventmachine/hi.rb).
477
-
478
- ##### Celluloid
479
-
480
- Add the following to your Gemfile.
481
-
482
- ```
483
- gem 'celluloid-io', require: ['celluloid/current', 'celluloid/io']
484
- ```
485
-
486
- See a fully working example in [examples/hi_real_time_async_celluloid](examples/hi_real_time_async_celluloid/hi.rb).
487
-
488
522
  ### Events API
489
523
 
490
524
  This library provides limited support for the [Slack Events API](https://api.slack.com/events-api).
@@ -612,6 +646,6 @@ See [CONTRIBUTING](CONTRIBUTING.md).
612
646
 
613
647
  ## Copyright and License
614
648
 
615
- Copyright (c) 2015-2019, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
649
+ Copyright (c) 2015-2021, [Daniel Doubrovkine](https://twitter.com/dblockdotorg), [Artsy](https://www.artsy.net) and [Contributors](CHANGELOG.md).
616
650
 
617
651
  This project is licensed under the [MIT License](LICENSE.md).