Class: Zm::Client::FolderGrantsCollection

Inherits:
Object
  • Object
show all
Includes:
MissingMethodStaticCollection
Defined in:
lib/zm/client/folder/folder_grants_collection.rb

Overview

class for folder retention policies collection

Instance Attribute Summary collapse

Attributes included from MissingMethodStaticCollection

#all

Instance Method Summary collapse

Methods included from MissingMethodStaticCollection

#method_missing

Constructor Details

#initialize(parent) ⇒ FolderGrantsCollection

Returns a new instance of FolderGrantsCollection.



11
12
13
14
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 11

def initialize(parent)
  @parent = parent
  @all = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MissingMethodStaticCollection

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



9
10
11
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 9

def parent
  @parent
end

Instance Method Details

#add(fg) ⇒ Object



54
55
56
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 54

def add(fg)
  @all << fg
end

#create(zid, gt, perm, d) ⇒ Object



42
43
44
45
46
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 42

def create(zid, gt, perm, d)
  fg = new(zid, gt, perm, d)
  add(fg)
  fg
end

#create_from_object(item, perm) ⇒ Object



48
49
50
51
52
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 48

def create_from_object(item, perm)
  fg = new_from_object(item, perm)
  add(fg)
  fg
end

#new(zid, gt, perm, d) ⇒ Object



38
39
40
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 38

def new(zid, gt, perm, d)
  FolderGrant.new(self, zid, gt, perm, d)
end

#new_from_object(item, perm) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 16

def new_from_object(item, perm)
  case item
  when Account
    zid = item.id
    gt = FolderGrant::GT_USER
  when Resource
    zid = item.id
    gt = FolderGrant::GT_USER
  when DistributionList
    zid = item.id
    gt = FolderGrant::GT_GROUP
  when Domain
    zid = item.id
    gt = FolderGrant::GT_DOMAIN
  else
    zid = nil
    gt = nil
  end

  new(zid, gt, perm, nil)
end

#soap_account_connectorObject Also known as: sacc



58
59
60
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 58

def 
  @parent.parent.
end

#to_sObject



64
65
66
# File 'lib/zm/client/folder/folder_grants_collection.rb', line 64

def to_s
  @all.map(&:to_s)
end