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

#create(options = {}) ⇒ Object

Public: Create a user group.

options - Params for creating the user groups:

:label - Label for the user group

Example

create label: "My new 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

#delete(id) ⇒ Object

Public: Delete a user group.

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

#edit(id, options = {}) ⇒ Object

Public: Edit a user group.

id - ID of the user group options - 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

#listObject

Public: 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