Module: Slack::Endpoint::Usergroups

Included in:
Slack::Endpoint
Defined in:
lib/slack/endpoint/usergroups.rb

Instance Method Summary collapse

Instance Method Details

#usergroups_create(options = {}) ⇒ Object

This method is used to create a User Group.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :name (Object)

    A name for the User Group. Must be unique among User Groups.

  • :handle (Object)

    A mention handle. Must be unique among channels, users and User Groups.

  • :description (Object)

    A short description of the User Group.

  • :channels (Object)

    A comma separated string of encoded channel IDs for which the User Group uses as a default.

  • :include_count (Object)

    Include the number of users in each User Group.

See Also:



22
23
24
25
26
# File 'lib/slack/endpoint/usergroups.rb', line 22

def usergroups_create(options={})
  throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.create", options)
end

#usergroups_disable(options = {}) ⇒ Object

This method disables an existing User Group.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :usergroup (Object)

    The encoded ID of the User Group to disable.

  • :include_count (Object)

    Include the number of users in the User Group.

See Also:



38
39
40
41
42
# File 'lib/slack/endpoint/usergroups.rb', line 38

def usergroups_disable(options={})
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.disable", options)
end

#usergroups_enable(options = {}) ⇒ Object

This method enables a User Group which was previously disabled.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :usergroup (Object)

    The encoded ID of the User Group to enable.

  • :include_count (Object)

    Include the number of users in the User Group.

See Also:



54
55
56
57
58
# File 'lib/slack/endpoint/usergroups.rb', line 54

def usergroups_enable(options={})
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.enable", options)
end

#usergroups_list(options = {}) ⇒ Object

This method returns a list of all User Groups in the team. This can optionally include disabled User Groups.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :include_disabled (Object)

    Include disabled User Groups.

  • :include_count (Object)

    Include the number of users in each User Group.

  • :include_users (Object)

    Include the list of users for each User Group.

See Also:



72
73
74
75
# File 'lib/slack/endpoint/usergroups.rb', line 72

def usergroups_list(options={})
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.list", options)
end

#usergroups_update(options = {}) ⇒ Object

This method updates the properties of an existing User Group.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :usergroup (Object)

    The encoded ID of the User Group to update.

  • :name (Object)

    A name for the User Group. Must be unique among User Groups.

  • :handle (Object)

    A mention handle. Must be unique among channels, users and User Groups.

  • :description (Object)

    A short description of the User Group.

  • :channels (Object)

    A comma separated string of encoded channel IDs for which the User Group uses as a default.

  • :include_count (Object)

    Include the number of users in the User Group.

See Also:



95
96
97
98
99
# File 'lib/slack/endpoint/usergroups.rb', line 95

def usergroups_update(options={})
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.update", options)
end

#usergroups_users(options = {}) ⇒ Object

This method updates the list of users that belong to a User Group. This method replaces all users in a User Group with the list of users provided in the users parameter.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :usergroup (Object)

    The encoded ID of the User Group to update.

  • :users (Object)

    A comma separated string of encoded user IDs that represent the entire list of users for the User Group.

  • :include_count (Object)

    Include the number of users in the User Group.

See Also:



113
114
115
116
117
118
# File 'lib/slack/endpoint/usergroups.rb', line 113

def usergroups_users(options={})
  throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
  throw ArgumentError.new("Required arguments :users missing") if options[:users].nil?
  options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
  post("usergroups.users", options)
end