slack-ruby-client 0.15.1 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +0 -14
  4. data/.travis.yml +1 -4
  5. data/CHANGELOG.md +8 -0
  6. data/CONTRIBUTING.md +3 -10
  7. data/README.md +9 -27
  8. data/UPGRADING.md +14 -2
  9. data/bin/commands.rb +7 -0
  10. data/bin/commands/admin_analytics.rb +15 -0
  11. data/bin/commands/admin_apps.rb +15 -2
  12. data/bin/commands/admin_barriers.rb +47 -0
  13. data/bin/commands/admin_conversations.rb +154 -2
  14. data/bin/commands/admin_conversations_ekm.rb +17 -0
  15. data/bin/commands/admin_conversations_restrictAccess.rb +4 -4
  16. data/bin/commands/admin_conversations_whitelist.rb +1 -1
  17. data/bin/commands/admin_emoji.rb +1 -1
  18. data/bin/commands/admin_usergroups.rb +2 -2
  19. data/bin/commands/admin_users.rb +2 -2
  20. data/bin/commands/admin_users_session.rb +22 -0
  21. data/bin/commands/api.rb +0 -1
  22. data/bin/commands/apps_connections.rb +13 -0
  23. data/bin/commands/apps_event_authorizations.rb +16 -0
  24. data/bin/commands/auth_teams.rb +16 -0
  25. data/bin/commands/bots.rb +1 -0
  26. data/bin/commands/channels.rb +6 -3
  27. data/bin/commands/chat.rb +4 -4
  28. data/bin/commands/chat_scheduledMessages.rb +1 -0
  29. data/bin/commands/conversations.rb +14 -2
  30. data/bin/commands/dnd.rb +1 -1
  31. data/bin/commands/files.rb +6 -5
  32. data/bin/commands/files_remote.rb +2 -2
  33. data/bin/commands/groups.rb +5 -3
  34. data/bin/commands/im.rb +1 -1
  35. data/bin/commands/migration.rb +1 -0
  36. data/bin/commands/mpim.rb +3 -3
  37. data/bin/commands/pins.rb +0 -2
  38. data/bin/commands/reactions.rb +1 -0
  39. data/bin/commands/search.rb +4 -1
  40. data/bin/commands/team.rb +3 -0
  41. data/bin/commands/usergroups.rb +6 -1
  42. data/bin/commands/usergroups_users.rb +2 -0
  43. data/bin/commands/users.rb +5 -3
  44. data/bin/commands/users_profile.rb +5 -5
  45. data/bin/commands/views.rb +1 -1
  46. data/bin/commands/workflows.rb +38 -0
  47. data/lib/slack-ruby-client.rb +2 -0
  48. data/lib/slack/events/request.rb +5 -1
  49. data/lib/slack/real_time/client.rb +0 -1
  50. data/lib/slack/real_time/concurrency.rb +0 -2
  51. data/lib/slack/real_time/config.rb +5 -4
  52. data/lib/slack/version.rb +1 -1
  53. data/lib/slack/web/api/endpoints.rb +14 -0
  54. data/lib/slack/web/api/endpoints/admin_analytics.rb +26 -0
  55. data/lib/slack/web/api/endpoints/admin_apps.rb +22 -2
  56. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  57. data/lib/slack/web/api/endpoints/admin_conversations.rb +231 -1
  58. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  59. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +3 -3
  60. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +3 -3
  61. data/lib/slack/web/api/endpoints/admin_emoji.rb +1 -1
  62. data/lib/slack/web/api/endpoints/admin_usergroups.rb +1 -1
  63. data/lib/slack/web/api/endpoints/admin_users.rb +4 -6
  64. data/lib/slack/web/api/endpoints/admin_users_session.rb +38 -0
  65. data/lib/slack/web/api/endpoints/api.rb +0 -2
  66. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  67. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  68. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  69. data/lib/slack/web/api/endpoints/bots.rb +2 -0
  70. data/lib/slack/web/api/endpoints/channels.rb +9 -3
  71. data/lib/slack/web/api/endpoints/chat.rb +3 -3
  72. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +2 -0
  73. data/lib/slack/web/api/endpoints/conversations.rb +21 -1
  74. data/lib/slack/web/api/endpoints/files.rb +4 -2
  75. data/lib/slack/web/api/endpoints/files_remote.rb +2 -2
  76. data/lib/slack/web/api/endpoints/groups.rb +7 -3
  77. data/lib/slack/web/api/endpoints/im.rb +1 -1
  78. data/lib/slack/web/api/endpoints/migration.rb +2 -0
  79. data/lib/slack/web/api/endpoints/mpim.rb +3 -3
  80. data/lib/slack/web/api/endpoints/pins.rb +0 -5
  81. data/lib/slack/web/api/endpoints/reactions.rb +2 -0
  82. data/lib/slack/web/api/endpoints/search.rb +6 -0
  83. data/lib/slack/web/api/endpoints/team.rb +6 -0
  84. data/lib/slack/web/api/endpoints/usergroups.rb +10 -0
  85. data/lib/slack/web/api/endpoints/usergroups_users.rb +4 -0
  86. data/lib/slack/web/api/endpoints/users.rb +7 -5
  87. data/lib/slack/web/api/endpoints/users_profile.rb +3 -3
  88. data/lib/slack/web/api/endpoints/views.rb +1 -1
  89. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  90. data/lib/slack/web/api/errors.rb +194 -0
  91. data/lib/slack/web/api/errors/internal_error.rb +14 -0
  92. data/lib/slack/web/api/templates/endpoints.erb +1 -0
  93. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  94. data/lib/slack/web/faraday/connection.rb +1 -1
  95. data/lib/slack/web/faraday/response/raise_error.rb +16 -1
  96. data/lib/slack/web/faraday/response/wrap_error.rb +18 -0
  97. data/lib/tasks/web.rake +7 -3
  98. data/spec/slack/events/request_spec.rb +7 -3
  99. data/spec/slack/real_time/client_spec.rb +1 -1
  100. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  101. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +5 -0
  102. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  103. data/spec/slack/web/api/endpoints/admin_conversations_ekm_spec.rb +8 -0
  104. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +5 -5
  105. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +85 -0
  106. data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +5 -5
  107. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +6 -6
  108. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +10 -10
  109. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +2 -2
  110. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +6 -6
  111. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +8 -0
  112. data/spec/slack/web/api/endpoints/admin_users_spec.rb +15 -23
  113. data/spec/slack/web/api/endpoints/apps_connections_spec.rb +8 -0
  114. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  115. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +2 -2
  116. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +3 -3
  117. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  118. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  119. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +4 -4
  120. data/spec/slack/web/api/endpoints/calls_spec.rb +2 -2
  121. data/spec/slack/web/api/endpoints/conversations_spec.rb +20 -12
  122. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  123. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  124. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  125. data/spec/slack/web/api/endpoints/im_spec.rb +4 -4
  126. data/spec/slack/web/api/endpoints/mpim_spec.rb +4 -4
  127. data/spec/slack/web/api/endpoints/oauth_spec.rb +3 -3
  128. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  129. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  130. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  131. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  132. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  133. data/spec/slack/web/client_spec.rb +56 -0
  134. data/spec/slack/web/faraday/response/raise_error_spec.rb +7 -6
  135. metadata +32 -19
  136. data/examples/hi_real_time/Gemfile +0 -6
  137. data/examples/hi_real_time/hi.gif +0 -0
  138. data/examples/hi_real_time/hi.rb +0 -41
  139. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  140. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  141. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  142. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  143. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  144. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  145. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  146. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  147. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  148. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  149. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
