slack-ruby-client 0.9.1 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +16 -11
- data/CHANGELOG.md +11 -0
- data/README.md +40 -12
- data/UPGRADING.md +1 -1
- data/bin/commands.rb +1 -0
- data/bin/commands/channels.rb +3 -0
- data/bin/commands/conversations.rb +178 -0
- data/bin/commands/groups.rb +1 -9
- data/bin/commands/im.rb +3 -0
- data/bin/commands/rtm.rb +1 -0
- data/bin/commands/users.rb +3 -1
- data/lib/slack-ruby-client.rb +6 -0
- data/lib/slack/real_time/client.rb +1 -1
- data/lib/slack/real_time/concurrency/celluloid.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +2 -0
- data/lib/slack/web/api/endpoints/channels.rb +13 -1
- data/lib/slack/web/api/endpoints/conversations.rb +301 -0
- data/lib/slack/web/api/endpoints/groups.rb +2 -13
- data/lib/slack/web/api/endpoints/im.rb +13 -1
- data/lib/slack/web/api/endpoints/rtm.rb +2 -0
- data/lib/slack/web/api/endpoints/users.rb +11 -1
- data/lib/slack/web/api/templates/command.erb +2 -2
- data/lib/slack/web/api/templates/method.erb +10 -0
- data/lib/slack/web/config.rb +7 -3
- data/lib/slack/web/faraday/connection.rb +1 -1
- data/lib/slack/web/pagination/cursor.rb +48 -0
- data/spec/fixtures/slack/web/paginated_users_list.yml +181 -0
- data/spec/slack/real_time/client_spec.rb +60 -62
- data/spec/slack/real_time/concurrency/celluloid_spec.rb +41 -31
- data/spec/slack/web/api/endpoints/conversations_spec.rb +100 -0
- data/spec/slack/web/api/endpoints/custom_specs/users_spec.rb +8 -0
- data/spec/slack/web/api/pagination/cursor_spec.rb +70 -0
- metadata +12 -3
data/lib/slack-ruby-client.rb
CHANGED
@@ -17,6 +17,11 @@ begin
|
|
17
17
|
rescue LoadError
|
18
18
|
# ignore, only used in users_search
|
19
19
|
end
|
20
|
+
begin
|
21
|
+
require 'openssl'
|
22
|
+
rescue LoadError
|
23
|
+
# Used in slack/web/config
|
24
|
+
end
|
20
25
|
require_relative 'slack/web/config'
|
21
26
|
require_relative 'slack/web/api/errors/slack_error'
|
22
27
|
require_relative 'slack/web/api/errors/too_many_requests_error'
|
@@ -26,6 +31,7 @@ require_relative 'slack/web/faraday/connection'
|
|
26
31
|
require_relative 'slack/web/faraday/request'
|
27
32
|
require_relative 'slack/web/api/mixins'
|
28
33
|
require_relative 'slack/web/api/endpoints'
|
34
|
+
require_relative 'slack/web/pagination/cursor'
|
29
35
|
require_relative 'slack/web/client'
|
30
36
|
|
31
37
|
# RealTime API
|
@@ -34,7 +34,7 @@ module Slack
|
|
34
34
|
@connected = @socket.connect
|
35
35
|
driver.start
|
36
36
|
loop { read } if socket
|
37
|
-
rescue EOFError => e
|
37
|
+
rescue EOFError, 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
|
data/lib/slack/version.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'endpoints/auth'
|
|
6
6
|
require_relative 'endpoints/bots'
|
7
7
|
require_relative 'endpoints/channels'
|
8
8
|
require_relative 'endpoints/chat'
|
9
|
+
require_relative 'endpoints/conversations'
|
9
10
|
require_relative 'endpoints/dnd'
|
10
11
|
require_relative 'endpoints/emoji'
|
11
12
|
require_relative 'endpoints/files_comments'
|
@@ -41,6 +42,7 @@ module Slack
|
|
41
42
|
include Bots
|
42
43
|
include Channels
|
43
44
|
include Chat
|
45
|
+
include Conversations
|
44
46
|
include Dnd
|
45
47
|
include Emoji
|
46
48
|
include FilesComments
|
@@ -58,6 +58,8 @@ module Slack
|
|
58
58
|
#
|
59
59
|
# @option options [channel] :channel
|
60
60
|
# Channel to get info on.
|
61
|
+
# @option options [Object] :include_locale
|
62
|
+
# Set this to true to receive the locale for this channel. Defaults to false.
|
61
63
|
# @see https://api.slack.com/methods/channels.info
|
62
64
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels/channels.info.json
|
63
65
|
def channels_info(options = {})
|
@@ -130,14 +132,24 @@ module Slack
|
|
130
132
|
#
|
131
133
|
# Lists all channels in a Slack team.
|
132
134
|
#
|
135
|
+
# @option options [Object] :cursor
|
136
|
+
# 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.
|
133
137
|
# @option options [Object] :exclude_archived
|
134
138
|
# Exclude archived channels from the list.
|
135
139
|
# @option options [Object] :exclude_members
|
136
140
|
# Exclude the members collection from each channel.
|
141
|
+
# @option options [Object] :limit
|
142
|
+
# 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.
|
137
143
|
# @see https://api.slack.com/methods/channels.list
|
138
144
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/channels/channels.list.json
|
139
145
|
def channels_list(options = {})
|
140
|
-
|
146
|
+
if block_given?
|
147
|
+
Pagination::Cursor.new(self, :channels_list, options).each do |page|
|
148
|
+
yield page
|
149
|
+
end
|
150
|
+
else
|
151
|
+
post('channels.list', options)
|
152
|
+
end
|
141
153
|
end
|
142
154
|
|
143
155
|
#
|
@@ -0,0 +1,301 @@
|
|
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 Conversations
|
8
|
+
#
|
9
|
+
# Archives a conversation.
|
10
|
+
#
|
11
|
+
# @option options [channel] :channel
|
12
|
+
# ID of conversation to archive.
|
13
|
+
# @see https://api.slack.com/methods/conversations.archive
|
14
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.archive.json
|
15
|
+
def conversations_archive(options = {})
|
16
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
17
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
18
|
+
post('conversations.archive', options)
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Closes a direct message or multi-person direct message.
|
23
|
+
#
|
24
|
+
# @option options [channel] :channel
|
25
|
+
# Conversation to close.
|
26
|
+
# @see https://api.slack.com/methods/conversations.close
|
27
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.close.json
|
28
|
+
def conversations_close(options = {})
|
29
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
30
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
31
|
+
post('conversations.close', options)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Initiates a public or private channel-based conversation
|
36
|
+
#
|
37
|
+
# @option options [Object] :name
|
38
|
+
# Name of the public or private channel to create.
|
39
|
+
# @option options [Object] :is_private
|
40
|
+
# Create a private channel instead of a public one.
|
41
|
+
# @see https://api.slack.com/methods/conversations.create
|
42
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.create.json
|
43
|
+
def conversations_create(options = {})
|
44
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
45
|
+
post('conversations.create', options)
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Fetches a conversation's history of messages and events.
|
50
|
+
#
|
51
|
+
# @option options [channel] :channel
|
52
|
+
# Conversation ID to fetch history for.
|
53
|
+
# @option options [Object] :cursor
|
54
|
+
# 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.
|
55
|
+
# @option options [timestamp] :latest
|
56
|
+
# End of time range of messages to include in results.
|
57
|
+
# @option options [Object] :limit
|
58
|
+
# 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.
|
59
|
+
# @option options [timestamp] :oldest
|
60
|
+
# Start of time range of messages to include in results.
|
61
|
+
# @see https://api.slack.com/methods/conversations.history
|
62
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.history.json
|
63
|
+
def conversations_history(options = {})
|
64
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
65
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
66
|
+
if block_given?
|
67
|
+
Pagination::Cursor.new(self, :conversations_history, options).each do |page|
|
68
|
+
yield page
|
69
|
+
end
|
70
|
+
else
|
71
|
+
post('conversations.history', options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# Retrieve information about a conversation.
|
77
|
+
#
|
78
|
+
# @option options [channel] :channel
|
79
|
+
# Conversation ID to learn more about.
|
80
|
+
# @option options [Object] :include_locale
|
81
|
+
# Set this to true to receive the locale for this conversation. Defaults to false.
|
82
|
+
# @see https://api.slack.com/methods/conversations.info
|
83
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.info.json
|
84
|
+
def conversations_info(options = {})
|
85
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
86
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
87
|
+
post('conversations.info', options)
|
88
|
+
end
|
89
|
+
|
90
|
+
#
|
91
|
+
# Invites users to a channel.
|
92
|
+
#
|
93
|
+
# @option options [channel] :channel
|
94
|
+
# The ID of the public or private channel to invite user(s) to.
|
95
|
+
# @option options [Object] :users
|
96
|
+
# A comma separated list of user IDs. Up to 30 users may be listed.
|
97
|
+
# @see https://api.slack.com/methods/conversations.invite
|
98
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.invite.json
|
99
|
+
def conversations_invite(options = {})
|
100
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
101
|
+
throw ArgumentError.new('Required arguments :users missing') if options[:users].nil?
|
102
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
103
|
+
post('conversations.invite', options)
|
104
|
+
end
|
105
|
+
|
106
|
+
#
|
107
|
+
# Joins an existing conversation.
|
108
|
+
#
|
109
|
+
# @option options [channel] :channel
|
110
|
+
# ID of conversation to join.
|
111
|
+
# @see https://api.slack.com/methods/conversations.join
|
112
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.join.json
|
113
|
+
def conversations_join(options = {})
|
114
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
115
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
116
|
+
post('conversations.join', options)
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Removes a user from a conversation.
|
121
|
+
#
|
122
|
+
# @option options [channel] :channel
|
123
|
+
# ID of conversation to remove user from.
|
124
|
+
# @option options [user] :user
|
125
|
+
# User ID to be removed.
|
126
|
+
# @see https://api.slack.com/methods/conversations.kick
|
127
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
|
128
|
+
def conversations_kick(options = {})
|
129
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
130
|
+
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
131
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
132
|
+
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
133
|
+
post('conversations.kick', options)
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# Leaves a conversation.
|
138
|
+
#
|
139
|
+
# @option options [channel] :channel
|
140
|
+
# Conversation to leave.
|
141
|
+
# @see https://api.slack.com/methods/conversations.leave
|
142
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.leave.json
|
143
|
+
def conversations_leave(options = {})
|
144
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
145
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
146
|
+
post('conversations.leave', options)
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
# Lists all channels in a Slack team.
|
151
|
+
#
|
152
|
+
# @option options [Object] :cursor
|
153
|
+
# 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.
|
154
|
+
# @option options [Object] :exclude_archived
|
155
|
+
# Set to true to exclude archived channels from the list.
|
156
|
+
# @option options [Object] :limit
|
157
|
+
# 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.
|
158
|
+
# @option options [Object] :types
|
159
|
+
# Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
|
160
|
+
# @see https://api.slack.com/methods/conversations.list
|
161
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.list.json
|
162
|
+
def conversations_list(options = {})
|
163
|
+
if block_given?
|
164
|
+
Pagination::Cursor.new(self, :conversations_list, options).each do |page|
|
165
|
+
yield page
|
166
|
+
end
|
167
|
+
else
|
168
|
+
post('conversations.list', options)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
#
|
173
|
+
# Retrieve members of a conversation.
|
174
|
+
#
|
175
|
+
# @option options [channel] :channel
|
176
|
+
# ID of the conversation to retrieve members for.
|
177
|
+
# @option options [Object] :cursor
|
178
|
+
# 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.
|
179
|
+
# @option options [Object] :limit
|
180
|
+
# 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.
|
181
|
+
# @see https://api.slack.com/methods/conversations.members
|
182
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.members.json
|
183
|
+
def conversations_members(options = {})
|
184
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
185
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
186
|
+
if block_given?
|
187
|
+
Pagination::Cursor.new(self, :conversations_members, options).each do |page|
|
188
|
+
yield page
|
189
|
+
end
|
190
|
+
else
|
191
|
+
post('conversations.members', options)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
#
|
196
|
+
# Opens or resumes a direct message or multi-person direct message.
|
197
|
+
#
|
198
|
+
# @option options [channel] :channel
|
199
|
+
# Resume a conversation by supplying an im or mpim's ID. Or provide the users field instead.
|
200
|
+
# @option options [Object] :return_im
|
201
|
+
# Boolean, indicates you want the full IM channel definition in the response.
|
202
|
+
# @option options [Object] :users
|
203
|
+
# Comma separated lists of users. If only one user is included, this creates a 1:1 DM. The ordering of the users is preserved whenever a multi-person direct message is returned. Supply a channel when not supplying users.
|
204
|
+
# @see https://api.slack.com/methods/conversations.open
|
205
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.open.json
|
206
|
+
def conversations_open(options = {})
|
207
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
208
|
+
post('conversations.open', options)
|
209
|
+
end
|
210
|
+
|
211
|
+
#
|
212
|
+
# Renames a conversation.
|
213
|
+
#
|
214
|
+
# @option options [channel] :channel
|
215
|
+
# ID of conversation to rename.
|
216
|
+
# @option options [Object] :name
|
217
|
+
# New name for conversation.
|
218
|
+
# @see https://api.slack.com/methods/conversations.rename
|
219
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.rename.json
|
220
|
+
def conversations_rename(options = {})
|
221
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
222
|
+
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
223
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
224
|
+
post('conversations.rename', options)
|
225
|
+
end
|
226
|
+
|
227
|
+
#
|
228
|
+
# Retrieve a thread of messages posted to a conversation
|
229
|
+
#
|
230
|
+
# @option options [channel] :channel
|
231
|
+
# Conversation ID to fetch thread from.
|
232
|
+
# @option options [timestamp] :ts
|
233
|
+
# Unique identifier of a thread's parent message.
|
234
|
+
# @option options [Object] :cursor
|
235
|
+
# 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.
|
236
|
+
# @option options [Object] :limit
|
237
|
+
# 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.
|
238
|
+
# @see https://api.slack.com/methods/conversations.replies
|
239
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.replies.json
|
240
|
+
def conversations_replies(options = {})
|
241
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
242
|
+
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
243
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
244
|
+
if block_given?
|
245
|
+
Pagination::Cursor.new(self, :conversations_replies, options).each do |page|
|
246
|
+
yield page
|
247
|
+
end
|
248
|
+
else
|
249
|
+
post('conversations.replies', options)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
#
|
254
|
+
# Sets the purpose for a conversation.
|
255
|
+
#
|
256
|
+
# @option options [channel] :channel
|
257
|
+
# Conversation to set the purpose of.
|
258
|
+
# @option options [Object] :purpose
|
259
|
+
# A new, specialer purpose.
|
260
|
+
# @see https://api.slack.com/methods/conversations.setPurpose
|
261
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.setPurpose.json
|
262
|
+
def conversations_setPurpose(options = {})
|
263
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
264
|
+
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
265
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
266
|
+
post('conversations.setPurpose', options)
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Sets the topic for a conversation.
|
271
|
+
#
|
272
|
+
# @option options [channel] :channel
|
273
|
+
# Conversation to set the topic of.
|
274
|
+
# @option options [Object] :topic
|
275
|
+
# The new topic string. Does not support formatting or linkification.
|
276
|
+
# @see https://api.slack.com/methods/conversations.setTopic
|
277
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.setTopic.json
|
278
|
+
def conversations_setTopic(options = {})
|
279
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
280
|
+
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
281
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
282
|
+
post('conversations.setTopic', options)
|
283
|
+
end
|
284
|
+
|
285
|
+
#
|
286
|
+
# Reverses conversation archival.
|
287
|
+
#
|
288
|
+
# @option options [channel] :channel
|
289
|
+
# ID of conversation to unarchive.
|
290
|
+
# @see https://api.slack.com/methods/conversations.unarchive
|
291
|
+
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/conversations/conversations.unarchive.json
|
292
|
+
def conversations_unarchive(options = {})
|
293
|
+
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
294
|
+
options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
|
295
|
+
post('conversations.unarchive', options)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
@@ -18,19 +18,6 @@ module Slack
|
|
18
18
|
post('groups.archive', options)
|
19
19
|
end
|
20
20
|
|
21
|
-
#
|
22
|
-
# Closes a private channel.
|
23
|
-
#
|
24
|
-
# @option options [group] :channel
|
25
|
-
# Private channel to close.
|
26
|
-
# @see https://api.slack.com/methods/groups.close
|
27
|
-
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups/groups.close.json
|
28
|
-
def groups_close(options = {})
|
29
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
30
|
-
options = options.merge(channel: groups_id(options)['group']['id']) if options[:channel]
|
31
|
-
post('groups.close', options)
|
32
|
-
end
|
33
|
-
|
34
21
|
#
|
35
22
|
# Creates a private channel.
|
36
23
|
#
|
@@ -84,6 +71,8 @@ module Slack
|
|
84
71
|
#
|
85
72
|
# @option options [group] :channel
|
86
73
|
# Private channel to get info on.
|
74
|
+
# @option options [Object] :include_locale
|
75
|
+
# Set this to true to receive the locale for this group. Defaults to false.
|
87
76
|
# @see https://api.slack.com/methods/groups.info
|
88
77
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/groups/groups.info.json
|
89
78
|
def groups_info(options = {})
|
@@ -42,10 +42,20 @@ module Slack
|
|
42
42
|
#
|
43
43
|
# Lists direct message channels for the calling user.
|
44
44
|
#
|
45
|
+
# @option options [Object] :cursor
|
46
|
+
# 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.
|
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 users list hasn't been reached.
|
45
49
|
# @see https://api.slack.com/methods/im.list
|
46
50
|
# @see https://github.com/dblock/slack-api-ref/blob/master/methods/im/im.list.json
|
47
51
|
def im_list(options = {})
|
48
|
-
|
52
|
+
if block_given?
|
53
|
+
Pagination::Cursor.new(self, :im_list, options).each do |page|
|
54
|
+
yield page
|
55
|
+
end
|
56
|
+
else
|
57
|
+
post('im.list', options)
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
#
|
@@ -69,6 +79,8 @@ module Slack
|
|
69
79
|
#
|
70
80
|
# @option options [user] :user
|
71
81
|
# User to open a direct message channel with.
|
82
|
+
# @option options [Object] :include_locale
|
83
|
+
# Set this to true to receive the locale for this im. Defaults to false.
|
72
84
|
# @option options [Object] :return_im
|
73
85
|
# Boolean, indicates you want the full IM channel definition in the response.
|
74
86
|
# @see https://api.slack.com/methods/im.open
|