slack-ruby-client 0.15.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -1
  3. data/.rubocop_todo.yml +75 -43
  4. data/.travis.yml +2 -4
  5. data/CHANGELOG.md +32 -0
  6. data/CONTRIBUTING.md +6 -13
  7. data/LICENSE.md +1 -1
  8. data/README.md +19 -36
  9. data/RELEASING.md +1 -1
  10. data/UPGRADING.md +56 -2
  11. data/bin/commands/admin_analytics.rb +16 -0
  12. data/bin/commands/admin_apps.rb +26 -2
  13. data/bin/commands/admin_apps_requests.rb +1 -0
  14. data/bin/commands/admin_auth_policy.rb +39 -0
  15. data/bin/commands/admin_barriers.rb +47 -0
  16. data/bin/commands/admin_conversations.rb +154 -2
  17. data/bin/commands/admin_conversations_ekm.rb +17 -0
  18. data/bin/commands/admin_conversations_restrictAccess.rb +3 -3
  19. data/bin/commands/admin_conversations_whitelist.rb +1 -1
  20. data/bin/commands/admin_emoji.rb +1 -1
  21. data/bin/commands/admin_teams.rb +1 -1
  22. data/bin/commands/admin_usergroups.rb +2 -2
  23. data/bin/commands/admin_users.rb +3 -2
  24. data/bin/commands/admin_users_session.rb +62 -0
  25. data/bin/commands/api.rb +0 -1
  26. data/bin/commands/apps_connections.rb +13 -0
  27. data/bin/commands/apps_event_authorizations.rb +16 -0
  28. data/bin/commands/apps_manifest.rb +51 -0
  29. data/bin/commands/auth_teams.rb +16 -0
  30. data/bin/commands/bots.rb +1 -0
  31. data/bin/commands/channels.rb +1 -155
  32. data/bin/commands/chat.rb +12 -7
  33. data/bin/commands/chat_scheduledMessages.rb +1 -0
  34. data/bin/commands/conversations.rb +71 -2
  35. data/bin/commands/dnd.rb +2 -0
  36. data/bin/commands/files.rb +6 -4
  37. data/bin/commands/files_remote.rb +2 -2
  38. data/bin/commands/groups.rb +1 -162
  39. data/bin/commands/im.rb +1 -63
  40. data/bin/commands/migration.rb +1 -0
  41. data/bin/commands/mpim.rb +1 -61
  42. data/bin/commands/oauth.rb +0 -13
  43. data/bin/commands/oauth_v2.rb +13 -1
  44. data/bin/commands/openid_connect.rb +27 -0
  45. data/bin/commands/pins.rb +2 -4
  46. data/bin/commands/reactions.rb +1 -0
  47. data/bin/commands/reminders.rb +6 -0
  48. data/bin/commands/rtm.rb +2 -2
  49. data/bin/commands/search.rb +4 -0
  50. data/bin/commands/stars.rb +7 -6
  51. data/bin/commands/team.rb +3 -0
  52. data/bin/commands/team_billing.rb +13 -0
  53. data/bin/commands/team_preferences.rb +13 -0
  54. data/bin/commands/tooling_tokens.rb +14 -0
  55. data/bin/commands/usergroups.rb +5 -0
  56. data/bin/commands/usergroups_users.rb +2 -0
  57. data/bin/commands/users.rb +4 -2
  58. data/bin/commands/users_profile.rb +5 -5
  59. data/bin/commands/views.rb +2 -2
  60. data/bin/commands/workflows.rb +38 -0
  61. data/bin/commands.rb +13 -9
  62. data/lib/slack/config.rb +1 -2
  63. data/lib/slack/events/request.rb +10 -4
  64. data/lib/slack/real_time/client.rb +6 -6
  65. data/lib/slack/real_time/concurrency/async.rb +6 -8
  66. data/lib/slack/real_time/concurrency.rb +0 -2
  67. data/lib/slack/real_time/config.rb +5 -14
  68. data/lib/slack/real_time/socket.rb +1 -2
  69. data/lib/slack/real_time/stores/base.rb +1 -6
  70. data/lib/slack/real_time/stores/starter.rb +6 -3
  71. data/lib/slack/real_time/stores/store.rb +5 -0
  72. data/lib/slack/version.rb +1 -1
  73. data/lib/slack/web/api/endpoints/admin_analytics.rb +28 -0
  74. data/lib/slack/web/api/endpoints/admin_apps.rb +42 -6
  75. data/lib/slack/web/api/endpoints/admin_apps_approved.rb +2 -2
  76. data/lib/slack/web/api/endpoints/admin_apps_requests.rb +4 -2
  77. data/lib/slack/web/api/endpoints/admin_apps_restricted.rb +2 -2
  78. data/lib/slack/web/api/endpoints/admin_auth_policy.rb +72 -0
  79. data/lib/slack/web/api/endpoints/admin_barriers.rb +82 -0
  80. data/lib/slack/web/api/endpoints/admin_conversations.rb +233 -3
  81. data/lib/slack/web/api/endpoints/admin_conversations_ekm.rb +35 -0
  82. data/lib/slack/web/api/endpoints/admin_conversations_restrictAccess.rb +3 -3
  83. data/lib/slack/web/api/endpoints/admin_conversations_whitelist.rb +3 -3
  84. data/lib/slack/web/api/endpoints/admin_emoji.rb +10 -10
  85. data/lib/slack/web/api/endpoints/admin_inviteRequests.rb +7 -7
  86. data/lib/slack/web/api/endpoints/admin_inviteRequests_approved.rb +3 -3
  87. data/lib/slack/web/api/endpoints/admin_inviteRequests_denied.rb +2 -2
  88. data/lib/slack/web/api/endpoints/admin_teams.rb +7 -7
  89. data/lib/slack/web/api/endpoints/admin_teams_admins.rb +2 -2
  90. data/lib/slack/web/api/endpoints/admin_teams_owners.rb +2 -2
  91. data/lib/slack/web/api/endpoints/admin_teams_settings.rb +5 -5
  92. data/lib/slack/web/api/endpoints/admin_usergroups.rb +11 -11
  93. data/lib/slack/web/api/endpoints/admin_users.rb +23 -23
  94. data/lib/slack/web/api/endpoints/admin_users_session.rb +97 -3
  95. data/lib/slack/web/api/endpoints/api.rb +1 -3
  96. data/lib/slack/web/api/endpoints/apps.rb +2 -2
  97. data/lib/slack/web/api/endpoints/apps_connections.rb +21 -0
  98. data/lib/slack/web/api/endpoints/apps_event_authorizations.rb +34 -0
  99. data/lib/slack/web/api/endpoints/apps_manifest.rb +75 -0
  100. data/lib/slack/web/api/endpoints/auth.rb +1 -1
  101. data/lib/slack/web/api/endpoints/auth_teams.rb +33 -0
  102. data/lib/slack/web/api/endpoints/bots.rb +3 -1
  103. data/lib/slack/web/api/endpoints/calls.rb +15 -15
  104. data/lib/slack/web/api/endpoints/calls_participants.rb +4 -4
  105. data/lib/slack/web/api/endpoints/channels.rb +0 -259
  106. data/lib/slack/web/api/endpoints/chat.rb +65 -55
  107. data/lib/slack/web/api/endpoints/chat_scheduledMessages.rb +4 -2
  108. data/lib/slack/web/api/endpoints/conversations.rb +134 -24
  109. data/lib/slack/web/api/endpoints/dialog.rb +2 -2
  110. data/lib/slack/web/api/endpoints/dnd.rb +6 -3
  111. data/lib/slack/web/api/endpoints/files.rb +19 -15
  112. data/lib/slack/web/api/endpoints/files_comments.rb +1 -1
  113. data/lib/slack/web/api/endpoints/files_remote.rb +22 -22
  114. data/lib/slack/web/api/endpoints/groups.rb +0 -269
  115. data/lib/slack/web/api/endpoints/im.rb +0 -107
  116. data/lib/slack/web/api/endpoints/migration.rb +4 -2
  117. data/lib/slack/web/api/endpoints/mpim.rb +0 -102
  118. data/lib/slack/web/api/endpoints/oauth.rb +5 -27
  119. data/lib/slack/web/api/endpoints/oauth_v2.rb +24 -6
  120. data/lib/slack/web/api/endpoints/openid_connect.rb +42 -0
  121. data/lib/slack/web/api/endpoints/pins.rb +4 -9
  122. data/lib/slack/web/api/endpoints/reactions.rb +13 -11
  123. data/lib/slack/web/api/endpoints/reminders.rb +17 -5
  124. data/lib/slack/web/api/endpoints/rtm.rb +10 -10
  125. data/lib/slack/web/api/endpoints/search.rb +27 -13
  126. data/lib/slack/web/api/endpoints/stars.rb +11 -9
  127. data/lib/slack/web/api/endpoints/team.rb +11 -5
  128. data/lib/slack/web/api/endpoints/team_billing.rb +21 -0
  129. data/lib/slack/web/api/endpoints/team_preferences.rb +21 -0
  130. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  131. data/lib/slack/web/api/endpoints/tooling_tokens.rb +24 -0
  132. data/lib/slack/web/api/endpoints/usergroups.rb +26 -16
  133. data/lib/slack/web/api/endpoints/usergroups_users.rb +9 -5
  134. data/lib/slack/web/api/endpoints/users.rb +20 -18
  135. data/lib/slack/web/api/endpoints/users_profile.rb +7 -7
  136. data/lib/slack/web/api/endpoints/views.rb +13 -13
  137. data/lib/slack/web/api/endpoints/workflows.rb +61 -0
  138. data/lib/slack/web/api/endpoints.rb +26 -20
  139. data/lib/slack/web/api/errors/server_error.rb +37 -0
  140. data/lib/slack/web/api/errors/too_many_requests_error.rb +1 -4
  141. data/lib/slack/web/api/errors.rb +394 -10
  142. data/lib/slack/web/api/mixins/conversations.id.rb +1 -3
  143. data/lib/slack/web/api/mixins/ids.id.rb +2 -2
  144. data/lib/slack/web/api/mixins/users.id.rb +1 -3
  145. data/lib/slack/web/api/mixins.rb +0 -2
  146. data/lib/slack/web/api/patches/chat.1.patch +6 -8
  147. data/lib/slack/web/api/templates/endpoints.erb +1 -2
  148. data/lib/slack/web/api/templates/method_spec.erb +1 -1
  149. data/lib/slack/web/config.rb +2 -0
  150. data/lib/slack/web/faraday/connection.rb +2 -2
  151. data/lib/slack/web/faraday/request.rb +2 -1
  152. data/lib/slack/web/faraday/response/raise_error.rb +12 -1
  153. data/lib/slack/web/faraday/response/wrap_error.rb +24 -0
  154. data/lib/slack/web/pagination/cursor.rb +1 -5
  155. data/lib/slack-ruby-client.rb +2 -0
  156. data/lib/tasks/web.rake +11 -3
  157. data/slack-ruby-client.gemspec +2 -3
  158. data/spec/fixtures/slack/web/429_error.yml +50 -54
  159. data/spec/fixtures/slack/web/auth_test_error.yml +51 -18
  160. data/spec/fixtures/slack/web/auth_test_success.yml +50 -26
  161. data/spec/fixtures/slack/web/conversations_info.yml +167 -0
  162. data/spec/fixtures/slack/web/conversations_setTopic.yml +84 -0
  163. data/spec/fixtures/slack/web/conversations_setTopic_one_page.yml +172 -0
  164. data/spec/fixtures/slack/web/conversations_setTopic_paginated.yml +253 -0
  165. data/spec/fixtures/slack/web/paginated_users_list.yml +501 -69
  166. data/spec/fixtures/slack/web/rtm_connect.yml +267 -30
  167. data/spec/fixtures/slack/web/rtm_start.yml +771 -60
  168. data/spec/fixtures/slack/web/users_info.yml +153 -69
  169. data/spec/fixtures/slack/web/users_list.yml +102 -41
  170. data/spec/fixtures/slack/web/views_open_error.yml +49 -42
  171. data/spec/slack/events/request_spec.rb +13 -8
  172. data/spec/slack/real_time/client_spec.rb +35 -22
  173. data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
  174. data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
  175. data/spec/slack/real_time/event_handlers/bot_spec.rb +1 -1
  176. data/spec/slack/real_time/event_handlers/channel_spec.rb +1 -1
  177. data/spec/slack/real_time/event_handlers/im_spec.rb +5 -5
  178. data/spec/slack/real_time/event_handlers/user_spec.rb +2 -2
  179. data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
  180. data/spec/slack/real_time/rtm_start_spec.rb +1 -1
  181. data/spec/slack/slack_spec.rb +3 -1
  182. data/spec/slack/web/api/endpoints/admin_analytics_spec.rb +13 -0
  183. data/spec/slack/web/api/endpoints/admin_apps_spec.rb +10 -0
  184. data/spec/slack/web/api/endpoints/admin_auth_policy_spec.rb +35 -0
  185. data/spec/slack/web/api/endpoints/admin_barriers_spec.rb +38 -0
  186. data/spec/slack/web/api/endpoints/{apps_permissions_scopes_spec.rb → admin_conversations_ekm_spec.rb} +1 -1
  187. data/spec/slack/web/api/endpoints/admin_conversations_restrictAccess_spec.rb +5 -5
  188. data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +85 -0
  189. data/spec/slack/web/api/endpoints/admin_emoji_spec.rb +6 -6
  190. data/spec/slack/web/api/endpoints/admin_teams_settings_spec.rb +10 -10
  191. data/spec/slack/web/api/endpoints/admin_teams_spec.rb +2 -2
  192. data/spec/slack/web/api/endpoints/admin_usergroups_spec.rb +6 -6
  193. data/spec/slack/web/api/endpoints/admin_users_session_spec.rb +28 -0
  194. data/spec/slack/web/api/endpoints/admin_users_spec.rb +15 -23
  195. data/spec/slack/web/api/endpoints/{apps_permissions_resources_spec.rb → apps_connections_spec.rb} +1 -1
  196. data/spec/slack/web/api/endpoints/apps_event_authorizations_spec.rb +13 -0
  197. data/spec/slack/web/api/endpoints/apps_manifest_spec.rb +36 -0
  198. data/spec/slack/web/api/endpoints/apps_spec.rb +2 -2
  199. data/spec/slack/web/api/endpoints/auth_teams_spec.rb +8 -0
  200. data/spec/slack/web/api/endpoints/calls_participants_spec.rb +4 -4
  201. data/spec/slack/web/api/endpoints/calls_spec.rb +2 -2
  202. data/spec/slack/web/api/endpoints/custom_specs/auth_spec.rb +4 -6
  203. data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
  204. data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +2 -2
  205. data/spec/slack/web/api/endpoints/dnd_spec.rb +0 -5
  206. data/spec/slack/web/api/endpoints/files_comments_spec.rb +2 -2
  207. data/spec/slack/web/api/endpoints/files_remote_spec.rb +3 -3
  208. data/spec/slack/web/api/endpoints/files_spec.rb +4 -4
  209. data/spec/slack/web/api/endpoints/oauth_spec.rb +0 -11
  210. data/spec/slack/web/api/endpoints/oauth_v2_spec.rb +6 -3
  211. data/spec/slack/web/api/endpoints/openid_connect_spec.rb +8 -0
  212. data/spec/slack/web/api/endpoints/pins_spec.rb +1 -4
  213. data/spec/slack/web/api/endpoints/reactions_spec.rb +3 -3
  214. data/spec/slack/web/api/endpoints/reminders_spec.rb +2 -2
  215. data/spec/slack/web/api/endpoints/team_billing_spec.rb +8 -0
  216. data/spec/slack/web/api/endpoints/team_preferences_spec.rb +8 -0
  217. data/spec/slack/web/api/endpoints/tooling_tokens_spec.rb +13 -0
  218. data/spec/slack/web/api/endpoints/usergroups_users_spec.rb +2 -2
  219. data/spec/slack/web/api/endpoints/workflows_spec.rb +26 -0
  220. data/spec/slack/web/api/error_spec.rb +5 -7
  221. data/spec/slack/web/api/errors/slack_error_spec.rb +21 -26
  222. data/spec/slack/web/api/mixins/conversations_list_spec.rb +21 -0
  223. data/spec/slack/web/api/mixins/conversations_spec.rb +11 -9
  224. data/spec/slack/web/api/mixins/users_spec.rb +1 -1
  225. data/spec/slack/web/api/pagination/cursor_spec.rb +1 -3
  226. data/spec/slack/web/client_spec.rb +112 -16
  227. data/spec/slack/web/faraday/request_spec.rb +80 -0
  228. data/spec/slack/web/faraday/response/raise_error_spec.rb +8 -6
  229. data/spec/spec_helper.rb +1 -1
  230. data/spec/support/real_time/connected_client.rb +1 -7
  231. data/spec/support/vcr.rb +36 -1
  232. metadata +58 -155
  233. data/examples/hi_real_time/Gemfile +0 -6
  234. data/examples/hi_real_time/hi.gif +0 -0
  235. data/examples/hi_real_time/hi.rb +0 -41
  236. data/examples/hi_real_time_async_celluloid/Gemfile +0 -7
  237. data/examples/hi_real_time_async_celluloid/Procfile +0 -2
  238. data/examples/hi_real_time_async_celluloid/hi.rb +0 -39
  239. data/examples/hi_real_time_async_eventmachine/Gemfile +0 -7
  240. data/examples/hi_real_time_async_eventmachine/Procfile +0 -2
  241. data/examples/hi_real_time_async_eventmachine/hi.rb +0 -39
  242. data/lib/slack/real_time/concurrency/celluloid.rb +0 -142
  243. data/lib/slack/real_time/concurrency/eventmachine.rb +0 -85
  244. data/lib/slack/web/api/mixins/channels.id.json +0 -20
  245. data/lib/slack/web/api/mixins/channels.id.rb +0 -27
  246. data/lib/slack/web/api/mixins/groups.id.json +0 -20
  247. data/lib/slack/web/api/mixins/groups.id.rb +0 -27
  248. data/spec/fixtures/slack/web/503_error.yml +0 -14
  249. data/spec/fixtures/slack/web/channels_info.yml +0 -139
  250. data/spec/fixtures/slack/web/groups_info.yml +0 -43
  251. data/spec/slack/real_time/concurrency/celluloid_spec.rb +0 -116
  252. data/spec/slack/real_time/concurrency/eventmachine_spec.rb +0 -57
  253. data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +0 -32
  254. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +0 -16
  255. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +0 -19
  256. data/spec/slack/web/api/endpoints/conversations_spec.rb +0 -101
  257. data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
  258. data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
  259. data/spec/slack/web/api/endpoints/im_spec.rb +0 -39
  260. data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -39
  261. data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
  262. data/spec/slack/web/api/errors/service_unavailable_spec.rb +0 -17
  263. data/spec/slack/web/api/mixins/channels_spec.rb +0 -43
  264. data/spec/slack/web/api/mixins/groups_spec.rb +0 -43