@@ -26,8 +26,6 @@ command 'pins' do |g|
26
26
  g.long_desc %( Un-pins an item from a channel. )
27
27
  g.command 'remove' do |c|
28
28
  c.flag 'channel', desc: 'Channel where the item is pinned to.'
29
- c.flag 'file', desc: 'File to un-pin.'
30
- c.flag 'file_comment', desc: 'File comment to un-pin.'
31
29
  c.flag 'timestamp', desc: 'Timestamp of the message to un-pin.'
32
30
  c.action do |_global_options, options, _args|
33
31
  puts JSON.dump($client.pins_remove(options))
@@ -33,6 +33,7 @@ command 'reactions' do |g|
33
33
  c.flag 'cursor', desc: "Parameter for pagination. Set cursor equal to the next_cursor attribute returned by the previous request's response_metadata. This parameter is optional, but pagination is mandatory: the default value simply fetches the first 'page' of the collection. See pagination for more details."
34
34
  c.flag 'full', desc: 'If true always return the complete reaction list.'
35
35
  c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached."
36
+ c.flag 'team_id', desc: 'encoded team id to list reactions in, required if org token is used.'
36
37
  c.flag 'user', desc: 'Show reactions made by this user. Defaults to the authed user.'
37
38
  c.action do |_global_options, options, _args|
