slack-ruby-client 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/.rubocop_todo.yml +39 -47
  4. data/.travis.yml +2 -2
  5. data/CHANGELOG.md +13 -1
  6. data/Gemfile +0 -1
  7. data/README.md +5 -5
  8. data/RELEASING.md +1 -1
  9. data/bin/commands.rb +3 -0
  10. data/bin/commands/apps_permissions_resources.rb +14 -0
  11. data/bin/commands/apps_permissions_scopes.rb +12 -0
  12. data/bin/commands/apps_permissions_users.rb +25 -0
  13. data/bin/commands/chat.rb +3 -2
  14. data/bin/commands/conversations.rb +1 -0
  15. data/bin/commands/files.rb +4 -1
  16. data/bin/commands/groups.rb +2 -0
  17. data/bin/commands/mpim.rb +2 -0
  18. data/bin/commands/oauth.rb +3 -2
  19. data/bin/commands/reactions.rb +2 -0
  20. data/bin/commands/rtm.rb +4 -2
  21. data/bin/commands/search.rb +2 -2
  22. data/bin/commands/stars.rb +2 -0
  23. data/bin/commands/users.rb +16 -3
  24. data/bin/commands/users_profile.rb +1 -1
  25. data/examples/hi_real_time_async_celluloid/hi.rb +3 -4
  26. data/examples/hi_real_time_async_eventmachine/hi.rb +3 -4
  27. data/lib/slack/messages/formatting.rb +0 -1
  28. data/lib/slack/real_time/concurrency/celluloid.rb +3 -2
  29. data/lib/slack/real_time/stores/starter.rb +10 -0
  30. data/lib/slack/real_time/stores/store.rb +10 -0
  31. data/lib/slack/version.rb +1 -1
  32. data/lib/slack/web/api/endpoints.rb +6 -0
  33. data/lib/slack/web/api/endpoints/apps_permissions_resources.rb +30 -0
  34. data/lib/slack/web/api/endpoints/apps_permissions_scopes.rb +20 -0
  35. data/lib/slack/web/api/endpoints/apps_permissions_users.rb +49 -0
  36. data/lib/slack/web/api/endpoints/chat.rb +5 -3
  37. data/lib/slack/web/api/endpoints/conversations.rb +2 -0
  38. data/lib/slack/web/api/endpoints/files.rb +14 -2
  39. data/lib/slack/web/api/endpoints/groups.rb +11 -1
  40. data/lib/slack/web/api/endpoints/mpim.rb +11 -1
  41. data/lib/slack/web/api/endpoints/oauth.rb +3 -1
  42. data/lib/slack/web/api/endpoints/reactions.rb +11 -1
  43. data/lib/slack/web/api/endpoints/rtm.rb +5 -1
  44. data/lib/slack/web/api/endpoints/search.rb +2 -2
  45. data/lib/slack/web/api/endpoints/stars.rb +11 -1
  46. data/lib/slack/web/api/endpoints/users.rb +28 -2
  47. data/lib/slack/web/api/endpoints/users_profile.rb +1 -1
  48. data/lib/slack/web/api/patches/chat.5.postEphemeral-text-or-attachments.patch +13 -0
  49. data/slack-ruby-client.gemspec +1 -1
  50. data/spec/slack/messages/formatting_spec.rb +0 -1
  51. data/spec/slack/real_time/concurrency/celluloid_spec.rb +79 -35
  52. data/spec/slack/slack_spec.rb +2 -2
  53. data/spec/slack/web/api/endpoints/apps_permissions_resources_spec.rb +7 -0
  54. data/spec/slack/web/api/endpoints/apps_permissions_scopes_spec.rb +7 -0
  55. data/spec/slack/web/api/endpoints/apps_permissions_users_spec.rb +18 -0
  56. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +6 -2
  57. data/spec/slack/web/api/mixins/channels_spec.rb +8 -6
  58. data/spec/slack/web/api/mixins/groups_spec.rb +8 -6
  59. data/spec/slack/web/api/mixins/users_spec.rb +9 -7
  60. metadata +18 -5
@@ -17,6 +17,8 @@ command 'stars' do |g|
17
17
  g.desc 'Lists stars for a user.'