@@ -9,13 +9,15 @@ module Slack
9
9
  #
10
10
  # List conversations the calling user may access.
11
11
  #
12
- # @option options [Object] :cursor
12
+ # @option options [string] :cursor
13
13
  # 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.
14
- # @option options [Object] :exclude_archived
14
+ # @option options [boolean] :exclude_archived
15
15
  # Set to true to exclude archived channels from the list.
16
- # @option options [Object] :limit
16
+ # @option options [number] :limit
17
17
  # 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.
18
- # @option options [Object] :types
18
+ # @option options [string] :team_id
19
+ # encoded team id to list conversations in, required if org token is used.
20
+ # @option options [string] :types
19
21
  # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
20
22
  # @option options [user] :user
21
23
  # Browse conversations by a specific user ID's membership. Non-public channels are restricted to those where the calling user shares membership.
@@ -49,7 +51,6 @@ module Slack
49
51
  # @see https://api.slack.com/methods/users.getPresence
50
52
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.getPresence.json
51
53
  def users_getPresence(options = {})
52
- throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
53
54
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
54
55
  post('users.getPresence', options)
55
56
  end
@@ -68,7 +69,7 @@ module Slack
68
69
  #
69
70
  # @option options [user] :user
70
71
  # User to get info on.
71
- # @option options [Object] :include_locale
72
+ # @option options [boolean] :include_locale
72
73
  # Set this to true to receive the locale for this user. Defaults to false.
