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_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.
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
Creates 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_history(options = {}) ⇒ Object
Fetches history of messages and events from a channel.
50 51 52 53 54 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 50 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
Gets information about a channel.
63 64 65 66 67 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 63 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
Invites a user to a channel.
78 79 80 81 82 83 84 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 78 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
Joins a channel, creating it if needed.
95 96 97 98 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 95 def channels_join( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('channels.join', ) end |
#channels_kick(options = {}) ⇒ Object
Removes a user from a channel.
109 110 111 112 113 114 115 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 109 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
Leaves a channel.
124 125 126 127 128 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 124 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
Lists all channels in a Slack team.
139 140 141 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 139 def channels_list( = {}) post('channels.list', ) end |
#channels_mark(options = {}) ⇒ Object
Sets the read cursor in a channel.
152 153 154 155 156 157 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 152 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
Renames a channel.
170 171 172 173 174 175 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 170 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
Retrieve a thread of messages posted to a channel
186 187 188 189 190 191 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 186 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
Sets the purpose for a channel.
202 203 204 205 206 207 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 202 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
Sets the topic for a channel.
218 219 220 221 222 223 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 218 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
Unarchives a channel.
232 233 234 235 236 |
# File 'lib/slack/web/api/endpoints/channels.rb', line 232 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 |