38
39
  puts JSON.dump($client.reactions_list(options))
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Search methods.'
4
+ desc "Search your team's files and messages."
5
5
  command 'search' do |g|
6
6
  g.desc 'Searches for messages and files matching a query.'
7
7
  g.long_desc %( Searches for messages and files matching a query. )
@@ -10,6 +10,7 @@ command 'search' do |g|
10
10
  c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
11
11
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
12
12
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
13
+ c.flag 'team_id', desc: 'encoded team id to search in, required if org token is used.'
13
14
  c.action do |_global_options, options, _args|
14
15
  puts JSON.dump($client.search_all(options))
15
16
  end
@@ -22,6 +23,7 @@ command 'search' do |g|
22
23
  c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
23
24
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
24
25
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
26
+ c.flag 'team_id', desc: 'encoded team id to search in, required if org token is used.'
25
27
  c.action do |_global_options, options, _args|
26
28
  puts JSON.dump($client.search_files(options))
27
29
  end
@@ -34,6 +36,7 @@ command 'search' do |g|
34
36
  c.flag 'highlight', desc: 'Pass a value of true to enable query highlight markers (see below).'
35
37
  c.flag 'sort', desc: 'Return matches sorted by either score or timestamp.'
36
38
  c.flag 'sort_dir', desc: 'Change sort direction to ascending (asc) or descending (desc).'
39
+ c.flag 'team_id', desc: 'encoded team id to search in, required if org token is used.'
37
40
  c.action do |_global_options, options, _args|
38
41
  puts JSON.dump($client.search_messages(options))
39
42
  end
@@ -7,6 +7,7 @@ command 'team' do |g|
7
7
  g.long_desc %( Gets the access logs for the current team. )
8
8
  g.command 'accessLogs' do |c|
9
9
  c.flag 'before', desc: 'End of time range of logs to include in results (inclusive).'
10
+ c.flag 'team_id', desc: 'encoded team id to get logs from, required if org token is used.'
10
11
  c.action do |_global_options, options, _args|
11
12
  puts JSON.dump($client.team_accessLogs(options))
12
13
  end
@@ -15,6 +16,7 @@ command 'team' do |g|
15
16
  g.desc 'Gets billable users information for the current team.'
16
17
  g.long_desc %( Gets billable users information for the current team. )
17
18
  g.command 'billableInfo' do |c|
19
+ c.flag 'team_id', desc: 'encoded team id to get the billable information from, required if org token is used.'
18
20
  c.flag 'user', desc: 'A user to retrieve the billable information for. Defaults to all users.'
19
21
  c.action do |_global_options, options, _args|
20
22
  puts JSON.dump($client.team_billableInfo(options))
@@ -36,6 +38,7 @@ command 'team' do |g|
36
38
  c.flag 'app_id', desc: 'Filter logs to this Slack app. Defaults to all logs.'