73
74
  # @see https://api.slack.com/methods/users.info
74
75
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.info.json
@@ -81,12 +82,14 @@ module Slack
81
82
  #
82
83
  # Lists all users in a Slack team.
83
84
  #
84
- # @option options [Object] :cursor
85
+ # @option options [string] :cursor
85
86
  # 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.
86
- # @option options [Object] :include_locale
87
+ # @option options [boolean] :include_locale
87
88
  # Set this to true to receive the locale for users. Defaults to false.
88
- # @option options [Object] :limit
89
- # 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.
89
+ # @option options [number] :limit
90
+ # 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.
91
+ # @option options [string] :team_id
92
+ # encoded team id to list users in, required if org token is used.
90
93
  # @see https://api.slack.com/methods/users.list
91
94
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.list.json
92
95
  def users_list(options = {})
@@ -102,7 +105,7 @@ module Slack
102
105
  #
103
106
  # Find a user with an email address.
104
107
  #
105
- # @option options [Object] :email
108
+ # @option options [string] :email
106
109
  # An email address belonging to a user in the workspace.
107
110
  # @see https://api.slack.com/methods/users.lookupByEmail
108
111
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.lookupByEmail.json
@@ -123,25 +126,24 @@ module Slack
123
126
  #
124
127
  # Set the user profile photo
