class ProfitBricks::Group
Group
class
Public Class Methods
create(options = {})
click to toggle source
Create a new group.
# File lib/profitbricks/group.rb, line 42 def create(options = {}) response = ProfitBricks.request( method: :post, path: '/um/groups/', expects: 202, body: { properties: options }.to_json ) add_parent_identities(response) instantiate_objects(response) end
get(group_id,options = {})
click to toggle source
Retrieve a group.
# File lib/profitbricks/group.rb, line 65 def get(group_id,options = {}) response = ProfitBricks.request( method: :get, path: "/um/groups/#{group_id}", expects: 200, query: options ) instantiate_objects(response) end
list(options = {})
click to toggle source
List all groups.
# File lib/profitbricks/group.rb, line 54 def list(options = {}) response = ProfitBricks.request( method: :get, path: '/um/groups/', expects: 200, query: options ) instantiate_objects(response) end
Public Instance Methods
add_user(user_id)
click to toggle source
Add an user to the group
# File lib/profitbricks/group.rb, line 31 def add_user(user_id) ProfitBricks::User.add_to_group(id, user_id) end
delete()
click to toggle source
Delete the group.
# File lib/profitbricks/group.rb, line 5 def delete response = ProfitBricks.request( method: :delete, path: "/um/groups/#{id}", expects: 202 ) self.requestId = response[:requestId] self end
remove_user(user_id)
click to toggle source
Remove an user from the group
# File lib/profitbricks/group.rb, line 36 def remove_user(user_id) ProfitBricks::User.remove_from_group(id, user_id) end
update(options = {})
click to toggle source
Update the group.
# File lib/profitbricks/group.rb, line 16 def update(options = {}) response = ProfitBricks.request( method: :put, path: "/um/groups/#{id}", expects: 202, body: { properties: options }.to_json ) if response self.requestId = response['requestId'] @properties = @properties.merge(response['properties']) end self end