37
39
  c.flag 'change_type', desc: 'Filter logs with this change type. Defaults to all logs.'
38
40
  c.flag 'service_id', desc: 'Filter logs to this service. Defaults to all logs.'
41
+ c.flag 'team_id', desc: 'encoded team id to get logs from, required if org token is used.'
39
42
  c.flag 'user', desc: "Filter logs generated by this user's actions. Defaults to all logs."
40
43
  c.action do |_global_options, options, _args|
41
44
  puts JSON.dump($client.team_integrationLogs(options))
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Usergroups methods.'
4
+ desc "Get info on your team's User Groups."
5
5
  command 'usergroups' do |g|
6
6
  g.desc 'Create a User Group'
7
7
  g.long_desc %( Create a User Group )
@@ -11,6 +11,7 @@ command 'usergroups' do |g|
11
11
  c.flag 'description', desc: 'A short description of the User Group.'
12
12
  c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
13
13
  c.flag 'include_count', desc: 'Include the number of users in each User Group.'
14
+ c.flag 'team_id', desc: 'Encoded team id where the user group has to be created, required if org token is used.'
14
15
  c.action do |_global_options, options, _args|
15
16
  puts JSON.dump($client.usergroups_create(options))
16
17
  end
@@ -21,6 +22,7 @@ command 'usergroups' do |g|
21
22
  g.command 'disable' do |c|
22
23
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to disable.'
23
24
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
25
+ c.flag 'team_id', desc: 'Encoded team id where the user group is, required if org token is used.'
24
26
  c.action do |_global_options, options, _args|
25
27
  puts JSON.dump($client.usergroups_disable(options))
26
28
  end
@@ -31,6 +33,7 @@ command 'usergroups' do |g|
31
33
  g.command 'enable' do |c|
32
34
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to enable.'
33
35
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
36
+ c.flag 'team_id', desc: 'Encoded team id where the user group is, required if org token is used.'
34
37
  c.action do |_global_options, options, _args|
35
38
  puts JSON.dump($client.usergroups_enable(options))
36
39
  end
@@ -42,6 +45,7 @@ command 'usergroups' do |g|
42
45
  c.flag 'include_count', desc: 'Include the number of users in each User Group.'
43
46
  c.flag 'include_disabled', desc: 'Include disabled User Groups.'
44
47
  c.flag 'include_users', desc: 'Include the list of users for each User Group.'
48
+ c.flag 'team_id', desc: 'encoded team id to list user groups in, required if org token is used.'
45
49
  c.action do |_global_options, options, _args|
46
50
  puts JSON.dump($client.usergroups_list(options))
47
51
  end
@@ -56,6 +60,7 @@ command 'usergroups' do |g|
56
60
  c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
57
61
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
58
62
  c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
63
+ c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
59
64
  c.action do |_global_options, options, _args|
60
65
  puts JSON.dump($client.usergroups_update(options))
61
66
  end
@@ -8,6 +8,7 @@ command 'usergroups_users' do |g|
8
8
  g.command 'list' do |c|
9
9
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
10
10
  c.flag 'include_disabled', desc: 'Allow results that involve disabled User Groups.'
11
+ c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
11
12
  c.action do |_global_options, options, _args|
12
13
  puts JSON.dump($client.usergroups_users_list(options))
13
14
  end
@@ -19,6 +20,7 @@ command 'usergroups_users' do |g|
19
20
  c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
20
21
  c.flag 'users', desc: 'A comma separated string of encoded user IDs that represent the entire list of users for the User Group.'
21
22
  c.flag 'include_count', desc: 'Include the number of users in the User Group.'
23
+ c.flag 'team_id', desc: 'encoded team id where the user group exists, required if org token is used.'
22
24
  c.action do |_global_options, options, _args|
23
25
  puts JSON.dump($client.usergroups_users_update(options))
24
26
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
- desc 'Users methods.'
4
+ desc 'Get info on members of your Slack team.'
5
5
  command 'users' do |g|