125
128
  #
126
- # @option options [Object] :image
127
- # File contents via multipart/form-data.
128
- # @option options [Object] :crop_w
129
+ # @option options [string] :crop_w
129
130
  # Width/height of crop box (always square).
130
- # @option options [Object] :crop_x
131
+ # @option options [string] :crop_x
131
132
  # X coordinate of top-left corner of crop box.
132
- # @option options [Object] :crop_y
133
+ # @option options [string] :crop_y
133
134
  # Y coordinate of top-left corner of crop box.
135
+ # @option options [string] :image
136
+ # File contents via multipart/form-data.
134
137
  # @see https://api.slack.com/methods/users.setPhoto
135
138
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.setPhoto.json
136
139
  def users_setPhoto(options = {})
137
- throw ArgumentError.new('Required arguments :image missing') if options[:image].nil?
138
140
  post('users.setPhoto', options)
139
141
  end
140
142
 
141
143
  #
142
144
  # Manually sets user presence.
143
145
  #
144
- # @option options [Object] :presence
146
+ # @option options [string] :presence
145
147
  # Either auto or away.
146
148
  # @see https://api.slack.com/methods/users.setPresence
147
149
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users/users.setPresence.json
@@ -7,10 +7,10 @@ module Slack
7
7
  module Endpoints
