Module: Slack::Web::Groups

Included in:
Slack::Web
Defined in:
lib/slack/web/groups.rb

Overview

Module for the groups methods. Get info on your team's private groups.

Constant Summary collapse

SCOPE =

Endpoint scope

'groups'

Instance Method Summary collapse

Instance Method Details

#groups_archive(params = {}) ⇒ Object

Archives a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Private group to archive

See Also:



20
21
22
23
24
# File 'lib/slack/web/groups.rb', line 20

def groups_archive(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.archive", params
  Slack.parse_response(response)
end

#groups_close(params = {}) ⇒ Object

Closes a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to close.

See Also:



34
35
36
37
38
# File 'lib/slack/web/groups.rb', line 34

def groups_close(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.close", params
  Slack.parse_response(response)
end

#groups_create(params = {}) ⇒ Object

Creates a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'name' (Object)

    Name of group to create

See Also:



48
49
50
51
52
# File 'lib/slack/web/groups.rb', line 48

def groups_create(params = {})
  fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
  response = @session.do_post "#{SCOPE}.create", params
  Slack.parse_response(response)
end

#groups_create_child(params = {}) ⇒ Object

Clones and archives a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (Object)

    Group to clone and archive.

See Also:



62
63
64
65
66
# File 'lib/slack/web/groups.rb', line 62

def groups_create_child(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.createChild", params
  Slack.parse_response(response)
end

#groups_history(params = {}) ⇒ Object

Fetches history of messages and events from a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to fetch history for.

  • 'latest' (timestamp)

    Latest message timestamp to include in results.

  • 'oldest' (timestamp)

    Oldest message timestamp to include in results.

  • 'inclusive' (Object)

    Include messages with latest or oldest timestamp in results.

  • 'count' (Object)

    Number of messages to return, between 1 and 1000.

See Also:



84
85
86
87
88
# File 'lib/slack/web/groups.rb', line 84

def groups_history(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.history", params
  Slack.parse_response(response)
end

#groups_info(params = {}) ⇒ Object

This method returns information about a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (channel)

    Group to get info on

See Also:



98
99
100
101
102
# File 'lib/slack/web/groups.rb', line 98

def groups_info(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.info", params
  Slack.parse_response(response)
end

#groups_invite(params = {}) ⇒ Object

Invites a user to a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Private group to invite user to.

  • 'user' (user)

    User to invite.

See Also:



114
115
116
117
118
119
# File 'lib/slack/web/groups.rb', line 114

def groups_invite(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
  response = @session.do_post "#{SCOPE}.invite", params
  Slack.parse_response(response)
end

#groups_kick(params = {}) ⇒ Object

Removes a user from a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to remove user from.

  • 'user' (user)

    User to remove from group.

See Also:



131
132
133
134
135
136
# File 'lib/slack/web/groups.rb', line 131

def groups_kick(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'user' missing" if params['user'].nil?
  response = @session.do_post "#{SCOPE}.kick", params
  Slack.parse_response(response)
end

#groups_leave(params = {}) ⇒ Object

Leaves a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to leave

See Also:



145
146
147
148
149
# File 'lib/slack/web/groups.rb', line 145

def groups_leave(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.leave", params
  Slack.parse_response(response)
end

#groups_list(params = {}) ⇒ Object

Lists private groups that the calling user has access to.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'exclude_archived' (Object)

    Don't return archived groups.

See Also:



159
160
161
162
# File 'lib/slack/web/groups.rb', line 159

def groups_list(params = {})
  response = @session.do_post "#{SCOPE}.list", params
  Slack.parse_response(response)
end

#groups_mark(params = {}) ⇒ Object

Sets the read cursor in a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to set reading cursor in.

  • 'ts' (timestamp)

    Timestamp of the most recently seen message.

See Also:



174
175
176
177
178
179
# File 'lib/slack/web/groups.rb', line 174

def groups_mark(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'ts' missing" if params['ts'].nil?
  response = @session.do_post "#{SCOPE}.mark", params
  Slack.parse_response(response)
end

#groups_open(params = {}) ⇒ Object

Opens a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to open.

See Also:



189
190
191
192
193
# File 'lib/slack/web/groups.rb', line 189

def groups_open(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.open", params
  Slack.parse_response(response)
end

#groups_rename(params = {}) ⇒ Object

Renames a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to rename

  • 'name' (Object)

    New name for group.

See Also:



205
206
207
208
209
210
# File 'lib/slack/web/groups.rb', line 205

def groups_rename(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'name' missing" if params['name'].nil?
  response = @session.do_post "#{SCOPE}.rename", params
  Slack.parse_response(response)
end

#groups_set_purpose(params = {}) ⇒ Object

Sets the purpose for a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Private group to set the purpose of

  • 'purpose' (Object)

    The new purpose

See Also:



222
223
224
225
226
227
# File 'lib/slack/web/groups.rb', line 222

def groups_set_purpose(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'pupose' missing" if params['purpos'].nil?
  response = @session.do_post "#{SCOPE}.setPurpose", params
  Slack.parse_response(response)
end

#groups_set_topic(params = {}) ⇒ Object

Sets the topic for a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Private group to set the purpose of

  • 'topic' (Object)

    The new topic

See Also:



239
240
241
242
243
244
# File 'lib/slack/web/groups.rb', line 239

def groups_set_topic(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  fail ArgumentError, "Required arguments 'topic' missing" if params['topic'].nil?
  response = @session.do_post "#{SCOPE}.setTopic", params
  Slack.parse_response(response)
end

#groups_unarchive(params = {}) ⇒ Object

Unarchives a private group.

Parameters:

  • params (Hash) (defaults to: {})

    API call arguments

Options Hash (params):

  • 'channel' (group)

    Group to unarchive

See Also:



254
255
256
257
258
# File 'lib/slack/web/groups.rb', line 254

def groups_unarchive(params = {})
  fail ArgumentError, "Required arguments 'channel' missing" if params['channel'].nil?
  response = @session.do_post "#{SCOPE}.unarchive", params
  Slack.parse_response(response)
end