slack-ruby-client 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -3
- data/LICENSE.md +1 -1
- data/README.md +8 -8
- data/bin/commands.rb +0 -1
- data/bin/commands/admin_analytics.rb +2 -1
- data/bin/commands/admin_conversations.rb +0 -10
- data/bin/commands/admin_teams.rb +1 -1
- data/bin/commands/channels.rb +0 -157
- data/bin/commands/chat.rb +8 -6
- data/bin/commands/conversations.rb +2 -2
- data/bin/commands/dnd.rb +2 -0
- data/bin/commands/groups.rb +0 -163
- data/bin/commands/im.rb +0 -62
- data/bin/commands/mpim.rb +0 -60
- data/lib/slack/events/request.rb +2 -2
- data/lib/slack/real_time/config.rb +3 -13
- data/lib/slack/version.rb +1 -1
- data/lib/slack/web/api/endpoints.rb +0 -2
- data/lib/slack/web/api/endpoints/admin_analytics.rb +3 -1
- data/lib/slack/web/api/endpoints/admin_conversations.rb +0 -14
- data/lib/slack/web/api/endpoints/admin_teams.rb +1 -1
- data/lib/slack/web/api/endpoints/channels.rb +0 -265
- data/lib/slack/web/api/endpoints/chat.rb +11 -7
- data/lib/slack/web/api/endpoints/conversations.rb +2 -2
- data/lib/slack/web/api/endpoints/dnd.rb +4 -0
- data/lib/slack/web/api/endpoints/groups.rb +0 -273
- data/lib/slack/web/api/endpoints/im.rb +0 -107
- data/lib/slack/web/api/endpoints/mpim.rb +0 -102
- data/lib/slack/web/api/errors.rb +14 -16
- data/lib/slack/web/api/patches/chat.1.patch +5 -6
- data/lib/slack/web/faraday/connection.rb +1 -1
- data/lib/slack/web/faraday/response/raise_error.rb +0 -4
- data/lib/slack/web/faraday/response/wrap_error.rb +11 -5
- data/lib/tasks/web.rake +4 -0
- data/spec/fixtures/slack/web/{groups_info.yml → conversations_info.yml} +4 -4
- data/spec/slack/events/request_spec.rb +6 -5
- data/spec/slack/real_time/concurrency/with_concurrency_spec.rb +10 -0
- data/spec/slack/real_time/concurrency/without_concurrency_spec.rb +10 -0
- data/spec/slack/real_time/rtm_connect_spec.rb +1 -1
- data/spec/slack/real_time/rtm_start_spec.rb +1 -1
- data/spec/slack/web/api/endpoints/admin_conversations_spec.rb +0 -5
- data/spec/slack/web/api/endpoints/custom_specs/conversations_spec.rb +13 -0
- data/spec/slack/web/api/endpoints/im_spec.rb +0 -31
- data/spec/slack/web/api/endpoints/mpim_spec.rb +0 -31
- data/spec/slack/web/client_spec.rb +15 -20
- metadata +10 -12
- data/spec/slack/web/api/endpoints/admin_conversations_whitelist_spec.rb +0 -32
- data/spec/slack/web/api/endpoints/custom_specs/channels_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/custom_specs/groups_spec.rb +0 -13
- data/spec/slack/web/api/endpoints/views_spec.rb +0 -29
data/bin/commands/im.rb
CHANGED
@@ -3,66 +3,4 @@
|
|
3
3
|
|
4
4
|
desc 'Get info on your direct messages.'
|
5
5
|
command 'im' do |g|
|
6
|
-
g.desc 'Close a direct message channel.'
|
7
|
-
g.long_desc %( Close a direct message channel. )
|
8
|
-
g.command 'close' do |c|
|
9
|
-
c.flag 'channel', desc: 'Direct message channel to close.'
|
10
|
-
c.action do |_global_options, options, _args|
|
11
|
-
puts JSON.dump($client.im_close(options))
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
g.desc 'Fetches history of messages and events from direct message channel.'
|
16
|
-
g.long_desc %( Fetches history of messages and events from direct message channel. )
|
17
|
-
g.command 'history' do |c|
|
18
|
-
c.flag 'channel', desc: 'Direct message channel to fetch history for.'
|
19
|
-
c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
|
20
|
-
c.flag 'latest', desc: 'End of time range of messages to include in results.'
|
21
|
-
c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
|
22
|
-
c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
|
23
|
-
c.action do |_global_options, options, _args|
|
24
|
-
puts JSON.dump($client.im_history(options))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
g.desc 'Lists direct message channels for the calling user.'
|
29
|
-
g.long_desc %( Lists direct message channels for the calling user. )
|
30
|
-
g.command 'list' do |c|
|
31
|
-
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."
|
32
|
-
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."
|
33
|
-
c.action do |_global_options, options, _args|
|
34
|
-
puts JSON.dump($client.im_list(options))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
g.desc 'Sets the read cursor in a direct message channel.'
|
39
|
-
g.long_desc %( Sets the read cursor in a direct message channel. )
|
40
|
-
g.command 'mark' do |c|
|
41
|
-
c.flag 'channel', desc: 'Direct message channel to set reading cursor in.'
|
42
|
-
c.flag 'ts', desc: 'Timestamp of the most recently seen message.'
|
43
|
-
c.action do |_global_options, options, _args|
|
44
|
-
puts JSON.dump($client.im_mark(options))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
g.desc 'Opens a direct message channel.'
|
49
|
-
g.long_desc %( Opens a direct message channel. )
|
50
|
-
g.command 'open' do |c|
|
51
|
-
c.flag 'user', desc: 'User to open a direct message channel with.'
|
52
|
-
c.flag 'include_locale', desc: 'Set this to true to receive the locale for this im. Defaults to false.'
|
53
|
-
c.flag 'return_im', desc: 'Boolean, indicates you want the full IM channel definition in the response.'
|
54
|
-
c.action do |_global_options, options, _args|
|
55
|
-
puts JSON.dump($client.im_open(options))
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
g.desc 'Retrieve a thread of messages posted to a direct message conversation'
|
60
|
-
g.long_desc %( Retrieve a thread of messages posted to a direct message conversation )
|
61
|
-
g.command 'replies' do |c|
|
62
|
-
c.flag 'channel', desc: 'Direct message channel to fetch thread from.'
|
63
|
-
c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
|
64
|
-
c.action do |_global_options, options, _args|
|
65
|
-
puts JSON.dump($client.im_replies(options))
|
66
|
-
end
|
67
|
-
end
|
68
6
|
end
|
data/bin/commands/mpim.rb
CHANGED
@@ -3,64 +3,4 @@
|
|
3
3
|
|
4
4
|
desc 'Get info on your multiparty direct messages.'
|
5
5
|
command 'mpim' do |g|
|
6
|
-
g.desc 'Closes a multiparty direct message channel.'
|
7
|
-
g.long_desc %( Closes a multiparty direct message channel. )
|
8
|
-
g.command 'close' do |c|
|
9
|
-
c.flag 'channel', desc: 'MPIM to close.'
|
10
|
-
c.action do |_global_options, options, _args|
|
11
|
-
puts JSON.dump($client.mpim_close(options))
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
g.desc 'Fetches history of messages and events from a multiparty direct message.'
|
16
|
-
g.long_desc %( Fetches history of messages and events from a multiparty direct message. )
|
17
|
-
g.command 'history' do |c|
|
18
|
-
c.flag 'channel', desc: 'Multiparty direct message to fetch history for.'
|
19
|
-
c.flag 'inclusive', desc: 'Include messages with latest or oldest timestamp in results.'
|
20
|
-
c.flag 'latest', desc: 'End of time range of messages to include in results.'
|
21
|
-
c.flag 'oldest', desc: 'Start of time range of messages to include in results.'
|
22
|
-
c.flag 'unreads', desc: 'Include unread_count_display in the output?.'
|
23
|
-
c.action do |_global_options, options, _args|
|
24
|
-
puts JSON.dump($client.mpim_history(options))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
g.desc 'Lists multiparty direct message channels for the calling user.'
|
29
|
-
g.long_desc %( Lists multiparty direct message channels for the calling user. )
|
30
|
-
g.command 'list' do |c|
|
31
|
-
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."
|
32
|
-
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."
|
33
|
-
c.action do |_global_options, options, _args|
|
34
|
-
puts JSON.dump($client.mpim_list(options))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
g.desc 'Sets the read cursor in a multiparty direct message channel.'
|
39
|
-
g.long_desc %( Sets the read cursor in a multiparty direct message channel. )
|
40
|
-
g.command 'mark' do |c|
|
41
|
-
c.flag 'channel', desc: 'Channel or conversation to set the read cursor for.'
|
42
|
-
c.flag 'ts', desc: 'Unique identifier of message you want marked as most recently seen in this conversation.'
|
43
|
-
c.action do |_global_options, options, _args|
|
44
|
-
puts JSON.dump($client.mpim_mark(options))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
g.desc 'This method opens a multiparty direct message.'
|
49
|
-
g.long_desc %( This method opens a multiparty direct message. )
|
50
|
-
g.command 'open' do |c|
|
51
|
-
c.flag 'users', desc: 'Comma separated lists of users. The ordering of the users is preserved whenever a MPIM group is returned.'
|
52
|
-
c.action do |_global_options, options, _args|
|
53
|
-
puts JSON.dump($client.mpim_open(options))
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
g.desc 'Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message.'
|
58
|
-
g.long_desc %( Retrieve a thread of messages posted to a direct message conversation from a multiparty direct message. )
|
59
|
-
g.command 'replies' do |c|
|
60
|
-
c.flag 'channel', desc: 'Multiparty direct message channel to fetch thread from.'
|
61
|
-
c.flag 'thread_ts', desc: "Unique identifier of a thread's parent message."
|
62
|
-
c.action do |_global_options, options, _args|
|
63
|
-
puts JSON.dump($client.mpim_replies(options))
|
64
|
-
end
|
65
|
-
end
|
66
6
|
end
|
data/lib/slack/events/request.rb
CHANGED
@@ -19,13 +19,13 @@ module Slack
|
|
19
19
|
|
20
20
|
# Request timestamp.
|
21
21
|
def timestamp
|
22
|
-
@timestamp ||= http_request.
|
22
|
+
@timestamp ||= http_request.get_header('HTTP_X_SLACK_REQUEST_TIMESTAMP')
|
23
23
|
end
|
24
24
|
|
25
25
|
# The signature is created by combining the signing secret with the body of the request
|
26
26
|
# Slack is sending using a standard HMAC-SHA256 keyed hash.
|
27
27
|
def signature
|
28
|
-
@signature ||= http_request.
|
28
|
+
@signature ||= http_request.get_header('HTTP_X_SLACK_SIGNATURE')
|
29
29
|
end
|
30
30
|
|
31
31
|
# Signature version.
|
@@ -38,19 +38,9 @@ module Slack
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def detect_concurrency
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
rescue LoadError, NameError
|
45
|
-
false # could not be loaded, missing dependencies
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
raise(
|
50
|
-
NoConcurrencyError,
|
51
|
-
'Missing concurrency. Add async-websocket or faye-websocket ' \
|
52
|
-
'to your Gemfile.'
|
53
|
-
)
|
41
|
+
Slack::RealTime::Concurrency.const_get(:Async)
|
42
|
+
rescue LoadError, NameError
|
43
|
+
raise NoConcurrencyError, 'Missing concurrency. Add async-websocket to your Gemfile.'
|
54
44
|
end
|
55
45
|
end
|
56
46
|
|
data/lib/slack/version.rb
CHANGED
@@ -10,7 +10,6 @@ require_relative 'endpoints/admin_barriers'
|
|
10
10
|
require_relative 'endpoints/admin_conversations'
|
11
11
|
require_relative 'endpoints/admin_conversations_ekm'
|
12
12
|
require_relative 'endpoints/admin_conversations_restrictAccess'
|
13
|
-
require_relative 'endpoints/admin_conversations_whitelist'
|
14
13
|
require_relative 'endpoints/admin_emoji'
|
15
14
|
require_relative 'endpoints/admin_inviteRequests'
|
16
15
|
require_relative 'endpoints/admin_inviteRequests_approved'
|
@@ -86,7 +85,6 @@ module Slack
|
|
86
85
|
include AdminConversations
|
87
86
|
include AdminConversationsEkm
|
88
87
|
include AdminConversationsRestrictaccess
|
89
|
-
include AdminConversationsWhitelist
|
90
88
|
include AdminEmoji
|
91
89
|
include AdminInviterequests
|
92
90
|
include AdminInviterequestsApproved
|
@@ -10,9 +10,11 @@ module Slack
|
|
10
10
|
# Retrieve analytics data for a given date, presented as a compressed JSON file
|
11
11
|
#
|
12
12
|
# @option options [Object] :type
|
13
|
-
# The type of analytics to retrieve. The options are currently limited to member.
|
13
|
+
# The type of analytics to retrieve. The options are currently limited to member (for grid member analytics) and public_channel (for public channel analytics).
|
14
14
|
# @option options [Object] :date
|
15
15
|
# Date to retrieve the analytics data for, expressed as YYYY-MM-DD in UTC.
|
16
|
+
# @option options [Object] :metadata_only
|
17
|
+
# Retrieve metadata for the type of analytics indicated. Can be used only with type set to public_channel analytics. See detail below. Omit the date parameter when using this argument.
|
16
18
|
# @see https://api.slack.com/methods/admin.analytics.getFile
|
17
19
|
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.analytics/admin.analytics.getFile.json
|
18
20
|
def admin_analytics_getFile(options = {})
|
@@ -63,20 +63,6 @@ module Slack
|
|
63
63
|
post('admin.conversations.delete', options)
|
64
64
|
end
|
65
65
|
|
66
|
-
#
|
67
|
-
# Disconnect a connected channel from one or more workspaces.
|
68
|
-
#
|
69
|
-
# @option options [Object] :channel_id
|
70
|
-
# The channel to be disconnected from some workspaces.
|
71
|
-
# @option options [Object] :leaving_team_ids
|
72
|
-
# The team to be removed from the channel. Currently only a single team id can be specified.
|
73
|
-
# @see https://api.slack.com/methods/admin.conversations.disconnectShared
|
74
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.disconnectShared.json
|
75
|
-
def admin_conversations_disconnectShared(options = {})
|
76
|
-
throw ArgumentError.new('Required arguments :channel_id missing') if options[:channel_id].nil?
|
77
|
-
post('admin.conversations.disconnectShared', options)
|
78
|
-
end
|
79
|
-
|
80
66
|
#
|
81
67
|
# Get conversation preferences for a public or private channel.
|
82
68
|
#
|
@@ -10,7 +10,7 @@ module Slack
|
|
10
10
|
# Create an Enterprise team.
|
11
11
|
#
|
12
12
|
# @option options [Object] :team_domain
|
13
|
-
# Team domain (for example, slacksoftballteam).
|
13
|
+
# Team domain (for example, slacksoftballteam). Domains are limited to 21 characters.
|
14
14
|
# @option options [Object] :team_name
|
15
15
|
# Team name (for example, Slack Softball Team).
|
16
16
|
# @option options [Object] :team_description
|
@@ -6,37 +6,6 @@ module Slack
|
|
6
6
|
module Api
|
7
7
|
module Endpoints
|
8
8
|
module Channels
|
9
|
-
#
|
10
|
-
# Archives a channel.
|
11
|
-
#
|
12
|
-
# @option options [channel] :channel
|
13
|
-
# Channel to archive.
|
14
|
-
# @see https://api.slack.com/methods/channels.archive
|
15
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.archive.json
|
16
|
-
def channels_archive(options = {})
|
17
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
18
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
19
|
-
logger.warn('channels.archive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.archive.')
|
20
|
-
post('channels.archive', options)
|
21
|
-
end
|
22
|
-
|
23
|
-
#
|
24
|
-
# Creates a channel.
|
25
|
-
#
|
26
|
-
# @option options [Object] :name
|
27
|
-
# Name of channel to create.
|
28
|
-
# @option options [Object] :team_id
|
29
|
-
# encoded team id to create the channel in, required if org token is used.
|
30
|
-
# @option options [Object] :validate
|
31
|
-
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
32
|
-
# @see https://api.slack.com/methods/channels.create
|
33
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.create.json
|
34
|
-
def channels_create(options = {})
|
35
|
-
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
36
|
-
logger.warn('channels.create: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.create.')
|
37
|
-
post('channels.create', options)
|
38
|
-
end
|
39
|
-
|
40
9
|
#
|
41
10
|
# Delete a channel (undocumented)
|
42
11
|
#
|
@@ -49,240 +18,6 @@ module Slack
|
|
49
18
|
logger.warn('The channels.delete method is undocumented.')
|
50
19
|
post('channels.delete', options)
|
51
20
|
end
|
52
|
-
|
53
|
-
#
|
54
|
-
# Fetches history of messages and events from a channel.
|
55
|
-
#
|
56
|
-
# @option options [channel] :channel
|
57
|
-
# Channel to fetch history for.
|
58
|
-
# @option options [Object] :inclusive
|
59
|
-
# Include messages with latest or oldest timestamp in results.
|
60
|
-
# @option options [timestamp] :latest
|
61
|
-
# End of time range of messages to include in results.
|
62
|
-
# @option options [timestamp] :oldest
|
63
|
-
# Start of time range of messages to include in results.
|
64
|
-
# @option options [Object] :unreads
|
65
|
-
# Include unread_count_display in the output?.
|
66
|
-
# @see https://api.slack.com/methods/channels.history
|
67
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.history.json
|
68
|
-
def channels_history(options = {})
|
69
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
70
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
71
|
-
logger.warn('channels.history: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.history.')
|
72
|
-
post('channels.history', options)
|
73
|
-
end
|
74
|
-
|
75
|
-
#
|
76
|
-
# Gets information about a channel.
|
77
|
-
#
|
78
|
-
# @option options [channel] :channel
|
79
|
-
# Channel to get info on.
|
80
|
-
# @option options [Object] :include_locale
|
81
|
-
# Set this to true to receive the locale for this channel. Defaults to false.
|
82
|
-
# @see https://api.slack.com/methods/channels.info
|
83
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.info.json
|
84
|
-
def channels_info(options = {})
|
85
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
86
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
87
|
-
logger.warn('channels.info: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.info.')
|
88
|
-
post('channels.info', options)
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# Invites a user to a channel.
|
93
|
-
#
|
94
|
-
# @option options [channel] :channel
|
95
|
-
# Channel to invite user to.
|
96
|
-
# @option options [user] :user
|
97
|
-
# User to invite to channel.
|
98
|
-
# @see https://api.slack.com/methods/channels.invite
|
99
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.invite.json
|
100
|
-
def channels_invite(options = {})
|
101
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
102
|
-
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
103
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
104
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
105
|
-
logger.warn('channels.invite: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.invite.')
|
106
|
-
post('channels.invite', options)
|
107
|
-
end
|
108
|
-
|
109
|
-
#
|
110
|
-
# Joins a channel, creating it if needed.
|
111
|
-
#
|
112
|
-
# @option options [Object] :name
|
113
|
-
# Name of channel to join.
|
114
|
-
# @option options [Object] :team_id
|
115
|
-
# encoded team id to list channels in, required if org token is used.
|
116
|
-
# @option options [Object] :validate
|
117
|
-
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
118
|
-
# @see https://api.slack.com/methods/channels.join
|
119
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.join.json
|
120
|
-
def channels_join(options = {})
|
121
|
-
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
122
|
-
logger.warn('channels.join: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.join.')
|
123
|
-
post('channels.join', options)
|
124
|
-
end
|
125
|
-
|
126
|
-
#
|
127
|
-
# Removes a user from a channel.
|
128
|
-
#
|
129
|
-
# @option options [channel] :channel
|
130
|
-
# Channel to remove user from.
|
131
|
-
# @option options [user] :user
|
132
|
-
# User to remove from channel.
|
133
|
-
# @see https://api.slack.com/methods/channels.kick
|
134
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.kick.json
|
135
|
-
def channels_kick(options = {})
|
136
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
137
|
-
throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
|
138
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
139
|
-
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
|
140
|
-
logger.warn('channels.kick: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.kick.')
|
141
|
-
post('channels.kick', options)
|
142
|
-
end
|
143
|
-
|
144
|
-
#
|
145
|
-
# Leaves a channel.
|
146
|
-
#
|
147
|
-
# @option options [channel] :channel
|
148
|
-
# Channel to leave.
|
149
|
-
# @see https://api.slack.com/methods/channels.leave
|
150
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.leave.json
|
151
|
-
def channels_leave(options = {})
|
152
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
153
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
154
|
-
logger.warn('channels.leave: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.leave.')
|
155
|
-
post('channels.leave', options)
|
156
|
-
end
|
157
|
-
|
158
|
-
#
|
159
|
-
# Lists all channels in a Slack team.
|
160
|
-
#
|
161
|
-
# @option options [Object] :cursor
|
162
|
-
# 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.
|
163
|
-
# @option options [Object] :exclude_archived
|
164
|
-
# Exclude archived channels from the list.
|
165
|
-
# @option options [Object] :exclude_members
|
166
|
-
# Exclude the members collection from each channel.
|
167
|
-
# @option options [Object] :limit
|
168
|
-
# 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.
|
169
|
-
# @option options [Object] :team_id
|
170
|
-
# encoded team id to list channels in, required if org token is used.
|
171
|
-
# @see https://api.slack.com/methods/channels.list
|
172
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.list.json
|
173
|
-
def channels_list(options = {})
|
174
|
-
logger.warn('channels.list: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.list, users.conversations.')
|
175
|
-
if block_given?
|
176
|
-
Pagination::Cursor.new(self, :channels_list, options).each do |page|
|
177
|
-
yield page
|
178
|
-
end
|
179
|
-
else
|
180
|
-
post('channels.list', options)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
#
|
185
|
-
# Sets the read cursor in a channel.
|
186
|
-
#
|
187
|
-
# @option options [channel] :channel
|
188
|
-
# Channel or conversation to set the read cursor for.
|
189
|
-
# @option options [timestamp] :ts
|
190
|
-
# Unique identifier of message you want marked as most recently seen in this conversation.
|
191
|
-
# @see https://api.slack.com/methods/channels.mark
|
192
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.mark.json
|
193
|
-
def channels_mark(options = {})
|
194
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
195
|
-
throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
|
196
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
197
|
-
logger.warn('channels.mark: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.mark.')
|
198
|
-
post('channels.mark', options)
|
199
|
-
end
|
200
|
-
|
201
|
-
#
|
202
|
-
# Renames a channel.
|
203
|
-
#
|
204
|
-
# @option options [channel] :channel
|
205
|
-
# Channel to rename.
|
206
|
-
# @option options [Object] :name
|
207
|
-
# New name for channel.
|
208
|
-
# @option options [Object] :validate
|
209
|
-
# Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
|
210
|
-
# @see https://api.slack.com/methods/channels.rename
|
211
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.rename.json
|
212
|
-
def channels_rename(options = {})
|
213
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
214
|
-
throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
|
215
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
216
|
-
logger.warn('channels.rename: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.rename.')
|
217
|
-
post('channels.rename', options)
|
218
|
-
end
|
219
|
-
|
220
|
-
#
|
221
|
-
# Retrieve a thread of messages posted to a channel
|
222
|
-
#
|
223
|
-
# @option options [channel] :channel
|
224
|
-
# Channel to fetch thread from.
|
225
|
-
# @option options [Object] :thread_ts
|
226
|
-
# Unique identifier of a thread's parent message.
|
227
|
-
# @see https://api.slack.com/methods/channels.replies
|
228
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.replies.json
|
229
|
-
def channels_replies(options = {})
|
230
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
231
|
-
throw ArgumentError.new('Required arguments :thread_ts missing') if options[:thread_ts].nil?
|
232
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
233
|
-
logger.warn('channels.replies: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.replies.')
|
234
|
-
post('channels.replies', options)
|
235
|
-
end
|
236
|
-
|
237
|
-
#
|
238
|
-
# Sets the purpose for a channel.
|
239
|
-
#
|
240
|
-
# @option options [channel] :channel
|
241
|
-
# Channel to set the purpose of.
|
242
|
-
# @option options [Object] :purpose
|
243
|
-
# The new purpose.
|
244
|
-
# @option options [Object] :name_tagging
|
245
|
-
# if it is true, treat this like a message and not an unescaped thing.
|
246
|
-
# @see https://api.slack.com/methods/channels.setPurpose
|
247
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.setPurpose.json
|
248
|
-
def channels_setPurpose(options = {})
|
249
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
250
|
-
throw ArgumentError.new('Required arguments :purpose missing') if options[:purpose].nil?
|
251
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
252
|
-
logger.warn('channels.setPurpose: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setPurpose.')
|
253
|
-
post('channels.setPurpose', options)
|
254
|
-
end
|
255
|
-
|
256
|
-
#
|
257
|
-
# Sets the topic for a channel.
|
258
|
-
#
|
259
|
-
# @option options [channel] :channel
|
260
|
-
# Channel to set the topic of.
|
261
|
-
# @option options [Object] :topic
|
262
|
-
# The new topic.
|
263
|
-
# @see https://api.slack.com/methods/channels.setTopic
|
264
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.setTopic.json
|
265
|
-
def channels_setTopic(options = {})
|
266
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
267
|
-
throw ArgumentError.new('Required arguments :topic missing') if options[:topic].nil?
|
268
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
269
|
-
logger.warn('channels.setTopic: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.setTopic.')
|
270
|
-
post('channels.setTopic', options)
|
271
|
-
end
|
272
|
-
|
273
|
-
#
|
274
|
-
# Unarchives a channel.
|
275
|
-
#
|
276
|
-
# @option options [channel] :channel
|
277
|
-
# Channel to unarchive.
|
278
|
-
# @see https://api.slack.com/methods/channels.unarchive
|
279
|
-
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/channels/channels.unarchive.json
|
280
|
-
def channels_unarchive(options = {})
|
281
|
-
throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
|
282
|
-
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
|
283
|
-
logger.warn('channels.unarchive: This method is deprecated. It will stop functioning in February 2021 and will not work with newly created apps after June 10th, 2020. Alternative methods: conversations.unarchive.')
|
284
|
-
post('channels.unarchive', options)
|
285
|
-
end
|
286
21
|
end
|
287
22
|
end
|
288
23
|
end
|