18
18
  g.long_desc %( Lists stars for a user. )
19
19
  g.command 'list' do |c|
20
+ 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."
21
+ 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."
20
22
  c.action do |_global_options, options, _args|
21
23
  puts JSON.dump($client.stars_list(options))
22
24
  end
@@ -2,6 +2,19 @@
2
2
 
3
3
  desc 'Get info on members of your Slack team.'
4
4
  command 'users' do |g|
5
+ g.desc 'List conversations the calling user may access.'
6
+ g.long_desc %( List conversations the calling user may access. )
7
+ g.command 'conversations' do |c|
8
+ 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
+ c.flag 'exclude_archived', desc: 'Set to true to exclude archived channels from the list.'
10
+ 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."
11
+ 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.'
12
+ 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."
13
+ c.action do |_global_options, options, _args|
14
+ puts JSON.dump($client.users_conversations(options))
15
+ end
16
+ end
17
+
5
18
  g.desc 'Delete the user profile photo'
6
19
  g.long_desc %( Delete the user profile photo )
7
20
  g.command 'deletePhoto' do |c|
@@ -52,7 +65,7 @@ command 'users' do |g|
52
65
  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."
53
66
  c.flag 'include_locale', desc: 'Set this to true to receive the locale for users. Defaults to false.'
54
67
  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."
55
- c.flag 'presence', desc: 'Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams.'
68
+ c.flag 'presence', desc: 'Deprecated. Whether to include presence data in the output. Defaults to false. Setting this to true reduces performance, especially with large teams.'
56
69
  c.action do |_global_options, options, _args|
57
70
  puts JSON.dump($client.users_list(options))
58
71
  end
@@ -76,8 +89,8 @@ command 'users' do |g|
76
89
  end
77
90
  end
78
91
 
79
- g.desc 'Marks a user as active.'
80
- g.long_desc %( Marks a user as active. )
92
+ g.desc 'Marked a user as active. Deprecated and non-functional.'
93
+ g.long_desc %( Marked a user as active. Deprecated and non-functional. )
81
94
  g.command 'setActive' do |c|
82
95
  c.action do |_global_options, options, _args|
83
96
  puts JSON.dump($client.users_setActive(options))
@@ -16,7 +16,7 @@ command 'users_profile' do |g|
16
16
  g.long_desc %( Set the profile information for a user. )
17
17
  g.command 'set' do |c|
18
18
  c.flag 'name', desc: 'Name of a single key to set. Usable only if profile is not passed.'
19
- c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash.'
19
+ 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.'
20
20
  c.flag 'user', desc: 'ID of user to change. This argument may only be specified by team admins on paid teams.'
21
21
  c.flag 'value', desc: 'Value to set a single key to. Usable only if profile is not passed.'
22
22
  c.action do |_global_options, options, _args|
@@ -5,6 +5,7 @@ raise 'Missing ENV[SLACK_API_TOKENS]!' unless ENV.key?('SLACK_API_TOKENS')
5
5
  $stdout.sync = true
6
6
  logger = Logger.new($stdout)
7
7
  logger.level = Logger::DEBUG
8
+ threads = []
8
9
 
9
10
  ENV['SLACK_API_TOKENS'].split.each do |token|
10
11
  logger.info "Starting #{token[0..12]} ..."
@@ -28,9 +29,7 @@ ENV['SLACK_API_TOKENS'].split.each do |token|
28
29
  end
29
30
  end
30
31
 
31
- client.start_async
32
+ threads << client.start_async
32
33
  end
33
34
 
34
- loop do
35
- Thread.pass
36
- end
35
+ threads.each(&:join)
@@ -5,6 +5,7 @@ raise 'Missing ENV[SLACK_API_TOKENS]!' unless ENV.key?('SLACK_API_TOKENS')
5
5
  $stdout.sync = true
6
6
  logger = Logger.new($stdout)
7
7
  logger.level = Logger::DEBUG
8
+ threads = []
8
9
 
9
10
  ENV['SLACK_API_TOKENS'].split.each do |token|
10
11
  logger.info "Starting #{token[0..12]} ..."
@@ -28,9 +29,7 @@ ENV['SLACK_API_TOKENS'].split.each do |token|
28
29
  end