6
6
  g.desc 'List conversations the calling user may access.'
7
7
  g.long_desc %( List conversations the calling user may access. )
@@ -9,6 +9,7 @@ command 'users' do |g|
9
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."
10
10
  c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
11
11
  c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the list hasn't been reached. Must be an integer no larger than 1000."
12
+ c.flag 'team_id', desc: 'encoded team id to list conversations in, required if org token is used.'
12
13
  c.flag 'types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.'
13
14
  c.flag 'user', desc: "Browse conversations by a specific user ID's membership. Non-public channels are restricted to those where the calling user shares membership."
14
15
  c.action do |_global_options, options, _args|
@@ -65,7 +66,8 @@ command 'users' do |g|
65
66
  g.command 'list' do |c|
66
67
  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."
67
68
  c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.'
68
- c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached."
69
+ c.flag 'limit', desc: "The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. Providing no limit value will result in Slack attempting to deliver you the entire result set. If the collection is too large you may experience limit_required or HTTP 500 errors."
70
+ c.flag 'team_id', desc: 'encoded team id to list users in, required if org token is used.'
69
71
  c.action do |_global_options, options, _args|
70
72
  puts JSON.dump($client.users_list(options))
71
73
  end
@@ -100,10 +102,10 @@ command 'users' do |g|
100
102
  g.desc 'Set the user profile photo'
101
103
  g.long_desc %( Set the user profile photo )
102
104
  g.command 'setPhoto' do |c|
103
- c.flag 'image', desc: 'File contents via multipart/form-data.'
104
105
  c.flag 'crop_w', desc: 'Width/height of crop box (always square).'
105
106
  c.flag 'crop_x', desc: 'X coordinate of top-left corner of crop box.'
106
107
  c.flag 'crop_y', desc: 'Y coordinate of top-left corner of crop box.'
108
+ c.flag 'image', desc: 'File contents via multipart/form-data.'
107
109
  c.action do |_global_options, options, _args|
108
110
  puts JSON.dump($client.users_setPhoto(options))
109
111
  end
@@ -3,18 +3,18 @@
3
3
 
4
4
  desc 'UsersProfile methods.'
5
5
  command 'users_profile' do |g|
