Module: Slack::Web::Api::Endpoints::Channels
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/channels.rb
Instance Method Summary collapse
-
#channels_archive(options = {}) ⇒ Object
Archives a channel.
-
#channels_create(options = {}) ⇒ Object
Creates a channel.
-
#channels_delete(options = {}) ⇒ Object
Delete a channel (undocumented).
-
#channels_history(options = {}) ⇒ Object
Fetches history of messages and events from a channel.
-
#channels_info(options = {}) ⇒ Object
Gets information about a channel.
-
#channels_invite(options = {}) ⇒ Object
Invites a user to a channel.
-
#channels_join(options = {}) ⇒ Object
Joins a channel, creating it if needed.
-
#channels_kick(options = {}) ⇒ Object
Removes a user from a channel.
-
#channels_leave(options = {}) ⇒ Object
Leaves a channel.
-
#channels_list(options = {}) ⇒ Object
Lists all channels in a Slack team.
-
#channels_mark(options = {}) ⇒ Object
Sets the read cursor in a channel.
-
#channels_rename(options = {}) ⇒ Object
Renames a channel.
-
#channels_replies(options = {}) ⇒ Object
Retrieve a thread of messages posted to a channel.
-
#channels_setPurpose(options = {}) ⇒ Object
Sets the purpose for a channel.
-
#channels_setTopic(options = {}) ⇒ Object
Sets the topic for a channel.
-
#channels_unarchive(options = {}) ⇒ Object
Unarchives a channel.
Instance Method Details
#channels_archive(options = {}) ⇒ Object
Archives a channel.
16 17 18 19 20 21 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 16 def channels_archive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.archive', ) end |
#channels_create(options = {}) ⇒ Object
Creates a channel.
32 33 34 35 36 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 32 def channels_create( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? 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.') post('channels.create', ) end |
#channels_delete(options = {}) ⇒ Object
Delete a channel (undocumented)
44 45 46 47 48 49 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 44 def channels_delete( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] logger.warn('The channels.delete method is undocumented.') post('channels.delete', ) end |
#channels_history(options = {}) ⇒ Object
Fetches history of messages and events from a channel.
66 67 68 69 70 71 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 66 def channels_history( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.history', ) end |
#channels_info(options = {}) ⇒ Object
Gets information about a channel.
82 83 84 85 86 87 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 82 def channels_info( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.info', ) end |
#channels_invite(options = {}) ⇒ Object
Invites a user to a channel.
98 99 100 101 102 103 104 105 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 98 def channels_invite( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] 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.') post('channels.invite', ) end |
#channels_join(options = {}) ⇒ Object
Joins a channel, creating it if needed.
116 117 118 119 120 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 116 def channels_join( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? 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.') post('channels.join', ) end |
#channels_kick(options = {}) ⇒ Object
Removes a user from a channel.
131 132 133 134 135 136 137 138 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 131 def channels_kick( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] 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.') post('channels.kick', ) end |
#channels_leave(options = {}) ⇒ Object
Leaves a channel.
147 148 149 150 151 152 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 147 def channels_leave( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.leave', ) end |
#channels_list(options = {}) ⇒ Object
Lists all channels in a Slack team.
167 168 169 170 171 172 173 174 175 176 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 167 def channels_list( = {}) 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.') if block_given? Pagination::Cursor.new(self, :channels_list, ).each do |page| yield page end else post('channels.list', ) end end |
#channels_mark(options = {}) ⇒ Object
Sets the read cursor in a channel.
187 188 189 190 191 192 193 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 187 def channels_mark( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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: .') post('channels.mark', ) end |
#channels_rename(options = {}) ⇒ Object
Renames a channel.
206 207 208 209 210 211 212 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 206 def channels_rename( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :name missing') if [:name].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.rename', ) end |
#channels_replies(options = {}) ⇒ Object
Retrieve a thread of messages posted to a channel
223 224 225 226 227 228 229 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 223 def channels_replies( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :thread_ts missing') if [:thread_ts].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.replies', ) end |
#channels_setPurpose(options = {}) ⇒ Object
Sets the purpose for a channel.
242 243 244 245 246 247 248 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 242 def channels_setPurpose( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :purpose missing') if [:purpose].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.setPurpose', ) end |
#channels_setTopic(options = {}) ⇒ Object
Sets the topic for a channel.
259 260 261 262 263 264 265 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 259 def channels_setTopic( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :topic missing') if [:topic].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.setTopic', ) end |
#channels_unarchive(options = {}) ⇒ Object
Unarchives a channel.
274 275 276 277 278 279 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 274 def channels_unarchive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] 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.') post('channels.unarchive', ) end |