29
30
  end
30
31
 
31
- client.start_async
32
+ threads << client.start_async
32
33
  end
33
34
 
34
- loop do
35
- Thread.pass
36
- end
35
+ threads.each(&:join)
@@ -1,4 +1,3 @@
1
-
2
1
  module Slack
3
2
  module Messages
4
3
  module Formatting
@@ -34,13 +34,13 @@ module Slack
34
34
  @connected = @socket.connect
35
35
  driver.start
36
36
  loop { read } if socket
37
- rescue EOFError, Errno::EPIPE => e
37
+ rescue EOFError, Errno::ECONNRESET, Errno::EPIPE => e
38
38
  logger.debug("#{self.class}##{__method__}") { e }
39
39
  driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'server closed connection')) unless @closing
40
40
  ensure
41
41
  begin
42
42
  current_actor.terminate if current_actor.alive?
43
- rescue
43
+ rescue StandardError
44
44
  nil
45
45
  end
46
46
  end
@@ -53,6 +53,7 @@ module Slack
53
53
 
54
54
  def read
55
55
  buffer = socket.readpartial(BLOCK_SIZE)
56
+ raise EOFError unless buffer && !buffer.empty?
56
57
  async.handle_read(buffer)
57
58
  end
58
59
 
@@ -14,6 +14,16 @@ module Slack
14
14
 
15
15
  ### RealTime Events
16
16
 
17
+ # A private channel was deleted.
18
+ # @see https://api.slack.com/events/group_deleted
19
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_deleted.json
20
+ # on :group_deleted do |data|
21
+
22
+ # Determine the current presence status for a list of users.
23
+ # @see https://api.slack.com/events/presence_query
24
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_query.json
25
+ # on :presence_query do |data|
26
+
17
27
  # The membership of an existing User Group has changed.
18
28
  # @see https://api.slack.com/events/subteam_members_changed
19
29
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
@@ -64,6 +64,16 @@ module Slack
64
64
 
65
65
  ### RealTime Events
66
66
 
67
+ # A private channel was deleted.
68
+ # @see https://api.slack.com/events/group_deleted
69
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/group_deleted.json
70
+ # on :group_deleted do |data|
71
+
72
+ # Determine the current presence status for a list of users.
73
+ # @see https://api.slack.com/events/presence_query
74
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/presence_query.json
75
+ # on :presence_query do |data|
76
+
67
77
  # The membership of an existing User Group has changed.
68
78
  # @see https://api.slack.com/events/subteam_members_changed
69
79
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/events/subteam_members_changed.json
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '0.11.1'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -2,6 +2,9 @@
2
2
 
3
3
  require_relative 'endpoints/api'
4
4
  require_relative 'endpoints/apps_permissions'
5
+ require_relative 'endpoints/apps_permissions_resources'
6
+ require_relative 'endpoints/apps_permissions_scopes'
7
+ require_relative 'endpoints/apps_permissions_users'
5
8
  require_relative 'endpoints/auth'
6
9
  require_relative 'endpoints/bots'
7
10
  require_relative 'endpoints/channels'
@@ -42,6 +45,9 @@ module Slack
42
45
 
43
46
  include Api
44
47
  include AppsPermissions
48
+ include AppsPermissionsResources
49
+ include AppsPermissionsScopes
50
+ include AppsPermissionsUsers
45
51
  include Auth
46
52
  include Bots
47
53
  include Channels