6
- g.desc "Retrieves a user's profile information."
7
- g.long_desc %( Retrieves a user's profile information. )
6
+ g.desc "Retrieve a user's profile information, including their custom status."
7
+ g.long_desc %( Retrieve a user's profile information, including their custom status. )
8
8
  g.command 'get' do |c|
9
- c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields.'
9
+ c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields. Using this parameter will heavily rate-limit your requests and is not recommended.'
10
10
  c.flag 'user', desc: 'User to retrieve profile info for.'
11
11
  c.action do |_global_options, options, _args|
12
12
  puts JSON.dump($client.users_profile_get(options))
13
13
  end
14
14
  end
15
15
 
16
- g.desc 'Set the profile information for a user.'
17
- g.long_desc %( Set the profile information for a user. )
16
+ g.desc "Set a user's profile information, including custom status."
17
+ g.long_desc %( Set a user's profile information, including custom status. )
18
18
  g.command 'set' do |c|
19
19
  c.flag 'name', desc: 'Name of a single key to set. Usable only if profile is not passed.'
20
20
  c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash. At most 50 fields may be set. Each field name is limited to 255 characters.'
@@ -37,7 +37,7 @@ command 'views' do |g|
37
37
  g.desc 'Update an existing view.'
38
38
  g.long_desc %( Update an existing view. )
39
39
  g.command 'update' do |c|
40
- c.flag 'view', desc: 'A view payload This must be a JSON-encoded string.'
40
+ c.flag 'view', desc: 'A view object. This must be a JSON-encoded string.'
41
41
  c.flag 'external_id', desc: 'A unique identifier of the view set by the developer. Must be unique for all views on a team. Max length of 255 characters. Either view_id or external_id is required.'
42
42
  c.flag 'hash', desc: 'A string that represents view state to protect against possible race conditions.'
43
43
  c.flag 'view_id', desc: 'A unique identifier of the view to be updated. Either view_id or external_id is required.'
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ desc 'Workflows methods.'
5
+ command 'workflows' do |g|
6
+ g.desc "Indicate that an app's step in a workflow completed execution."
7
+ g.long_desc %( Indicate that an app's step in a workflow completed execution. )
8
+ g.command 'stepCompleted' do |c|
9
+ c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
10
+ c.flag 'outputs', desc: 'Key-value object of outputs from your step. Keys of this object reflect the configured key properties of your outputs array from your workflow_step object.'
11
+ c.action do |_global_options, options, _args|
12
+ puts JSON.dump($client.workflows_stepCompleted(options))
13
+ end
14
+ end
15
+
16
+ g.desc "Indicate that an app's step in a workflow failed to execute."
17
+ g.long_desc %( Indicate that an app's step in a workflow failed to execute. )
18
+ g.command 'stepFailed' do |c|
19
+ c.flag 'error', desc: 'A JSON-based object with a message property that should contain a human readable error message.'
20
+ c.flag 'workflow_step_execute_id', desc: 'Context identifier that maps to the correct workflow step execution.'
21
+ c.action do |_global_options, options, _args|
22
+ puts JSON.dump($client.workflows_stepFailed(options))
23
+ end
24
+ end
25
+
26
+ g.desc 'Update the configuration for a workflow step.'
27
+ g.long_desc %( Update the configuration for a workflow step. )
28
+ g.command 'updateStep' do |c|
29
+ c.flag 'workflow_step_edit_id', desc: 'A context identifier provided with view_submission payloads used to call back to workflows.updateStep.'
30
+ c.flag 'inputs', desc: 'A JSON key-value map of inputs required from a user during configuration. This is the data your app expects to receive when the workflow step starts. Please note: the embedded variable format is set and replaced by the workflow system. You cannot create custom variables that will be replaced at runtime. Read more about variables in workflow steps here.'
31
+ c.flag 'outputs', desc: 'An JSON array of output objects used during step execution. This is the data your app agrees to provide when your workflow step was executed.'
32
+ c.flag 'step_image_url', desc: 'An optional field that can be used to override app image that is shown in the Workflow Builder.'
33
+ c.flag 'step_name', desc: 'An optional field that can be used to override the step name that is shown in the Workflow Builder.'
34
+ c.action do |_global_options, options, _args|
35
+ puts JSON.dump($client.workflows_updateStep(options))
36
+ end
37
+ end
38
+ end
@@ -28,7 +28,9 @@ require_relative 'slack/web/api/errors/slack_error'
28
28
  require_relative 'slack/web/api/errors/too_many_requests_error'
29
29
  require_relative 'slack/web/api/error'
30
30
  require_relative 'slack/web/api/errors'
31
+ require_relative 'slack/web/api/errors/internal_error'
31
32
  require_relative 'slack/web/faraday/response/raise_error'
33
+ require_relative 'slack/web/faraday/response/wrap_error'
32
34
  require_relative 'slack/web/faraday/connection'
33
35
  require_relative 'slack/web/faraday/request'
34
36
  require_relative 'slack/web/api/mixins'
@@ -35,7 +35,11 @@ module Slack
35
35
 
36
36
  # Request body.
37
37
  def body
38
- @body ||= http_request.body.read
38
+ @body ||= begin
39
+ body = http_request.body.read
40
+ http_request.body.rewind
41
+ body
42
+ end
39
43
  end
40
44
 
41
45
  # Returns true if the signature coming from Slack has expired.
@@ -20,7 +20,6 @@ module Slack
20
20
  attr_accessor :store
21
21
  attr_accessor :url
22
22
  attr_accessor(*Config::ATTRIBUTES)
23
- attr_accessor :logger
24
23
 
25
24
  protected :store_class, :store_class=
26
25
 
@@ -3,8 +3,6 @@ module Slack
3
3
  module RealTime
4
4
  module Concurrency
5
5
  autoload :Async, 'slack/real_time/concurrency/async'
6
- autoload :Eventmachine, 'slack/real_time/concurrency/eventmachine'
7
- autoload :Celluloid, 'slack/real_time/concurrency/celluloid'
8
6
  end
9
7
  end
10
8
  end
@@ -17,7 +17,8 @@ module Slack
17
17
  logger
18
18
  ].freeze
19
19
 
20
- attr_accessor(*Config::ATTRIBUTES)
20
+ attr_accessor(*Config::ATTRIBUTES - [:concurrency])
21
+ attr_writer :concurrency
21
22
 
22
23
  def reset
23
24
  self.websocket_ping = 30
@@ -37,7 +38,7 @@ module Slack
37
38
  private
38
39
 
39
40
  def detect_concurrency
40
- %i[Async Eventmachine Celluloid].each do |concurrency|
41
+ %i[Async].each do |concurrency|
41
42
  begin
42
43
  return Slack::RealTime::Concurrency.const_get(concurrency)
43
44
  rescue LoadError, NameError
@@ -47,8 +48,8 @@ module Slack
47
48
 
48
49
  raise(
49
50
  NoConcurrencyError,
50
- 'Missing concurrency. Add async-websocket, faye-websocket ' \
51
- 'or celluloid-io to your Gemfile.'
51
+ 'Missing concurrency. Add async-websocket or faye-websocket ' \
52
+ 'to your Gemfile.'
52
53
  )
53
54
  end
54
55
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Slack
3
- VERSION = '0.15.1'
3
+ VERSION = '0.16.0'
4
4
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
  # This file was auto-generated by lib/tasks/web.rake
3
3
 
4
+ require_relative 'endpoints/admin_analytics'
4
5
  require_relative 'endpoints/admin_apps'
5
6
  require_relative 'endpoints/admin_apps_approved'
6
7
  require_relative 'endpoints/admin_apps_requests'
7
8
  require_relative 'endpoints/admin_apps_restricted'
9
+ require_relative 'endpoints/admin_barriers'
8
10
  require_relative 'endpoints/admin_conversations'
11
+ require_relative 'endpoints/admin_conversations_ekm'
9
12
  require_relative 'endpoints/admin_conversations_restrictAccess'
10
13
  require_relative 'endpoints/admin_conversations_whitelist'
11
14
  require_relative 'endpoints/admin_emoji'
@@ -21,11 +24,14 @@ require_relative 'endpoints/admin_users'
21
24
  require_relative 'endpoints/admin_users_session'
22
25
  require_relative 'endpoints/api'
23
26
  require_relative 'endpoints/apps'
27
+ require_relative 'endpoints/apps_connections'
28
+ require_relative 'endpoints/apps_event_authorizations'
24
29
  require_relative 'endpoints/apps_permissions'
25
30
  require_relative 'endpoints/apps_permissions_resources'
26
31
  require_relative 'endpoints/apps_permissions_scopes'
27
32
  require_relative 'endpoints/apps_permissions_users'
28
33
  require_relative 'endpoints/auth'
34
+ require_relative 'endpoints/auth_teams'
29
35
  require_relative 'endpoints/bots'
30
36
  require_relative 'endpoints/calls'
31
37
  require_relative 'endpoints/calls_participants'
@@ -60,6 +66,7 @@ require_relative 'endpoints/users_admin'
60
66
  require_relative 'endpoints/users_prefs'
61
67
  require_relative 'endpoints/users_profile'
62
68
  require_relative 'endpoints/views'
69
+ require_relative 'endpoints/workflows'
63
70
 
64
71
  module Slack
65
72
  module Web
@@ -70,11 +77,14 @@ module Slack
70
77
  include Slack::Web::Api::Mixins::Users
71
78
  include Slack::Web::Api::Mixins::Groups
72
79
 
80
+ include AdminAnalytics
73
81
  include AdminApps
74
82
  include AdminAppsApproved
75
83
  include AdminAppsRequests
76
84
  include AdminAppsRestricted
85
+ include AdminBarriers
77
86
  include AdminConversations
87
+ include AdminConversationsEkm
78
88
  include AdminConversationsRestrictaccess
79
89
  include AdminConversationsWhitelist
80
90
  include AdminEmoji
@@ -90,11 +100,14 @@ module Slack
90
100
  include AdminUsersSession
91
101
  include Api
92
102
  include Apps
103
+ include AppsConnections
104
+ include AppsEventAuthorizations
93
105
  include AppsPermissions
94
106
  include AppsPermissionsResources
95
107
  include AppsPermissionsScopes
96
108
  include AppsPermissionsUsers
97
109
  include Auth
110
+ include AuthTeams
98
111
  include Bots
99
112
  include Calls
100
113
  include CallsParticipants
@@ -129,6 +142,7 @@ module Slack
129
142
  include UsersPrefs
130
143
  include UsersProfile
131
144
  include Views
145
+ include Workflows
132
146
  end
133
147
  end
134
148
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module AdminAnalytics
9
+ #
10
+ # Retrieve analytics data for a given date, presented as a compressed JSON file
11
+ #
12
+ # @option options [Object] :type
13
+ # The type of analytics to retrieve. The options are currently limited to member.
14
+ # @option options [Object] :date
15
+ # Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC.
16
+ # @see https://api.slack.com/methods/admin.analytics.getFile
17
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics/admin.analytics.getFile.json
18
+ def admin_analytics_getFile(options = {})
19
+ throw ArgumentError.new('Required arguments :type missing') if options[:type].nil?
20
+ post('admin.analytics.getFile', options)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -11,25 +11,45 @@ module Slack
11
11
  #
12
12
  # @option options [Object] :app_id
13
13
  # The id of the app to approve.
14
+ # @option options [Object] :enterprise_id
15
+ # The ID of the enterprise to approve the app on.
14
16
  # @option options [Object] :request_id
15
17
  # The id of the request to approve.
16
18
  # @option options [Object] :team_id
17
- # .
19
+ # The ID of the workspace to approve the app on.
18
20
  # @see https://api.slack.com/methods/admin.apps.approve
19
21
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps/admin.apps.approve.json
20
22
  def admin_apps_approve(options = {})
21
23
  post('admin.apps.approve', options)
22
24
  end
23
25
 
26
+ #
27
+ # Clear an app resolution
28
+ #
29
+ # @option options [Object] :app_id
30
+ # The id of the app whose resolution you want to clear/undo.
31
+ # @option options [Object] :enterprise_id
32
+ # The enterprise to clear the app resolution from.
33
+ # @option options [Object] :team_id
34
+ # The workspace to clear the app resolution from.
35
+ # @see https://api.slack.com/methods/admin.apps.clearResolution
36
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps/admin.apps.clearResolution.json
37
+ def admin_apps_clearResolution(options = {})
38
+ throw ArgumentError.new('Required arguments :app_id missing') if options[:app_id].nil?
39
+ post('admin.apps.clearResolution', options)
40
+ end
41
+
24
42
  #
25
43
  # Restrict an app for installation on a workspace.
26
44
  #
27
45
  # @option options [Object] :app_id
28
46
  # The id of the app to restrict.
47
+ # @option options [Object] :enterprise_id
48
+ # The ID of the enterprise to approve the app on.
29
49
  # @option options [Object] :request_id
30
50
  # The id of the request to restrict.
31
51
  # @option options [Object] :team_id
32
- # .
52
+ # The ID of the workspace to approve the app on.
33
53
  # @see https://api.slack.com/methods/admin.apps.restrict
34
54
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.apps/admin.apps.restrict.json
35
55
  def admin_apps_restrict(options = {})