slack-ruby-client 0.14.4 → 0.14.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +19 -11
  3. data/.rubocop_todo.yml +66 -47
  4. data/CHANGELOG.md +8 -0
  5. data/Dangerfile +1 -0
  6. data/Gemfile +1 -0
  7. data/README.md +16 -9
  8. data/Rakefile +1 -0
  9. data/bin/commands.rb +6 -0
  10. data/bin/commands/admin_apps.rb +27 -0
  11. data/bin/commands/admin_apps_requests.rb +16 -0
  12. data/bin/commands/admin_users_session.rb +3 -2
  13. data/bin/commands/api.rb +3 -2
  14. data/bin/commands/apps.rb +3 -2
  15. data/bin/commands/apps_permissions.rb +5 -4
  16. data/bin/commands/apps_permissions_resources.rb +3 -2
  17. data/bin/commands/apps_permissions_scopes.rb +3 -2
  18. data/bin/commands/apps_permissions_users.rb +5 -4
  19. data/bin/commands/auth.rb +5 -4
  20. data/bin/commands/bots.rb +3 -2
  21. data/bin/commands/channels.rb +31 -30
  22. data/bin/commands/chat.rb +19 -18
  23. data/bin/commands/chat_scheduledMessages.rb +3 -2
  24. data/bin/commands/conversations.rb +35 -34
  25. data/bin/commands/dialog.rb +3 -2
  26. data/bin/commands/dnd.rb +9 -8
  27. data/bin/commands/emoji.rb +3 -2
  28. data/bin/commands/files.rb +13 -12
  29. data/bin/commands/files_comments.rb +3 -2
  30. data/bin/commands/files_remote.rb +78 -0
  31. data/bin/commands/groups.rb +33 -32
  32. data/bin/commands/im.rb +13 -12
  33. data/bin/commands/migration.rb +3 -2
  34. data/bin/commands/mpim.rb +11 -10
  35. data/bin/commands/oauth.rb +5 -4
  36. data/bin/commands/oauth_v2.rb +17 -0
  37. data/bin/commands/pins.rb +7 -8
  38. data/bin/commands/reactions.rb +10 -11
  39. data/bin/commands/reminders.rb +11 -10
  40. data/bin/commands/rtm.rb +5 -4
  41. data/bin/commands/search.rb +7 -6
  42. data/bin/commands/stars.rb +7 -6
  43. data/bin/commands/team.rb +9 -8
  44. data/bin/commands/team_profile.rb +3 -2
  45. data/bin/commands/usergroups.rb +11 -10
  46. data/bin/commands/usergroups_users.rb +5 -4
  47. data/bin/commands/users.rb +21 -20
  48. data/bin/commands/users_admin.rb +1 -0
  49. data/bin/commands/users_prefs.rb +1 -0
  50. data/bin/commands/users_profile.rb +5 -4
  51. data/bin/commands/views.rb +48 -0
  52. data/bin/slack +1 -2
  53. data/examples/hi_real_time/Gemfile +1 -0
  54. data/examples/hi_real_time/hi.rb +7 -3
  55. data/examples/hi_real_time_and_web/Gemfile +1 -0
  56. data/examples/hi_real_time_and_web/hi.rb +7 -3
  57. data/examples/hi_real_time_async_async/Gemfile +1 -0
  58. data/examples/hi_real_time_async_async/hi.rb +6 -2
  59. data/examples/hi_real_time_async_celluloid/Gemfile +1 -0
  60. data/examples/hi_real_time_async_celluloid/hi.rb +7 -3
  61. data/examples/hi_real_time_async_eventmachine/Gemfile +1 -0
  62. data/examples/hi_real_time_async_eventmachine/hi.rb +7 -3
  63. data/examples/hi_web/Gemfile +1 -0
  64. data/examples/hi_web/hi.rb +1 -0
  65. data/examples/new_ticket/Gemfile +1 -0
  66. data/examples/new_ticket/new_ticket.rb +1 -0
  67. data/lib/slack-ruby-client.rb +3 -2
  68. data/lib/slack.rb +1 -0
  69. data/lib/slack/config.rb +1 -0
  70. data/lib/slack/events/config.rb +1 -0
  71. data/lib/slack/events/request.rb +3 -1
  72. data/lib/slack/logger.rb +6 -5
  73. data/lib/slack/messages/formatting.rb +1 -0
  74. data/lib/slack/messages/message.rb +1 -0
  75. data/lib/slack/real_time/api/message.rb +3 -1
  76. data/lib/slack/real_time/api/message_id.rb +1 -0
  77. data/lib/slack/real_time/api/ping.rb +5 -2
  78. data/lib/slack/real_time/api/typing.rb +3 -1
  79. data/lib/slack/real_time/client.rb +19 -12
  80. data/lib/slack/real_time/concurrency.rb +1 -0
  81. data/lib/slack/real_time/concurrency/async.rb +15 -7
  82. data/lib/slack/real_time/concurrency/celluloid.rb +9 -3
  83. data/lib/slack/real_time/concurrency/eventmachine.rb +7 -4
  84. data/lib/slack/real_time/config.rb +6 -1
  85. data/lib/slack/real_time/models.rb +1 -0
  86. data/lib/slack/real_time/models/base.rb +1 -0
  87. data/lib/slack/real_time/models/bot.rb +1 -0
  88. data/lib/slack/real_time/models/channel.rb +1 -0
  89. data/lib/slack/real_time/models/group.rb +1 -0
  90. data/lib/slack/real_time/models/im.rb +1 -0
  91. data/lib/slack/real_time/models/team.rb +1 -0
  92. data/lib/slack/real_time/models/user.rb +1 -0
  93. data/lib/slack/real_time/socket.rb +14 -11
  94. data/lib/slack/real_time/stores.rb +1 -0
  95. data/lib/slack/real_time/stores/base.rb +1 -0
  96. data/lib/slack/real_time/stores/starter.rb +1 -0
  97. data/lib/slack/real_time/stores/store.rb +16 -25
  98. data/lib/slack/version.rb +2 -1
  99. data/lib/slack/web/api/endpoints.rb +11 -0
  100. data/lib/slack/web/api/endpoints/admin_apps.rb +42 -0
  101. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +33 -0
  102. data/lib/slack/web/api/endpoints/admin_users_session.rb +2 -1
  103. data/lib/slack/web/api/endpoints/api.rb +2 -1
  104. data/lib/slack/web/api/endpoints/apps.rb +2 -1
  105. data/lib/slack/web/api/endpoints/apps_permissions.rb +3 -2
  106. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +2 -1
  107. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +2 -1
  108. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +3 -2
  109. data/lib/slack/web/api/endpoints/auth.rb +3 -2
  110. data/lib/slack/web/api/endpoints/bots.rb +2 -1
  111. data/lib/slack/web/api/endpoints/channels.rb +16 -16
  112. data/lib/slack/web/api/endpoints/chat.rb +10 -9
  113. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +2 -1
  114. data/lib/slack/web/api/endpoints/conversations.rb +18 -17
  115. data/lib/slack/web/api/endpoints/dialog.rb +2 -1
  116. data/lib/slack/web/api/endpoints/dnd.rb +5 -4
  117. data/lib/slack/web/api/endpoints/emoji.rb +2 -1
  118. data/lib/slack/web/api/endpoints/files.rb +7 -6
  119. data/lib/slack/web/api/endpoints/files_comments.rb +2 -1
  120. data/lib/slack/web/api/endpoints/files_remote.rb +127 -0
  121. data/lib/slack/web/api/endpoints/groups.rb +17 -22
  122. data/lib/slack/web/api/endpoints/im.rb +7 -8
  123. data/lib/slack/web/api/endpoints/migration.rb +2 -1
  124. data/lib/slack/web/api/endpoints/mpim.rb +6 -7
  125. data/lib/slack/web/api/endpoints/oauth.rb +3 -2
  126. data/lib/slack/web/api/endpoints/oauth_v2.rb +30 -0
  127. data/lib/slack/web/api/endpoints/pins.rb +5 -9
  128. data/lib/slack/web/api/endpoints/reactions.rb +9 -12
  129. data/lib/slack/web/api/endpoints/reminders.rb +6 -5
  130. data/lib/slack/web/api/endpoints/rtm.rb +3 -2
  131. data/lib/slack/web/api/endpoints/search.rb +4 -3
  132. data/lib/slack/web/api/endpoints/stars.rb +4 -5
  133. data/lib/slack/web/api/endpoints/team.rb +5 -5
  134. data/lib/slack/web/api/endpoints/team_profile.rb +2 -1
  135. data/lib/slack/web/api/endpoints/usergroups.rb +6 -5
  136. data/lib/slack/web/api/endpoints/usergroups_users.rb +3 -2
  137. data/lib/slack/web/api/endpoints/users.rb +11 -16
  138. data/lib/slack/web/api/endpoints/users_admin.rb +1 -0
  139. data/lib/slack/web/api/endpoints/users_prefs.rb +1 -0
  140. data/lib/slack/web/api/endpoints/users_profile.rb +3 -2
  141. data/lib/slack/web/api/endpoints/views.rb +97 -0
  142. data/lib/slack/web/api/error.rb +1 -0
  143. data/lib/slack/web/api/errors/slack_error.rb +2 -1
  144. data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -0
  145. data/lib/slack/web/api/mixins.rb +1 -0
  146. data/lib/slack/web/api/mixins/channels.id.rb +1 -0
  147. data/lib/slack/web/api/mixins/groups.id.rb +1 -0
  148. data/lib/slack/web/api/mixins/ids.id.rb +4 -1
  149. data/lib/slack/web/api/mixins/users.id.rb +1 -0
  150. data/lib/slack/web/api/mixins/users.search.rb +1 -0
  151. data/lib/slack/web/api/patches/views.1.view-json.patch +40 -0
  152. data/lib/slack/web/api/patches/views.1.views-published.patch +16 -0
  153. data/lib/slack/web/api/templates/command.erb +1 -0
  154. data/lib/slack/web/api/templates/commands.erb +1 -0
  155. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  156. data/lib/slack/web/api/templates/method.erb +1 -0
  157. data/lib/slack/web/api/templates/method_spec.erb +1 -0
  158. data/lib/slack/web/client.rb +1 -0
  159. data/lib/slack/web/config.rb +1 -0
  160. data/lib/slack/web/faraday/connection.rb +1 -0
  161. data/lib/slack/web/faraday/request.rb +1 -0
  162. data/lib/slack/web/faraday/response/raise_error.rb +7 -6
  163. data/lib/slack/web/pagination/cursor.rb +1 -0
  164. data/lib/slack_ruby_client.rb +1 -0
  165. data/lib/tasks/git.rake +1 -0
  166. data/lib/tasks/real_time.rake +12 -4
  167. data/lib/tasks/update.rake +1 -0
  168. data/lib/tasks/web.rake +17 -6
  169. data/screenshots/create-app.png +0 -0
  170. data/slack-ruby-client.gemspec +4 -1
  171. data/spec/integration/integration_spec.rb +16 -17
  172. data/spec/slack/config_spec.rb +2 -0
  173. data/spec/slack/events/config_spec.rb +8 -4
  174. data/spec/slack/events/request_spec.rb +67 -37
  175. data/spec/slack/messages/formatting_spec.rb +25 -13
  176. data/spec/slack/real_time/api/message_spec.rb +6 -1
  177. data/spec/slack/real_time/api/ping_spec.rb +2 -0
  178. data/spec/slack/real_time/api/typing_spec.rb +5 -1
  179. data/spec/slack/real_time/client_spec.rb +137 -39
  180. data/spec/slack/real_time/concurrency/celluloid_spec.rb +11 -6
  181. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +9 -1
  182. data/spec/slack/real_time/concurrency/it_behaves_like_a_realtime_socket.rb +2 -0
  183. data/spec/slack/real_time/event_handlers/bot_spec.rb +2 -1
  184. data/spec/slack/real_time/event_handlers/channel_spec.rb +9 -6
  185. data/spec/slack/real_time/event_handlers/event_handlers_spec.rb +2 -1
  186. data/spec/slack/real_time/event_handlers/group_spec.rb +5 -4
  187. data/spec/slack/real_time/event_handlers/im_spec.rb +4 -3
  188. data/spec/slack/real_time/event_handlers/team_spec.rb +3 -1
  189. data/spec/slack/real_time/event_handlers/user_spec.rb +1 -0
  190. data/spec/slack/real_time/rtm_connect_spec.rb +1 -0
  191. data/spec/slack/real_time/rtm_start_spec.rb +1 -0
  192. data/spec/slack/real_time/store_spec.rb +2 -1
  193. data/spec/slack/slack_spec.rb +37 -5
  194. data/spec/slack/version_spec.rb +2 -1
  195. data/spec/slack/web/api/endpoints/admin_apps_requests_spec.rb +8 -0
  196. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +8 -0
  197. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +1 -0
  198. data/spec/slack/web/api/endpoints/api_spec.rb +1 -0
  199. data/spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb +1 -0
  200. data/spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb +1 -0
  201. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +1 -0
  202. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +1 -0
  203. data/spec/slack/web/api/endpoints/apps_spec.rb +1 -0
  204. data/spec/slack/web/api/endpoints/bots_spec.rb +1 -0
  205. data/spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb +1 -0
  206. data/spec/slack/web/api/endpoints/conversations_spec.rb +1 -0
  207. data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +5 -1
  208. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +2 -0
  209. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +80 -25
  210. data/spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb +12 -4
  211. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +2 -0
  212. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +6 -1
  213. data/spec/slack/web/api/endpoints/custom_specs/views_spec.rb +95 -0
  214. data/spec/slack/web/api/endpoints/dnd_spec.rb +1 -0
  215. data/spec/slack/web/api/endpoints/emoji_spec.rb +1 -0
  216. data/spec/slack/web/api/endpoints/files_comments_spec.rb +1 -0
  217. data/spec/slack/web/api/endpoints/files_remote_spec.rb +24 -0
  218. data/spec/slack/web/api/endpoints/files_spec.rb +1 -0
  219. data/spec/slack/web/api/endpoints/im_spec.rb +1 -0
  220. data/spec/slack/web/api/endpoints/migration_spec.rb +1 -0
  221. data/spec/slack/web/api/endpoints/mpim_spec.rb +1 -0
  222. data/spec/slack/web/api/endpoints/oauth_spec.rb +1 -0
  223. data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +13 -0
  224. data/spec/slack/web/api/endpoints/pins_spec.rb +5 -1
  225. data/spec/slack/web/api/endpoints/reactions_spec.rb +8 -1
  226. data/spec/slack/web/api/endpoints/reminders_spec.rb +1 -0
  227. data/spec/slack/web/api/endpoints/rtm_spec.rb +1 -0
  228. data/spec/slack/web/api/endpoints/search_spec.rb +1 -0
  229. data/spec/slack/web/api/endpoints/stars_spec.rb +1 -0
  230. data/spec/slack/web/api/endpoints/team_profile_spec.rb +1 -0
  231. data/spec/slack/web/api/endpoints/team_spec.rb +1 -0
  232. data/spec/slack/web/api/endpoints/usergroups_spec.rb +1 -0
  233. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +1 -0
  234. data/spec/slack/web/api/endpoints/users_admin_spec.rb +1 -0
  235. data/spec/slack/web/api/endpoints/users_prefs_spec.rb +1 -0
  236. data/spec/slack/web/api/endpoints/users_profile_spec.rb +1 -0
  237. data/spec/slack/web/api/endpoints/views_spec.rb +29 -0
  238. data/spec/slack/web/api/error_spec.rb +4 -2
  239. data/spec/slack/web/api/errors/service_unavailable_spec.rb +6 -3
  240. data/spec/slack/web/api/errors/slack_error_spec.rb +4 -2
  241. data/spec/slack/web/api/mixins/channels_spec.rb +17 -7
  242. data/spec/slack/web/api/mixins/groups_spec.rb +17 -7
  243. data/spec/slack/web/api/mixins/users_spec.rb +17 -8
  244. data/spec/slack/web/api/pagination/cursor_spec.rb +40 -10
  245. data/spec/slack/web/client_spec.rb +45 -18
  246. data/spec/slack/web/faraday/response/raise_error_spec.rb +16 -5
  247. data/spec/spec_helper.rb +2 -1
  248. data/spec/support/queue_with_timeout.rb +1 -0
  249. data/spec/support/real_time/concurrency/mock.rb +1 -0
  250. data/spec/support/real_time/connected_client.rb +9 -3
  251. data/spec/support/real_time/event.rb +1 -0
  252. data/spec/support/token.rb +1 -0
  253. data/spec/support/vcr.rb +1 -0
  254. metadata +59 -7
  255. data/screenshots/register-bot.png +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf802522f0f9aa42f83506227b02fcf37beb861429316f9ae2155d3eedde79d8
