14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/zm/client/folder/folder_jsns_initializer.rb', line 14
def update(item, json)
item.type = json.delete(:type)
item.id = json.delete(:id)
item.uuid = json.delete(:uuid)
item.name = json.delete(:name)
item.absFolderPath = json.delete(:absFolderPath)
item.l = json.delete(:l)
item.url = json.delete(:url)
item.luuid = json.delete(:luuid)
item.f = json.delete(:f)
item.view = json.delete(:view)
item.rev = json.delete(:rev)
item.ms = json.delete(:ms)
item.webOfflineSyncDays = json.delete(:webOfflineSyncDays)
item.activesyncdisabled = json.delete(:activesyncdisabled)
item.n = json.delete(:n)
item.s = json.delete(:s)
item.i4ms = json.delete(:i4ms)
item.i4next = json.delete(:i4next)
item.zid = json.delete(:zid)
item.rid = json.delete(:rid)
item.ruuid = json.delete(:ruuid)
item.owner = json.delete(:owner)
item.reminder = json.delete(:reminder)
item.acl = json.delete(:acl)
item.itemCount = json.delete(:itemCount)
item.broken = json.delete(:broken)
item.deletable = json.delete(:deletable)
item.color = json.delete(:color)
item.rgb = json.delete(:rgb)
item.fb = json.delete(:fb)
grants = json.dig(:acl, :grant)
if grants.is_a?(Array)
grants.each do |grant|
item.grants.create(
grant.delete(:zid),
grant.delete(:gt),
grant.delete(:perm),
grant.delete(:d)
)
end
end
if (policies = json.fetch(:retentionPolicy, []).first).is_a?(Array)
policies.each do |policy, v|
params = v.first[:policy]&.first
next if params.nil?
type = params.delete(:type)
lifetime = params.delete(:lifetime)
item.retention_policies.create(policy, lifetime, type)
end
end
item.extend(DocumentFolder) if item.view == Zm::Client::FolderView::DOCUMENT
item
end
|