Class: Zm::Client::FolderGrant

Inherits:
Object
  • Object
show all
Defined in:
lib/zm/client/folder/folder_grant.rb

Overview

class for account folder

Constant Summary collapse

GT_USER =
'usr'
GT_GROUP =
'grp'
GT_DOMAIN =
'dom'
GT_PUB =
'pub'
GT_GUEST =
'guest'
GT_KEY =
'key'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, zid, gt, perm, d) ⇒ FolderGrant

pour créer un nouveau partage, il faut indiquer zid et/ou d l’attribut gt est obligatoire ! l’attribut perm est obligatoire !



21
22
23
24
25
26
27
28
29
30
# File 'lib/zm/client/folder/folder_grant.rb', line 21

def initialize(parent, zid, gt, perm, d)
  @parent = parent
  @zid = zid
  @gt = gt
  @perm = perm
  @d = d
  @expiry = nil
  @key = nil
  @folder_id = parent.parent.id
end

Instance Attribute Details

#dObject

Returns the value of attribute d.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def d
  @d
end

#expiryObject

Returns the value of attribute expiry.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def expiry
  @expiry
end

#folder_idObject (readonly)

Returns the value of attribute folder_id.



14
15
16
# File 'lib/zm/client/folder/folder_grant.rb', line 14

def folder_id
  @folder_id
end

#gtObject

Returns the value of attribute gt.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def gt
  @gt
end

#keyObject

Returns the value of attribute key.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def key
  @key
end

#parentObject (readonly)

Returns the value of attribute parent.



14
15
16
# File 'lib/zm/client/folder/folder_grant.rb', line 14

def parent
  @parent
end

#permObject

Returns the value of attribute perm.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def perm
  @perm
end

#zidObject

Returns the value of attribute zid.



15
16
17
# File 'lib/zm/client/folder/folder_grant.rb', line 15

def zid
  @zid
end

Instance Method Details

#delete!Object



60
61
62
63
# File 'lib/zm/client/folder/folder_grant.rb', line 60

def delete!
  @parent.sacc.invoke(jsns_builder.to_delete)
  @parent.all.delete(self)
end

#inspectObject



73
74
75
76
# File 'lib/zm/client/folder/folder_grant.rb', line 73

def inspect
  keys_str = to_h.map { |k, v| "#{k}: #{v}" }.join(', ')
  "#{self.class}:#{format('0x00%x', (object_id << 1))} #{keys_str}"
end

#instance_variables_mapObject



78
79
80
81
82
# File 'lib/zm/client/folder/folder_grant.rb', line 78

def instance_variables_map
  keys = instance_variables.dup
  keys.delete(:@parent)
  keys.map { |key| [key, instance_variable_get(key)] }
end

#is_account?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/zm/client/folder/folder_grant.rb', line 32

def is_account?
  gt == GT_USER
end

#is_dl?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/zm/client/folder/folder_grant.rb', line 40

def is_dl?
  gt == GT_GROUP
end

#is_dom?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/zm/client/folder/folder_grant.rb', line 36

def is_dom?
  gt == GT_DOMAIN
end

#is_external?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/zm/client/folder/folder_grant.rb', line 48

def is_external?
  gt == GT_GUEST
end

#is_key?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/zm/client/folder/folder_grant.rb', line 52

def is_key?
  gt == GT_KEY
end

#is_public?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/zm/client/folder/folder_grant.rb', line 44

def is_public?
  gt == GT_PUBLIC
end

#save!Object



56
57
58
# File 'lib/zm/client/folder/folder_grant.rb', line 56

def save!
  @parent.sacc.invoke(jsns_builder.to_create)
end

#to_hObject



69
70
71
# File 'lib/zm/client/folder/folder_grant.rb', line 69

def to_h
  Hash[instance_variables_map]
end

#to_sObject



65
66
67
# File 'lib/zm/client/folder/folder_grant.rb', line 65

def to_s
  inspect
end