8
8
  module UsersProfile
9
9
  #
10
- # Retrieves a user's profile information.
10
+ # Retrieve a user's profile information, including their custom status.
11
11
  #
12
- # @option options [Object] :include_labels
13
- # Include labels for each ID in custom profile fields.
12
+ # @option options [boolean] :include_labels
13
+ # Include labels for each ID in custom profile fields. Using this parameter will heavily rate-limit your requests and is not recommended.
14
14
  # @option options [user] :user
15
15
  # User to retrieve profile info for.
16
16
  # @see https://api.slack.com/methods/users.profile.get
@@ -21,15 +21,15 @@ module Slack
21
21
  end
22
22
 
23
23
  #
24
- # Set the profile information for a user.
24
+ # Set a user's profile information, including custom status.
25
25
  #
26
- # @option options [Object] :name
26
+ # @option options [string] :name
27
27
  # Name of a single key to set. Usable only if profile is not passed.
28
- # @option options [Object] :profile
28
+ # @option options [string] :profile
29
29
  # 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.
30
30
  # @option options [user] :user
31
31
  # ID of user to change. This argument may only be specified by team admins on paid teams.
32
- # @option options [Object] :value
32
+ # @option options [string] :value
33
33
  # Value to set a single key to. Usable only if profile is not passed.
