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
This method archives a channel.
-
#channels_create(options = {}) ⇒ Object
This method is used to create a channel.
-
#channels_delete(options = {}) ⇒ Object
Delete a channel (undocumented).
-
#channels_history(options = {}) ⇒ Object
This method returns a portion of message events from the specified public channel.
-
#channels_info(options = {}) ⇒ Object
This method returns information about a team channel.
-
#channels_invite(options = {}) ⇒ Object
This method is used to invite a user to a channel.
-
#channels_join(options = {}) ⇒ Object
This method is used to join a channel.
-
#channels_kick(options = {}) ⇒ Object
This method allows a user to remove another member from a team channel.
-
#channels_leave(options = {}) ⇒ Object
This method is used to leave a channel.
-
#channels_list(options = {}) ⇒ Object
Don’t use this method.
-
#channels_mark(options = {}) ⇒ Object
This method moves the read cursor in a channel.
-
#channels_rename(options = {}) ⇒ Object
This method renames a team channel.
-
#channels_replies(options = {}) ⇒ Object
This method returns an entire thread (a message plus all the messages in reply to it).
-
#channels_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a channel.
-
#channels_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a channel.
-
#channels_unarchive(options = {}) ⇒ Object
This method unarchives a channel.
Instance Method Details
#channels_archive(options = {}) ⇒ Object
This method archives a channel.
15 16 17 18 19 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 15 def channels_archive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('channels.archive', ) end |
#channels_create(options = {}) ⇒ Object
This method is used to create a channel.
30 31 32 33 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 30 def channels_create( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('channels.create', ) end |
#channels_delete(options = {}) ⇒ Object
Delete a channel (undocumented)
41 42 43 44 45 46 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 41 def channels_delete( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] logger.warn('The channels.delete method is undocumented.') post('channels.delete', ) end |
#channels_history(options = {}) ⇒ Object
This method returns a portion of message events from the specified public channel.
63 64 65 66 67 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 63 def channels_history( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('channels.history', ) end |
#channels_info(options = {}) ⇒ Object
This method returns information about a team channel.
78 79 80 81 82 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 78 def channels_info( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('channels.info', ) end |
#channels_invite(options = {}) ⇒ Object
This method is used to invite a user to a channel. The calling user must be a member of the channel.
93 94 95 96 97 98 99 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 93 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: channels_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('channels.invite', ) end |
#channels_join(options = {}) ⇒ Object
This method is used to join a channel. If the channel does not exist, it is created.
111 112 113 114 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 111 def channels_join( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('channels.join', ) end |
#channels_kick(options = {}) ⇒ Object
This method allows a user to remove another member from a team channel.
125 126 127 128 129 130 131 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 125 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: channels_id()['channel']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('channels.kick', ) end |
#channels_leave(options = {}) ⇒ Object
This method is used to leave a channel.
140 141 142 143 144 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 140 def channels_leave( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('channels.leave', ) end |
#channels_list(options = {}) ⇒ Object
Don’t use this method. Use conversations.list instead.
159 160 161 162 163 164 165 166 167 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 159 def channels_list( = {}) 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
This method moves the read cursor in a channel.
178 179 180 181 182 183 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 178 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: channels_id()['channel']['id']) if [:channel] post('channels.mark', ) end |
#channels_rename(options = {}) ⇒ Object
This method renames a team channel.
196 197 198 199 200 201 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 196 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: channels_id()['channel']['id']) if [:channel] post('channels.rename', ) end |
#channels_replies(options = {}) ⇒ Object
This method returns an entire thread (a message plus all the messages in reply to it).
212 213 214 215 216 217 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 212 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: channels_id()['channel']['id']) if [:channel] post('channels.replies', ) end |
#channels_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a channel. The calling user must be a member of the channel.
230 231 232 233 234 235 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 230 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: channels_id()['channel']['id']) if [:channel] post('channels.setPurpose', ) end |
#channels_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a channel. The calling user must be a member of the channel.
246 247 248 249 250 251 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 246 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: channels_id()['channel']['id']) if [:channel] post('channels.setTopic', ) end |
#channels_unarchive(options = {}) ⇒ Object
This method unarchives a channel. The calling user is added to the channel.
260 261 262 263 264 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 260 def channels_unarchive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('channels.unarchive', ) end |