4
- data.tar.gz: 5a81c7017616999820506cdff2af962ecbb601931f04da9598bdc9767307769b
3
+ metadata.gz: 96288d9306b0d60b597f038d66aa5ffcfd2b643c0c85d4f0d974138462a47698
4
+ data.tar.gz: b41ec139a4543ba972c845b373cf8b5a304f0ad1ed128d8a7d2057ef507721a8
5
5
  SHA512:
6
- metadata.gz: e648e70aed991cba05dce9cc9907771d8b13c69ecab9386093460d8d3547e0fc825393d174dee7bddf1fcef15b8f85b496ae9a24cadacc4a7054db775508527a
7
- data.tar.gz: e8397379744685f4880c20afdadaf9c19439ea9f4cb0c362e596849416f67f836686626f65af81e5ce933c2eeb9c33117fcb8f64bb6967be4963f6a477f61910
6
+ metadata.gz: f270c3ee301ecbfb6498b60b2e5d6d349f351cc0615156682a881e0b13b1a0a36dd574c45b37d69022da634865021cba4cb0f5dd0b2416c848e4ca9f1b5cb362
7
+ data.tar.gz: 418a7f3e2076d7bfd0dc275d08b4e1ed31cf673a1e82ba47a7f875404c3b9704181ae695ebe76b1ccb720ff0a1da9b7e9fd3d206d537730cf238ead2a55e513d
data/.rubocop.yml CHANGED
@@ -1,21 +1,29 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
6
+
1
7
  AllCops:
