Class: Zm::Client::FolderGrant
- Inherits:
-
Object
- Object
- Zm::Client::FolderGrant
- 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
-
#d ⇒ Object
Returns the value of attribute d.
-
#expiry ⇒ Object
Returns the value of attribute expiry.
-
#folder_id ⇒ Object
readonly
Returns the value of attribute folder_id.
-
#gt ⇒ Object
Returns the value of attribute gt.
-
#key ⇒ Object
Returns the value of attribute key.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#perm ⇒ Object
Returns the value of attribute perm.
-
#zid ⇒ Object
Returns the value of attribute zid.
Instance Method Summary collapse
- #delete! ⇒ Object
-
#initialize(parent, zid, gt, perm, d) ⇒ FolderGrant
constructor
pour créer un nouveau partage, il faut indiquer zid et/ou d l’attribut gt est obligatoire ! l’attribut perm est obligatoire !.
- #inspect ⇒ Object
- #instance_variables_map ⇒ Object
- #is_account? ⇒ Boolean
- #is_dl? ⇒ Boolean
- #is_dom? ⇒ Boolean
- #is_external? ⇒ Boolean
- #is_key? ⇒ Boolean
- #is_public? ⇒ Boolean
- #save! ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
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
#d ⇒ Object
Returns the value of attribute d.
15 16 17 |
# File 'lib/zm/client/folder/folder_grant.rb', line 15 def d @d end |
#expiry ⇒ Object
Returns the value of attribute expiry.
15 16 17 |
# File 'lib/zm/client/folder/folder_grant.rb', line 15 def expiry @expiry end |
#folder_id ⇒ Object (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 |
#gt ⇒ Object
Returns the value of attribute gt.
15 16 17 |
# File 'lib/zm/client/folder/folder_grant.rb', line 15 def gt @gt end |
#key ⇒ Object
Returns the value of attribute key.
15 16 17 |
# File 'lib/zm/client/folder/folder_grant.rb', line 15 def key @key end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
14 15 16 |
# File 'lib/zm/client/folder/folder_grant.rb', line 14 def parent @parent end |
#perm ⇒ Object
Returns the value of attribute perm.
15 16 17 |
# File 'lib/zm/client/folder/folder_grant.rb', line 15 def perm @perm end |
#zid ⇒ Object
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 |
#inspect ⇒ Object
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_map ⇒ Object
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
32 33 34 |
# File 'lib/zm/client/folder/folder_grant.rb', line 32 def is_account? gt == GT_USER end |
#is_dl? ⇒ Boolean
40 41 42 |
# File 'lib/zm/client/folder/folder_grant.rb', line 40 def is_dl? gt == GT_GROUP end |
#is_dom? ⇒ Boolean
36 37 38 |
# File 'lib/zm/client/folder/folder_grant.rb', line 36 def is_dom? gt == GT_DOMAIN end |
#is_external? ⇒ Boolean
48 49 50 |
# File 'lib/zm/client/folder/folder_grant.rb', line 48 def is_external? gt == GT_GUEST end |
#is_key? ⇒ Boolean
52 53 54 |
# File 'lib/zm/client/folder/folder_grant.rb', line 52 def is_key? gt == GT_KEY end |
#is_public? ⇒ 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_h ⇒ Object
69 70 71 |
# File 'lib/zm/client/folder/folder_grant.rb', line 69 def to_h Hash[instance_variables_map] end |
#to_s ⇒ Object
65 66 67 |
# File 'lib/zm/client/folder/folder_grant.rb', line 65 def to_s inspect end |