Class: Squall::UserGroup

Inherits:
Base
  • Object
show all
Defined in:
lib/squall/user_group.rb

Overview

OnApp UserGroup

Instance Attribute Summary

Attributes inherited from Base

#result, #success

Instance Method Summary (collapse)

Methods inherited from Base

#check_config, #default_params, #key_for_class, #request

Instance Method Details

- (Object) create(options = {})

Create a user group.

Examples:

create label: "My new user group"

Parameters:

  • options (defaults to: {})

    Params for creating the user groups:

Options Hash (options):

  • :label (Object)

    Label for the user group



20
21
22
# File 'lib/squall/user_group.rb', line 20

def create(options = {})
  request(:post, "/user_groups.json", default_params(options))
end

- (Object) delete(id)

Delete a user group.

Parameters:

  • id

    ID of the user group

Returns:

  • a Hash.



39
40
41
# File 'lib/squall/user_group.rb', line 39

def delete(id)
  request(:delete, "/user_groups/#{id}.json")
end

- (Object) edit(id, options = {})

Edit a user group.

Parameters:

  • id

    ID of the user group

  • options (defaults to: {})

    Params for editing the user group, see `#create`

Returns:

  • a Hash.



30
31
32
# File 'lib/squall/user_group.rb', line 30

def edit(id, options = {})
  request(:put, "/user_groups/#{id}.json", default_params(options))
end

- (Object) list

List all user groups.

Returns:

  • an Array.



7
8
9
10
# File 'lib/squall/user_group.rb', line 7

def list
  response = request(:get, "/user_groups.json")
  response.collect { |user_group| user_group['user_group'] }
end