34
34
  # @see https://api.slack.com/methods/users.profile.set
35
35
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/users.profile/users.profile.set.json
@@ -9,9 +9,9 @@ module Slack
9
9
  #
10
10
  # Open a view for a user.
11
11
  #
12
- # @option options [Object] :trigger_id
12
+ # @option options [string] :trigger_id
13
13
  # Exchange a trigger to post to the user.
14
- # @option options [Object] :view
14
+ # @option options [view as string] :view
15
15
  # A view payload. This must be a JSON-encoded string.
16
16
  # @see https://api.slack.com/methods/views.open
17
17
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.open.json
@@ -29,11 +29,11 @@ module Slack
29
29
  #
30
30
  # Publish a static view for a User.
31
31
  #
32
- # @option options [Object] :user_id
32
+ # @option options [string] :user_id
33
33
  # id of the user you want publish a view to.
34
- # @option options [Object] :view
34
+ # @option options [view as string] :view
35
35
  # A view payload. This must be a JSON-encoded string.
36
- # @option options [Object] :hash
36
+ # @option options [string] :hash
37
37
  # A string that represents view state to protect against possible race conditions.
38
38
  # @see https://api.slack.com/methods/views.publish
39
39
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.publish.json
@@ -51,9 +51,9 @@ module Slack
51
51
  #
52
52
  # Push a view onto the stack of a root view.
53
53
  #
54
- # @option options [Object] :trigger_id
54
+ # @option options [string] :trigger_id
55
55
  # Exchange a trigger to post to the user.
56
- # @option options [Object] :view
56
+ # @option options [view as string] :view
57
57
  # A view payload. This must be a JSON-encoded string.
58
58
  # @see https://api.slack.com/methods/views.push
59
59
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.push.json
@@ -71,14 +71,14 @@ module Slack
71
71
  #
72
72
  # Update an existing view.
73
73
  #
74
- # @option options [Object] :view
75
- # A view payload This must be a JSON-encoded string.
76
- # @option options [Object] :external_id
74
+ # @option options [view as string] :view
75
+ # A view object. This must be a JSON-encoded string.
76
+ # @option options [string] :external_id
77
77
  # 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.
78
- # @option options [Object] :hash
79
- # A string that represents view state to protect against possible race conditions.
80
- # @option options [Object] :view_id
78
+ # @option options [string] :view_id
81
79
  # A unique identifier of the view to be updated. Either view_id or external_id is required.
80
+ # @option options [string] :hash
81
+ # A string that represents view state to protect against possible race conditions.
82
82
  # @see https://api.slack.com/methods/views.update
83
83
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/views/views.update.json
84
84
  def views_update(options = {})