@@ -0,0 +1,30 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module AppsPermissionsResources
8
+ #
9
+ # Returns list of resource grants this app has on a team.
10
+ #
11
+ # @option options [Object] :cursor
12
+ # 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.
13
+ # @option options [Object] :limit
14
+ # The maximum number of items to return.
15
+ # @see https://api.slack.com/methods/apps.permissions.resources.list
16
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.resources/apps.permissions.resources.list.json
17
+ def apps_permissions_resources_list(options = {})
18
+ if block_given?
19
+ Pagination::Cursor.new(self, :apps_permissions_resources_list, options).each do |page|
20
+ yield page
21
+ end
22
+ else
23
+ post('apps.permissions.resources.list', options)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module AppsPermissionsScopes
8
+ #
9
+ # Returns list of scopes this app has on a team.
10
+ #
11
+ # @see https://api.slack.com/methods/apps.permissions.scopes.list
12
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.scopes/apps.permissions.scopes.list.json
13
+ def apps_permissions_scopes_list(options = {})
14
+ post('apps.permissions.scopes.list', options)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,49 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module AppsPermissionsUsers
8
+ #
9
+ # Returns list of user grants and corresponding scopes this app has on a team.
10
+ #
11
+ # @option options [Object] :cursor
12
+ # 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.
13
+ # @option options [Object] :limit
14
+ # The maximum number of items to return.
15
+ # @see https://api.slack.com/methods/apps.permissions.users.list
16
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.list.json
17
+ def apps_permissions_users_list(options = {})
18
+ if block_given?
19
+ Pagination::Cursor.new(self, :apps_permissions_users_list, options).each do |page|
20
+ yield page
21
+ end
22
+ else
23
+ post('apps.permissions.users.list', options)
24
+ end
25
+ end
26
+
27
+ #
28
+ # Enables an app to trigger a permissions modal to grant an app access to a user access scope.
29
+ #
30
+ # @option options [Object] :scopes
31
+ # A comma separated list of user scopes to request for.
32
+ # @option options [Object] :trigger_id
33
+ # Token used to trigger the request.
34
+ # @option options [user] :user
35
+ # The user this scope is being requested for.
36
+ # @see https://api.slack.com/methods/apps.permissions.users.request
37
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/apps.permissions.users/apps.permissions.users.request.json
38
+ def apps_permissions_users_request(options = {})
39
+ throw ArgumentError.new('Required arguments :scopes missing') if options[:scopes].nil?
40
+ throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
41
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
42
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
43
+ post('apps.permissions.users.request', options)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -93,7 +93,7 @@ module Slack
93
93
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
94
94
  def chat_postEphemeral(options = {})
95
95
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
96
- throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
96
+ throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
97
97
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
98
98
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
99
99
  # attachments must be passed as an encoded JSON string
@@ -111,7 +111,7 @@ module Slack
111
111
  # @option options [channel] :channel
112
112
  # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
113
113
  # @option options [Object] :text
114
- # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
114
+ # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead. Provide no more than 40,000 characters or risk truncation.
115
115
  # @option options [Object] :as_user
116
116
  # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
117
117
  # @option options [Object] :attachments
@@ -122,6 +122,8 @@ module Slack
122
122
  # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
123
123
  # @option options [Object] :link_names
124
124
  # Find and link channel names and usernames.
125
+ # @option options [Object] :mrkdwn
126
+ # Disable Slack markup parsing by setting to false. Enabled by default.
125
127
  # @option options [Object] :parse
126
128
  # Change how messages are treated. Defaults to none. See below.
127
129
  # @option options [Object] :reply_broadcast
@@ -187,7 +189,7 @@ module Slack
187
189
  # @option options [Object] :attachments
188
190
  # A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting text.
189
191
  # @option options [Object] :link_names
190
- # Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.
192
+ # Find and link channel names and usernames. Defaults to none. See below.
191
193
  # @option options [Object] :parse
192
194
  # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
193
195
  # @see https://api.slack.com/methods/chat.update
@@ -38,6 +38,8 @@ module Slack
38
38
  # Name of the public or private channel to create.
39
39
  # @option options [Object] :is_private
40
40
  # Create a private channel instead of a public one.
41
+ # @option options [Object] :user_ids
42
+ # Required for workspace apps. A list of between 1 and 30 human users that will be added to the newly-created conversation. This argument has no effect when used by classic Slack apps.
41
43
  # @see https://api.slack.com/methods/conversations.create
42
44
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.create.json
43
45
  def conversations_create(options = {})
@@ -39,11 +39,21 @@ module Slack
39
39
  #
40
40
  # @option options [file] :file
41
41
  # Specify a file by providing its ID.
42
+ # @option options [Object] :cursor
43
+ # Parameter for pagination. File comments are paginated for a single file. 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 of comments. See pagination for more details.
44
+ # @option options [Object] :limit
45
+ # 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.
42
46
  # @see https://api.slack.com/methods/files.info
