Class: Zm::Client::FolderJsnsBuilder
Overview
class for account folder jsns builder
Instance Method Summary
collapse
#initialize
Instance Method Details
#to_color ⇒ Object
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 80
def to_color
action = {
op: :color,
id: @item.id
}
action[:rgb] = @item.rgb if @item.rgb_changed?
action[:color] = @item.color if @item.color_changed?
{ action: action }
end
|
#to_delete ⇒ Object
102
103
104
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 102
def to_delete
{ action: { op: :delete, id: @item.id } }
end
|
#to_empty ⇒ Object
92
93
94
95
96
97
98
99
100
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 92
def to_empty
action = {
op: :empty,
id: @item.id,
recursive: false
}
{ action: action }
end
|
#to_find ⇒ Object
8
9
10
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 8
def to_find
{ folder: { l: @item.id } }
end
|
#to_jsns ⇒ Object
Also known as:
to_create
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 12
def to_jsns
folder = {
f: @item.f,
name: @item.name,
l: @item.l,
color: @item.color,
rgb: @item.rgb,
url: @item.url,
fb: @item.fb,
view: @item.view
}.delete_if { |_, v| v.nil? }
{ folder: folder }
end
|
#to_move ⇒ Object
70
71
72
73
74
75
76
77
78
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 70
def to_move
action = {
op: :move,
id: @item.id,
l: @item.l
}
{ action: action }
end
|
#to_patch(options) ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 51
def to_patch(options)
action = {
op: :update,
id: @item.id
}.merge(options)
{ action: action }
end
|
#to_rename ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 60
def to_rename
action = {
op: :rename,
id: @item.id,
name: @item.name
}
{ action: action }
end
|
#to_retentionpolicy ⇒ Object
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 106
def to_retentionpolicy
retentionpolicy = @item.retention_policies.all.map { |rp| retentionpolicy_jsns(rp) }.reduce({}, :merge)
{
action: {
op: :retentionpolicy,
id: @item.id,
retentionPolicy: retentionpolicy
}
}
end
|
#to_update ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/zm/client/folder/folder_jsns_builder.rb', line 29
def to_update
action = {
op: :update,
id: @item.id,
f: @item.f,
name: @item.name,
l: @item.l,
color: @item.color,
rgb: @item.rgb,
url: @item.url,
fb: @item.fb,
view: @item.view
}.delete_if { |_, v| v.nil? }
if @item.is_immutable?
action.delete(:name)
action.delete(:l)
end
{ action: action }
end
|