@@ -0,0 +1,61 @@
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 Workflows
9
+ #
10
+ # Indicate that an app's step in a workflow completed execution.
11
+ #
12
+ # @option options [string] :workflow_step_execute_id
13
+ # Context identifier that maps to the correct workflow step execution.
14
+ # @option options [object] :outputs
15
+ # 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.
16
+ # @see https://api.slack.com/methods/workflows.stepCompleted
17
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.stepCompleted.json
18
+ def workflows_stepCompleted(options = {})
19
+ throw ArgumentError.new('Required arguments :workflow_step_execute_id missing') if options[:workflow_step_execute_id].nil?
20
+ post('workflows.stepCompleted', options)
21
+ end
22
+
23
+ #
24
+ # Indicate that an app's step in a workflow failed to execute.
25
+ #
26
+ # @option options [object] :error
27
+ # A JSON-based object with a message property that should contain a human readable error message.
28
+ # @option options [string] :workflow_step_execute_id
29
+ # Context identifier that maps to the correct workflow step execution.
30
+ # @see https://api.slack.com/methods/workflows.stepFailed
31
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.stepFailed.json
32
+ def workflows_stepFailed(options = {})
33
+ throw ArgumentError.new('Required arguments :error missing') if options[:error].nil?
34
+ throw ArgumentError.new('Required arguments :workflow_step_execute_id missing') if options[:workflow_step_execute_id].nil?
35
+ post('workflows.stepFailed', options)
36
+ end
37
+
38
+ #
39
+ # Update the configuration for a workflow step.
40
+ #
41
+ # @option options [string] :workflow_step_edit_id
42
+ # A context identifier provided with view_submission payloads used to call back to workflows.updateStep.
43
+ # @option options [object] :inputs
44
+ # 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.
45
+ # @option options [array] :outputs
46
+ # 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.
47
+ # @option options [string] :step_image_url
48
+ # An optional field that can be used to override app image that is shown in the Workflow Builder.
49
+ # @option options [string] :step_name
50
+ # An optional field that can be used to override the step name that is shown in the Workflow Builder.
51
+ # @see https://api.slack.com/methods/workflows.updateStep
52
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/workflows/workflows.updateStep.json
53
+ def workflows_updateStep(options = {})
54
+ throw ArgumentError.new('Required arguments :workflow_step_edit_id missing') if options[:workflow_step_edit_id].nil?
55
+ post('workflows.updateStep', options)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,13 +1,16 @@
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_auth_policy'
10
+ require_relative 'endpoints/admin_barriers'
8
11
  require_relative 'endpoints/admin_conversations'
12
+ require_relative 'endpoints/admin_conversations_ekm'
9
13
  require_relative 'endpoints/admin_conversations_restrictAccess'
10
- require_relative 'endpoints/admin_conversations_whitelist'
11
14
  require_relative 'endpoints/admin_emoji'
12
15
  require_relative 'endpoints/admin_inviteRequests'
13
16
  require_relative 'endpoints/admin_inviteRequests_approved'
@@ -21,15 +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'
24
- require_relative 'endpoints/apps_permissions'
25
- require_relative 'endpoints/apps_permissions_resources'
26
- require_relative 'endpoints/apps_permissions_scopes'
27
- require_relative 'endpoints/apps_permissions_users'
27
+ require_relative 'endpoints/apps_connections'
28
+ require_relative 'endpoints/apps_event_authorizations'
29
+ require_relative 'endpoints/apps_manifest'
28
30
  require_relative 'endpoints/auth'
31
+ require_relative 'endpoints/auth_teams'
29
32
  require_relative 'endpoints/bots'
30
33
  require_relative 'endpoints/calls'
31
34
  require_relative 'endpoints/calls_participants'
32
- require_relative 'endpoints/channels'
33
35
  require_relative 'endpoints/chat'
34
36
  require_relative 'endpoints/chat_scheduledMessages'
35
37
  require_relative 'endpoints/conversations'
@@ -39,12 +41,10 @@ require_relative 'endpoints/emoji'
39
41
  require_relative 'endpoints/files'
40
42
  require_relative 'endpoints/files_comments'
41
43
  require_relative 'endpoints/files_remote'
42
- require_relative 'endpoints/groups'
43
- require_relative 'endpoints/im'
44
44
  require_relative 'endpoints/migration'
45
- require_relative 'endpoints/mpim'
46
45
  require_relative 'endpoints/oauth'
47
46
  require_relative 'endpoints/oauth_v2'
47
+ require_relative 'endpoints/openid_connect'
48
48
  require_relative 'endpoints/pins'
49
49
  require_relative 'endpoints/reactions'
