Class: Zm::Client::MountpointJsnsBuilder
Overview
Instance Method Summary
collapse
#initialize
Instance Method Details
#to_color ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 71
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
93
94
95
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 93
def to_delete
{ action: { op: :delete, id: @item.id } }
end
|
#to_empty ⇒ Object
83
84
85
86
87
88
89
90
91
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 83
def to_empty
action = {
op: :empty,
id: @item.id,
recursive: false
}
{ action: action }
end
|
#to_find ⇒ Object
8
9
10
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 8
def to_find
{ link: { 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
26
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 12
def to_jsns
link = {
f: @item.f,
name: @item.name,
l: @item.l,
color: @item.color,
rgb: @item.rgb,
url: @item.url,
view: @item.view,
zid: @item.zid,
rid: @item.rid
}.delete_if { |_, v| v.nil? }
{ link: link }
end
|
#to_move ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 61
def to_move
action = {
op: :move,
id: @item.id,
l: @item.l
}
{ action: action }
end
|
#to_rename ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 51
def to_rename
action = {
op: :rename,
id: @item.id,
name: @item.name
}
{ action: action }
end
|
#to_update ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 30
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,
view: @item.view
}.delete_if { |_, v| v.nil? }
if @item.is_immutable?
action.delete(:name)
action.delete(:l)
end
{ action: action }
end
|