8
+ DisplayCopNames: true
2
9
  Exclude:
10
+ - bin/**/*
3
11
  - vendor/**/*
4
12
  - lib/slack/web/api/slack-api-ref/**/*
5
-
6
- Metrics:
13
+ - lib/slack/web/api/endpoints/* # Auto-generated
14
+ - spec/slack/web/api/endpoints/* # Auto-generated
15
+ Layout/EmptyLineAfterMagicComment:
7
16
  Enabled: false
8
-
17
+ Metrics/BlockLength:
18
+ Max: 250
19
+ Metrics/ClassLength:
20
+ Max: 250
9
21
  Metrics/LineLength:
10
- Max: 512
11
-
22
+ Max: 100
12
23
  Style/Documentation:
13
24
  Enabled: false
14
-
15
- Naming/MethodName:
16
- Enabled: false
17
-
18
25
  Style/ModuleFunction:
19
26
  Enabled: false
20
-
21
- inherit_from: .rubocop_todo.yml
27
+ Naming/FileName:
28
+ Exclude:
29
+ - lib/slack-ruby-client.rb # Required to match gemspec name
data/.rubocop_todo.yml CHANGED
@@ -1,75 +1,94 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-07-21 18:39:19 -0400 using RuboCop version 0.61.1.
3
+ # on 2019-12-23 15:50:03 -0500 using RuboCop version 0.73.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: 2
10
- # Configuration parameters: AllowSafeAssignment.
11
- Lint/AssignmentInCondition:
12
- Exclude:
13
- - 'lib/slack/real_time/concurrency/async.rb'
14
- - 'lib/slack/real_time/socket.rb'
15
-
16
- # Offense count: 5
9
+ # Offense count: 3
10
+ # Configuration parameters: AllowComments.
17
11
  Lint/HandleExceptions:
18
12
  Exclude:
19
- - 'lib/slack-ruby-client.rb'
20
13
  - 'lib/slack/real_time/concurrency/async.rb'
21
14
  - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
22
15
  - 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
23
16
 
24
- # Offense count: 4
25
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
26
- # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
27
- Naming/FileName:
28
- Exclude:
29
- - 'bin/commands/chat_scheduledMessages.rb'
30
- - 'lib/slack-ruby-client.rb'
31
- - 'lib/slack/web/api/endpoints/chat_scheduledMessages.rb'
32
- - 'spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb'
17
+ # Offense count: 10
18
+ Metrics/AbcSize:
19
+ Max: 39
33
20
 
34
21
  # Offense count: 1
35
- # Configuration parameters: EnforcedStyleForLeadingUnderscores.
36
- # SupportedStylesForLeadingUnderscores: disallowed, required, optional
37
- Naming/MemoizedInstanceVariableName:
38
- Exclude:
39
- - 'lib/slack/logger.rb'
22
+ Metrics/CyclomaticComplexity:
23
+ Max: 9
24
+
25
+ # Offense count: 14
26
+ # Configuration parameters: CountComments, ExcludedMethods.
27
+ Metrics/MethodLength:
28
+ Max: 32
40
29
 
41
30
  # Offense count: 1
42
- Security/Open:
43
- Exclude:
44
- - 'lib/slack/real_time/client.rb'
31
+ Metrics/PerceivedComplexity:
32
+ Max: 9
45
33
 
46
- # Offense count: 2
47
- # Configuration parameters: EnforcedStyle.
48
- # SupportedStyles: inline, group
49
- Style/AccessModifierDeclarations:
34
+ # Offense count: 1
35
+ RSpec/AnyInstance:
50
36
  Exclude:
51
- - 'lib/slack/real_time/concurrency/eventmachine.rb'
52
- - 'lib/slack/real_time/socket.rb'
37
+ - 'spec/slack/real_time/concurrency/celluloid_spec.rb'
53
38
 
54
- # Offense count: 155
55
- # Configuration parameters: AllowedVariables.
56
- Style/GlobalVars:
39
+ # Offense count: 70
40
+ # Configuration parameters: Prefixes.
41
+ # Prefixes: when, with, without
42
+ RSpec/ContextWording:
57
43
  Enabled: false
58
44
 
59
- # Offense count: 3
60
- # Configuration parameters: MinBodyLength.
61
- Style/GuardClause:
45
+ # Offense count: 64
46
+ # Configuration parameters: Max.
47
+ RSpec/ExampleLength:
48
+ Enabled: false
49
+
50
+ # Offense count: 17
51
+ # Configuration parameters: CustomTransform, IgnoreMethods.
52
+ RSpec/FilePath:
53
+ Enabled: false
54
+
55
+ # Offense count: 13
56
+ # Configuration parameters: AssignmentOnly.
57
+ RSpec/InstanceVariable:
62
58
  Exclude:
63
- - 'lib/slack/real_time/socket.rb'
64
- - 'lib/slack/real_time/stores/store.rb'
65
- - 'lib/slack/web/faraday/response/raise_error.rb'
59
+ - 'spec/integration/integration_spec.rb'
60
+ - 'spec/slack/real_time/client_spec.rb'
61
+ - 'spec/slack/slack_spec.rb'
66
62
 
67
- # Offense count: 1
68
- Style/MixinUsage:
63
+ # Offense count: 75
64
+ # Configuration parameters: .
65
+ # SupportedStyles: have_received, receive
66
+ RSpec/MessageSpies:
67
+ EnforcedStyle: receive
68
+
69
+ # Offense count: 93
70
+ # Configuration parameters: AggregateFailuresByDefault.
71
+ RSpec/MultipleExpectations:
72
+ Max: 5
73
+
74
+ # Offense count: 34
75
+ RSpec/NestedGroups:
76
+ Max: 6
77
+
78
+ # Offense count: 3
79
+ RSpec/SubjectStub:
69
80
  Exclude:
70
- - 'bin/slack'
81
+ - 'spec/slack/web/api/mixins/channels_spec.rb'
82
+ - 'spec/slack/web/api/mixins/groups_spec.rb'
83
+ - 'spec/slack/web/api/mixins/users_spec.rb'
71
84
 
72
- # Offense count: 1
73
- Style/MultilineTernaryOperator:
85
+ # Offense count: 16
86
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
87
+ RSpec/VerifiedDoubles:
74
88
  Exclude:
89
+ - 'spec/slack/events/request_spec.rb'
90
+ - '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
+ - 'spec/slack/web/faraday/response/raise_error_spec.rb'
75
94
  - 'spec/support/real_time/connected_client.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 0.14.5 (2019/12/23)
2
+
3
+ * [#293](https://github.com/slack-ruby/slack-ruby-client/pull/293): Rubocop auto-correct and comprehensive todo - [@jcraigk](https://github.com/jcraigk).
4
+ * [#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).
7
+ * [#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
+
1
9
  ### 0.14.4 (2019/7/28)
2
10
 
3
11
  * [#289](https://github.com/slack-ruby/slack-ruby-client/pull/289): Fix reconnects when ping timers under/overshoot - [@georgyangelov](https://github.com/georgyangelov).
data/Dangerfile CHANGED
@@ -1,2 +1,3 @@
1
+ # frozen_string_literal: true
1
2
  danger.import_dangerfile(gem: 'slack-ruby-danger')
2
3
  toc.check
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source 'http://rubygems.org'
2
3
 
3
4
  gemspec
data/README.md CHANGED
@@ -16,7 +16,8 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
16
16
  - [Installation](#installation)
17
17
  - [Usage](#usage)
18
18
  - [Create a New Bot Integration](#create-a-new-bot-integration)
19
- - [Use the API Token](#use-the-api-token)
19
+ - [OAuth Code Grant](#oauth-code-grant)
20
+ - [Using the Legacy API Token](#using-the-legacy-api-token)
20
21
  - [Global Settings](#global-settings)
21
22
  - [Web Client](#web-client)
22
23
  - [Test Auth](#test-auth)
@@ -61,12 +62,12 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
61
62
 
62
63
  * This library will let you send messages to Slack via the Web API, send and receive messages via the Real Time Messaging API and facilitate integration with the Events API.
63
64
  * To respond to slash commands, interactive components or events, implement a web application using your favorite web framework and use this library to call the Slack Web API and to verify that events are coming from Slack.
64
- * To build a bot using the Real Time Messaging API, use [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot), which uses this library.
65
- * To roll out a complete service using the Real Time Messaging API with Slack button integration to multiple teams, check out [slack-ruby-bot-server](https://github.com/dblock/slack-ruby-bot-server), which is built on top of slack-ruby-bot, which uses this library.
65
+ * To build a bot using the Real Time Messaging API, use [slack-ruby-bot](https://github.com/slack-ruby/slack-ruby-bot), which uses this library.
66
+ * To roll out a complete service using the Real Time Messaging API with Slack button integration to multiple teams, check out [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server), which is built on top of slack-ruby-bot, which uses this library.
66
67
 
67
68
  ## Stable Release
68
69
 
69
- You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.4. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
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.
70
71
 
71
72
  ## Installation
72
73
 
@@ -88,11 +89,17 @@ Run `bundle install`.
88
89
 
89
90
  ### Create a New Bot Integration
90
91
 
91
- This is something done in Slack, under [integrations](https://my.slack.com/services). Create a [new bot](https://my.slack.com/services/new/bot), and note its API token.
92
+ To integrate your bot with Slack, you must first create a new [Slack App](https://api.slack.com/apps).
92
93
 
93
- ![](screenshots/register-bot.png)
94
+ ![](screenshots/create-app.png)
94
95
 
95
- ### Use the API Token
96
+ ### OAuth Code Grant
97
+
98
+ Once created, go to the app's Basic Info tab and grab the Client ID and Client Secret. You'll need these in order complete an [OAuth code grant flow](https://api.slack.com/docs/oauth#flow) as described at [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
99
+
100
+ ### Using the Legacy API Token
101
+
102
+ Although OAuth is recommended, you can still [generate a legacy API token](https://api.slack.com/custom-integrations/legacy-tokens) for your app and use it for some interactions.
96
103
 
97
104
  ```ruby
98
105
  Slack.configure do |config|
@@ -440,7 +447,7 @@ Slack::RealTime.configure do |config|
440
447
  end
441
448
  ```
442
449
 
443
- Use `client.start_async` instead of `client.start!`. A good example of such application is [slack-bot-server](https://github.com/dblock/slack-bot-server).
450
+ Use `client.start_async` instead of `client.start!`. A good example of such application is [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server).
444
451
 
445
452
  ```ruby
446
453
  client = Slack::RealTime::Client.new
@@ -515,7 +522,7 @@ Slack::Events::Request.new(http_request,
515
522
  signature_expires_in: signature_expires_in)
516
523
  ```
517
524
 
518
- The `verify!` call may raise `Slack::Events::MissingSigningSecret`, `Slack::Events::InvalidSignature` or `Slack::Events::TimestampExpired` errors.
525
+ The `verify!` call may raise `Slack::Events::Request::MissingSigningSecret`, `Slack::Events::Request::InvalidSignature` or `Slack::Events::Request::TimestampExpired` errors.
519
526
 
520
527
  ### Message Parsing
521
528
 
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rubygems'
2
3
  require 'bundler'
3
4
  require 'bundler/gem_tasks'
data/bin/commands.rb CHANGED
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
4
+ require 'commands/admin_apps'
5
+ require 'commands/admin_apps_requests'
3
6
  require 'commands/admin_users_session'
4
7
  require 'commands/api'
5
8
  require 'commands/apps'
@@ -18,11 +21,13 @@ require 'commands/dnd'
18
21
  require 'commands/emoji'
19
22
  require 'commands/files'
20
23
  require 'commands/files_comments'
24
+ require 'commands/files_remote'
21
25
  require 'commands/groups'
22
26
  require 'commands/im'
23
27
  require 'commands/migration'
24
28
  require 'commands/mpim'
25
29
  require 'commands/oauth'
30
+ require 'commands/oauth_v2'
26
31
  require 'commands/pins'
27
32
  require 'commands/reactions'
28
33
  require 'commands/reminders'
@@ -37,3 +42,4 @@ require 'commands/users'
37
42
  require 'commands/users_admin'
38
43
  require 'commands/users_prefs'
39
44
  require 'commands/users_profile'
45
+ require 'commands/views'
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'AdminApps methods.'
5
+ command 'admin_apps' do |g|
6
+ g.desc 'Approve an app for installation on a workspace.'
7
+ g.long_desc %( Approve an app for installation on a workspace. )
8
+ g.command 'approve' do |c|
9
+ c.flag 'app_id', desc: 'The id of the app to approve.'
10
+ c.flag 'request_id', desc: 'The id of the request to approve.'
11
+ c.flag 'team_id', desc: '.'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.admin_apps_approve(options))
14
+ end
15
+ end
16
+
17
+ g.desc 'Restrict an app for installation on a workspace.'
18
+ g.long_desc %( Restrict an app for installation on a workspace. )
19
+ g.command 'restrict' do |c|
20
+ c.flag 'app_id', desc: 'The id of the app to restrict.'
21
+ c.flag 'request_id', desc: 'The id of the request to restrict.'
22
+ c.flag 'team_id', desc: '.'
23
+ c.action do |_global_options, options, _args|
24
+ puts JSON.dump($client.admin_apps_restrict(options))
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'AdminAppsRequests methods.'
5
+ command 'admin_apps_requests' do |g|
6
+ g.desc 'List app requests for a team/workspace.'
7
+ g.long_desc %( List app requests for a team/workspace. )
8
+ g.command 'list' do |c|
9
+ c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.'
10
+ c.flag 'limit', desc: 'The maximum number of items to return. Must be between 1 - 1000 both inclusive.'
11
+ c.flag 'team_id', desc: '.'
12
+ c.action do |_global_options, options, _args|
13
+ puts JSON.dump($client.admin_apps_requests_list(options))
14
+ end
15
+ end
16
+ end
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
3
4
  desc 'AdminUsersSession methods.'
4
5
  command 'admin_users_session' do |g|
5
- g.desc "This method wipes a user session, leaving the user unauthenticated. The user's Slack client will reset its local cache."
6
- g.long_desc %( This method wipes a user session, leaving the user unauthenticated. The user's Slack client will reset its local cache. )
6
+ g.desc 'Wipes all valid sessions on all devices for a given user'
7
+ g.long_desc %( Wipes all valid sessions on all devices for a given user )
7
8
  g.command 'reset' do |c|
8
9
  c.flag 'user_id', desc: 'The ID of the user to wipe sessions for.'
9
10
  c.flag 'mobile_only', desc: 'Only expire mobile sessions (default: false).'
data/bin/commands/api.rb CHANGED
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
3
4
  desc 'Api methods.'
4
5
  command 'api' do |g|
5
- g.desc 'This method helps you test your calling code.'
6
- g.long_desc %( This method helps you test your calling code. )
6
+ g.desc 'Checks API calling code.'
7
+ g.long_desc %( Checks API calling code. )
7
8
  g.command 'test' do |c|
8
9
  c.flag 'error', desc: 'Error response to return.'
9
10
  c.flag 'foo', desc: 'example property to return.'
data/bin/commands/apps.rb CHANGED
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
3
4
  desc 'Apps methods.'
4
5
  command 'apps' do |g|
5
- g.desc 'This method uninstalls an app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of an app.'
6
- g.long_desc %( This method uninstalls an app. Unlike auth.revoke, which revokes a single token, this method revokes all tokens associated with a single installation of an app. )
6
+ g.desc 'Uninstalls your app from a workspace.'
7
+ g.long_desc %( Uninstalls your app from a workspace. )
7
8
  g.command 'uninstall' do |c|
8
9
  c.flag 'client_id', desc: 'Issued when you created your application.'
9
10
  c.flag 'client_secret', desc: 'Issued when you created your application.'
@@ -1,17 +1,18 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
3
4
  desc 'AppsPermissions methods.'
4
5
  command 'apps_permissions' do |g|
5
- g.desc 'This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months.'
6
- g.long_desc %( This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months. )
6
+ g.desc 'Returns list of permissions this app has on a team.'
7
+ g.long_desc %( Returns list of permissions this app has on a team. )
7
8
  g.command 'info' do |c|
8
9
  c.action do |_global_options, options, _args|
9
10
  puts JSON.dump($client.apps_permissions_info(options))
10
11
  end
11
12
  end
12
13
 
13
- g.desc 'This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months.'
14
- g.long_desc %( This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months. )
14
+ g.desc 'Allows an app to request additional scopes'
15
+ g.long_desc %( Allows an app to request additional scopes )
15
16
  g.command 'request' do |c|
16
17
  c.flag 'scopes', desc: 'A comma separated list of scopes to request for.'
17
18
  c.flag 'trigger_id', desc: 'Token used to trigger the permissions API.'
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # This file was auto-generated by lib/tasks/web.rake
2
3
 
3
4
  desc 'AppsPermissionsResources methods.'
4
5
  command 'apps_permissions_resources' do |g|
5
- g.desc 'This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months.'
6
- g.long_desc %( This feature was exclusive to our workspace apps developer preview. The preview has now ended, but fan-favorite features such as token rotation and the Conversations API will become available to classic Slack apps over the coming months. )
6
+ g.desc 'Returns list of resource grants this app has on a team.'
7
+ g.long_desc %( Returns list of resource grants this app has on a team. )
7
8
  g.command 'list' do |c|
8
9
  c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first 'page' of the collection. See pagination for more detail."
9
10
  c.flag 'limit', desc: 'The maximum number of items to return.'