50
50
  require_relative 'endpoints/reminders'
@@ -52,7 +52,10 @@ require_relative 'endpoints/rtm'
52
52
  require_relative 'endpoints/search'
53
53
  require_relative 'endpoints/stars'
54
54
  require_relative 'endpoints/team'
55
+ require_relative 'endpoints/team_billing'
56
+ require_relative 'endpoints/team_preferences'
55
57
  require_relative 'endpoints/team_profile'
58
+ require_relative 'endpoints/tooling_tokens'
56
59
  require_relative 'endpoints/usergroups'
57
60
  require_relative 'endpoints/usergroups_users'
58
61
  require_relative 'endpoints/users'
@@ -60,23 +63,25 @@ require_relative 'endpoints/users_admin'
60
63
  require_relative 'endpoints/users_prefs'
61
64
  require_relative 'endpoints/users_profile'
62
65
  require_relative 'endpoints/views'
66
+ require_relative 'endpoints/workflows'
63
67
 
64
68
  module Slack
65
69
  module Web
66
70
  module Api
67
71
  module Endpoints
68
72
  include Slack::Web::Api::Mixins::Conversations
69
- include Slack::Web::Api::Mixins::Channels
70
73
  include Slack::Web::Api::Mixins::Users
71
- include Slack::Web::Api::Mixins::Groups
72
74
 
75
+ include AdminAnalytics
73
76
  include AdminApps
74
77
  include AdminAppsApproved
75
78
  include AdminAppsRequests
76
79
  include AdminAppsRestricted
80
+ include AdminAuthPolicy
81
+ include AdminBarriers
77
82
  include AdminConversations
83
+ include AdminConversationsEkm
78
84
  include AdminConversationsRestrictaccess
79
- include AdminConversationsWhitelist
80
85
  include AdminEmoji
81
86
  include AdminInviterequests
82
87
  include AdminInviterequestsApproved
@@ -90,15 +95,14 @@ module Slack
90
95
  include AdminUsersSession
91
96
  include Api
92
97
  include Apps
93
- include AppsPermissions
94
- include AppsPermissionsResources
95
- include AppsPermissionsScopes
96
- include AppsPermissionsUsers
98
+ include AppsConnections
99
+ include AppsEventAuthorizations
100
+ include AppsManifest
97
101
  include Auth
102
+ include AuthTeams
98
103
  include Bots
99
104
  include Calls
100
105
  include CallsParticipants
101
- include Channels
102
106
  include Chat
103
107
  include ChatScheduledmessages
104
108
  include Conversations
@@ -108,12 +112,10 @@ module Slack
108
112
  include Files
109
113
  include FilesComments
110
114
  include FilesRemote
111
- include Groups
112
- include Im
113
115
  include Migration
114
- include Mpim
115
116
  include Oauth
116
117
  include OauthV2
118
+ include OpenidConnect
117
119
  include Pins
118
120
  include Reactions
119
121
  include Reminders
@@ -121,7 +123,10 @@ module Slack
121
123
  include Search
122
124
  include Stars
123
125
  include Team
126
+ include TeamBilling
127
+ include TeamPreferences
124
128
  include TeamProfile
129
+ include ToolingTokens
125
130
  include Usergroups
126
131
  include UsergroupsUsers
127
132
  include Users
@@ -129,6 +134,7 @@ module Slack
129
134
  include UsersPrefs
130
135
  include UsersProfile
131
136
  include Views
137
+ include Workflows
132
138
  end
133
139
  end
134
140
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+ module Slack
3
+ module Web
4
+ module Api
5
+ module Errors
6
+ class ServerError < ::Faraday::Error
7
+ attr_reader :response
8
+
9
+ def initialize(message, response)
10
+ @response = response
11
+ super message
12
+ end
13
+ end
14
+
15
+ class ParsingError < ServerError
16
+ def initialize(response)
17
+ super('parsing_error', response)
18
+ end
19
+ end
20
+
21
+ class HttpRequestError < ServerError; end
22
+
23
+ class TimeoutError < HttpRequestError
24
+ def initialize(response)
25
+ super('timeout_error', response)
26
+ end
27
+ end
28
+
29
+ class UnavailableError < HttpRequestError
30
+ def initialize(response)
31
+ super('unavailable_error', response)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -8,10 +8,7 @@ module Slack
8
8
 
9
9
  def initialize(response)
10
10
  @response = response
11
- end
12
-
13
- def message
14
- "Retry after #{retry_after} seconds"
11
+ super "Retry after #{retry_after} seconds"
15
12
  end
16
13
 
17
14
  def retry_after