Module: Slack::Web::Channels
- Included in:
- Slack::Web
- Defined in:
- lib/slack/web/channels.rb
Constant Summary collapse
- SCOPE =
"channels"
Instance Method Summary collapse
-
#channels_archive(params = {}) ⇒ Object
Archives a channel.
-
#channels_create(params = {}) ⇒ Object
Creates a channel.
-
#channels_history(params = {}) ⇒ Object
Fetches history of messages and events from a channel.
-
#channels_info(params = {}) ⇒ Object
Gets information about a channel.
-
#channels_invite(params = {}) ⇒ Object
Invites a user to a channel.
-
#channels_join(params = {}) ⇒ Object
Joins a channel, creating it if needed.
-
#channels_kick(params = {}) ⇒ Object
Removes a user from a channel.
-
#channels_leave(params = {}) ⇒ Object
Leaves a channel.
-
#channels_list(params = {}) ⇒ Object
Lists all channels in a Slack team.
-
#channels_mark(params = {}) ⇒ Object
Sets the read cursor in a channel.
-
#channels_rename(params = {}) ⇒ Object
Renames a channel.
-
#channels_set_purpose(params = {}) ⇒ Object
Sets the purpose for a channel.
-
#channels_set_topic(params = {}) ⇒ Object
Sets the topic for a channel.
-
#channels_unarchive(params = {}) ⇒ Object
Unarchives a channel.
Instance Method Details
#channels_archive(params = {}) ⇒ Object
Archives a channel.
7 8 9 10 11 |
# File 'lib/slack/web/channels.rb', line 7 def channels_archive(params = {}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? response = @session.do_get "#{SCOPE}.archive", params Slack::parse_response(response) end |
#channels_create(params = {}) ⇒ Object
Creates a channel.
14 15 16 17 18 |
# File 'lib/slack/web/channels.rb', line 14 def channels_create(params = {}) throw ArgumentError.new("Required arguments :name missing") if params['name'].nil? response = @session.do_get "#{SCOPE}.create", params Slack::parse_response(response) end |
#channels_history(params = {}) ⇒ Object
Fetches history of messages and events from a channel.
21 22 23 24 25 |
# File 'lib/slack/web/channels.rb', line 21 def channels_history(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? response = @session.do_get "#{SCOPE}.history", params Slack::parse_response(response) end |
#channels_info(params = {}) ⇒ Object
Gets information about a channel.
28 29 30 31 32 |
# File 'lib/slack/web/channels.rb', line 28 def channels_info(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? response = @session.do_get "#{SCOPE}.info", params Slack::parse_response(response) end |
#channels_invite(params = {}) ⇒ Object
Invites a user to a channel.
35 36 37 38 39 40 |
# File 'lib/slack/web/channels.rb', line 35 def channels_invite(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :user missing") if params['user'].nil? response = @session.do_get "#{SCOPE}.invite", params Slack::parse_response(response) end |
#channels_join(params = {}) ⇒ Object
Joins a channel, creating it if needed.
43 44 45 46 47 |
# File 'lib/slack/web/channels.rb', line 43 def channels_join(params={}) throw ArgumentError.new("Required arguments :name missing") if params['name'].nil? response = @session.do_get "#{SCOPE}.join", params Slack::parse_response(response) end |
#channels_kick(params = {}) ⇒ Object
Removes a user from a channel.
50 51 52 53 54 55 |
# File 'lib/slack/web/channels.rb', line 50 def channels_kick(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :user missing") if params['user'].nil? response = @session.do_get "#{SCOPE}.kick", params Slack::parse_response(response) end |
#channels_leave(params = {}) ⇒ Object
Leaves a channel.
58 59 60 61 62 |
# File 'lib/slack/web/channels.rb', line 58 def channels_leave(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? response = @session.do_get "#{SCOPE}.leave", params Slack::parse_response(response) end |
#channels_list(params = {}) ⇒ Object
Lists all channels in a Slack team.
65 66 67 68 |
# File 'lib/slack/web/channels.rb', line 65 def channels_list(params={}) response = @session.do_get "#{SCOPE}.list", params Slack::parse_response(response) end |
#channels_mark(params = {}) ⇒ Object
Sets the read cursor in a channel.
71 72 73 74 75 76 |
# File 'lib/slack/web/channels.rb', line 71 def channels_mark(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :ts missing") if params['ts'].nil? response = @session.do_get "#{SCOPE}.mark", params Slack::parse_response(response) end |
#channels_rename(params = {}) ⇒ Object
Renames a channel.
79 80 81 82 83 84 |
# File 'lib/slack/web/channels.rb', line 79 def channels_rename(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :name missing") if params['name'].nil? response = @session.do_get "#{SCOPE}.rename", params Slack::parse_response(response) end |
#channels_set_purpose(params = {}) ⇒ Object
Sets the purpose for a channel.
87 88 89 90 91 92 |
# File 'lib/slack/web/channels.rb', line 87 def channels_set_purpose(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :purpose missing") if params['purpose'].nil? response = @session.do_get "#{SCOPE}.setPurpose", params Slack::parse_response(response) end |
#channels_set_topic(params = {}) ⇒ Object
Sets the topic for a channel.
95 96 97 98 99 100 |
# File 'lib/slack/web/channels.rb', line 95 def channels_set_topic(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? throw ArgumentError.new("Required arguments :topic missing") if params['topic'].nil? response = @session.do_get "#{SCOPE}.setTopic", params Slack::parse_response(response) end |
#channels_unarchive(params = {}) ⇒ Object
Unarchives a channel.
103 104 105 106 107 |
# File 'lib/slack/web/channels.rb', line 103 def channels_unarchive(params={}) throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil? response = @session.do_get "#{SCOPE}.unarchive", params Slack::parse_response(response) end |