Class: Shared::Groups Abstract

Inherits:
MutableCollection show all
Defined in:
lib/vas/shared/groups.rb

Overview

This class is abstract.

A collection of groups

Instance Attribute Summary

Attributes inherited from Resource

#location, #security

Instance Method Summary collapse

Methods inherited from MutableCollection

#delete

Methods inherited from Collection

#each

Constructor Details

#initialize(location, client, group_class) ⇒ Groups

Returns a new instance of Groups.



23
24
25
# File 'lib/vas/shared/groups.rb', line 23

def initialize(location, client, group_class)
  super(location, client, "groups", group_class)
end

Instance Method Details

#create(name, nodes) ⇒ Group

Creates a new group

Parameters:

  • name (String)

    the group’s name

  • nodes (GroupableNode[])

    the group’s nodes

Returns:

  • (Group)

    the new group



35
36
37
38
39
# File 'lib/vas/shared/groups.rb', line 35

def create(name, nodes)
  node_locations = []
  nodes.each { |node| node_locations << node.location }
  entry_class.new(client.post(location, {:name => name, :nodes => node_locations}, "group"), client)
end