Module: Slack::Web::Api::Endpoints::Groups
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/groups.rb
Instance Method Summary collapse
-
#groups_archive(options = {}) ⇒ Object
This method archives a private channel.
-
#groups_create(options = {}) ⇒ Object
This method creates a private channel.
-
#groups_createChild(options = {}) ⇒ Object
This method takes an existing private channel and performs the following steps: - Renames the existing private channel (from “example” to “example-archived”).
-
#groups_history(options = {}) ⇒ Object
This method returns a portion of messages/events from the specified private channel.
-
#groups_info(options = {}) ⇒ Object
Don’t use this method.
-
#groups_invite(options = {}) ⇒ Object
This method is used to invite a user to a private channel.
-
#groups_kick(options = {}) ⇒ Object
This method allows a user to remove another member from a private channel.
-
#groups_leave(options = {}) ⇒ Object
This method is used to leave a private channel.
-
#groups_list(options = {}) ⇒ Object
Don’t use this method.
-
#groups_mark(options = {}) ⇒ Object
This method moves the read cursor in a private channel.
-
#groups_open(options = {}) ⇒ Object
This method opens a private channel.
-
#groups_rename(options = {}) ⇒ Object
This method renames a private channel.
-
#groups_replies(options = {}) ⇒ Object
This method returns an entire thread (a message plus all the messages in reply to it).
-
#groups_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a private channel.
-
#groups_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a private channel.
-
#groups_unarchive(options = {}) ⇒ Object
This method unarchives a private channel.
Instance Method Details
#groups_archive(options = {}) ⇒ Object
This method archives a private channel.
15 16 17 18 19 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 15 def groups_archive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.archive', ) end |
#groups_create(options = {}) ⇒ Object
This method creates a private channel.
30 31 32 33 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 30 def groups_create( = {}) throw ArgumentError.new('Required arguments :name missing') if [:name].nil? post('groups.create', ) end |
#groups_createChild(options = {}) ⇒ Object
This method takes an existing private channel and performs the following steps:
-
Renames the existing private channel (from “example” to “example-archived”).
-
Archives the existing private channel.
-
Creates a new private channel with the name of the existing private channel.
-
Adds all members of the existing private channel to the new private channel.
46 47 48 49 50 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 46 def groups_createChild( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.createChild', ) end |
#groups_history(options = {}) ⇒ Object
This method returns a portion of messages/events from the specified private channel. To read the entire history for a private channel, call the method with no latest or oldest arguments, and then continue paging using the instructions below.
69 70 71 72 73 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 69 def groups_history( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.history', ) end |
#groups_info(options = {}) ⇒ Object
Don’t use this method. Use conversations.info instead.
84 85 86 87 88 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 84 def groups_info( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.info', ) end |
#groups_invite(options = {}) ⇒ Object
This method is used to invite a user to a private channel. The calling user must be a member of the private channel.
99 100 101 102 103 104 105 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 99 def groups_invite( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('groups.invite', ) end |
#groups_kick(options = {}) ⇒ Object
This method allows a user to remove another member from a private channel.
116 117 118 119 120 121 122 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 116 def groups_kick( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] = .merge(user: users_id()['user']['id']) if [:user] post('groups.kick', ) end |
#groups_leave(options = {}) ⇒ Object
This method is used to leave a private channel.
131 132 133 134 135 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 131 def groups_leave( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.leave', ) end |
#groups_list(options = {}) ⇒ Object
Don’t use this method. Use conversations.list instead.
150 151 152 153 154 155 156 157 158 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 150 def groups_list( = {}) if block_given? Pagination::Cursor.new(self, :groups_list, ).each do |page| yield page end else post('groups.list', ) end end |
#groups_mark(options = {}) ⇒ Object
This method moves the read cursor in a private channel.
169 170 171 172 173 174 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 169 def groups_mark( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.mark', ) end |
#groups_open(options = {}) ⇒ Object
This method opens a private channel.
183 184 185 186 187 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 183 def groups_open( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.open', ) end |
#groups_rename(options = {}) ⇒ Object
This method renames a private channel.
200 201 202 203 204 205 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 200 def groups_rename( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :name missing') if [:name].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.rename', ) end |
#groups_replies(options = {}) ⇒ Object
This method returns an entire thread (a message plus all the messages in reply to it).
216 217 218 219 220 221 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 216 def groups_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: groups_id()['group']['id']) if [:channel] post('groups.replies', ) end |
#groups_setPurpose(options = {}) ⇒ Object
This method is used to change the purpose of a private channel. The calling user must be a member of the private channel.
232 233 234 235 236 237 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 232 def groups_setPurpose( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :purpose missing') if [:purpose].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.setPurpose', ) end |
#groups_setTopic(options = {}) ⇒ Object
This method is used to change the topic of a private channel. The calling user must be a member of the private channel.
248 249 250 251 252 253 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 248 def groups_setTopic( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :topic missing') if [:topic].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.setTopic', ) end |
#groups_unarchive(options = {}) ⇒ Object
This method unarchives a private channel.
262 263 264 265 266 |
# File 'lib/slack/web/api/endpoints/groups.rb', line 262 def groups_unarchive( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? = .merge(channel: groups_id()['group']['id']) if [:channel] post('groups.unarchive', ) end |