43
47
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.info.json
44
48
  def files_info(options = {})
45
49
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
46
- post('files.info', options)
50
+ if block_given?
51
+ Pagination::Cursor.new(self, :files_info, options).each do |page|
52
+ yield page
53
+ end
54
+ else
55
+ post('files.info', options)
56
+ end
47
57
  end
48
58
 
49
59
  #
@@ -133,7 +143,9 @@ module Slack
133
143
  # @option options [Object] :filetype
134
144
  # A file type identifier.
135
145
  # @option options [Object] :initial_comment
136
- # Initial comment to add to file.
146
+ # The message text introducing the file in specified channels.
147
+ # @option options [Object] :thread_ts
148
+ # Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
137
149
  # @option options [Object] :title
138
150
  # Title of file.
139
151
  # @see https://api.slack.com/methods/files.upload
@@ -131,14 +131,24 @@ module Slack
131
131
  #
132
132
  # Lists private channels that the calling user has access to.
133
133
  #
134
+ # @option options [Object] :cursor
135
+ # 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.
134
136
  # @option options [Object] :exclude_archived
135
137
  # Don't return archived private channels.
136
138
  # @option options [Object] :exclude_members
137
139
  # Exclude the members from each group.
140
+ # @option options [Object] :limit
141
+ # 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.
138
142
  # @see https://api.slack.com/methods/groups.list
139
143
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/groups/groups.list.json
140
144
  def groups_list(options = {})
141
- post('groups.list', options)
145
+ if block_given?
146
+ Pagination::Cursor.new(self, :groups_list, options).each do |page|
147
+ yield page
148
+ end
149
+ else
150
+ post('groups.list', options)
151
+ end
142
152
  end
143
153
 
144
154
  #
@@ -42,10 +42,20 @@ module Slack
42
42
  #
43
43
  # Lists multiparty direct message channels for the calling user.
44
44
  #
45
+ # @option options [Object] :cursor
46
+ # 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.
47
+ # @option options [Object] :limit
48
+ # 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.
45
49
  # @see https://api.slack.com/methods/mpim.list
46
50
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/mpim/mpim.list.json
47
51
  def mpim_list(options = {})
48
- post('mpim.list', options)
52
+ if block_given?
53
+ Pagination::Cursor.new(self, :mpim_list, options).each do |page|
54
+ yield page
55
+ end
56
+ else
57
+ post('mpim.list', options)
58
+ end
49
59
  end
50
60
 
51
61
  #
@@ -6,7 +6,7 @@ module Slack
6
6
  module Endpoints
7
7
  module Oauth
8
8
  #
9
- # Exchanges a temporary OAuth code for an API token.
9
+ # Exchanges a temporary OAuth verifier code for an access token.
10
10
  #
11
11
  # @option options [Object] :client_id
12
12
  # Issued when you created your application.
@@ -16,6 +16,8 @@ module Slack
16
16
  # The code param returned via the OAuth callback.
17
17
  # @option options [Object] :redirect_uri
18
18
  # This must match the originally submitted URI (if one was sent).
19
+ # @option options [Object] :single_channel
20
+ # Request the user to add your app only to a single channel.
19
21
  # @see https://api.slack.com/methods/oauth.access
20
22
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/oauth/oauth.access.json
21
23
  def oauth_access(options = {})
@@ -49,15 +49,25 @@ module Slack
49
49
  #
50
50
  # Lists reactions made by a user.
51
51
  #
52
+ # @option options [Object] :cursor
53
+ # 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.
52
54
  # @option options [Object] :full
53
55
  # If true always return the complete reaction list.
56
+ # @option options [Object] :limit
57
+ # 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.
54
58
  # @option options [user] :user
55
59
  # Show reactions made by this user. Defaults to the authed user.
56
60
  # @see https://api.slack.com/methods/reactions.list
57
61
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/reactions/reactions.list.json
58
62
  def reactions_list(options = {})
59
63
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
60
- post('reactions.list', options)
64
+ if block_given?
65
+ Pagination::Cursor.new(self, :reactions_list, options).each do |page|
66
+ yield page
67
+ end
68
+ else
69
+ post('reactions.list', options)
70
+ end
61
71
  end
62
72
 
63
73
  #