Class: Zm::Client::MountPoint
Overview
class for account mountpoint
Constant Summary
collapse
- INSTANCE_VARIABLE_KEYS =
%i[
owner rev reminder ms deletable l rid uuid url f broken
luuid ruuid activesyncdisabled absFolderPath view zid name id
webOfflineSyncDays color rgb
].freeze
Instance Attribute Summary
Attributes inherited from Base::Object
#grantee_type, #id, #name, #parent, #token
Instance Method Summary
collapse
#soap_account_connector
#arrow_name, #clone, #convert_json_string_value, #instance_variables_array, #instance_variables_hash, #recorded?, #save!, #to_s
Constructor Details
#initialize(parent, json = nil) {|_self| ... } ⇒ MountPoint
Returns a new instance of MountPoint.
21
22
23
24
25
26
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 21
def initialize(parent, json = nil)
@parent = parent
@l = 1
init_from_json(json) if json.is_a?(Hash)
yield(self) if block_given?
end
|
Instance Method Details
#build_create_options ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 33
def build_create_options
{
l: @l,
name: @name,
view: @view,
zid: @zid,
rid: @rid,
url: @url,
color: @color,
rgb: @rgb,
f: @f
}.delete_if { |_, v| v.nil? }
end
|
#build_update_options ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 55
def build_update_options
{
f: @f,
name: @name,
l: @l,
color: @color,
rgb: @rgb
}.delete_if { |_, v| v.nil? }
end
|
#color!(new_color) ⇒ Object
75
76
77
78
79
80
81
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 75
def color!(new_color)
key = new_color.to_i.zero? ? :rgb : :color
options = {}
options[key] = new_color
@parent.sacc.folder_action(@parent.token, 'color', @id, options)
instance_variable_set("@#{key}", new_color)
end
|
#concat ⇒ Object
15
16
17
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 15
def concat
INSTANCE_VARIABLE_KEYS.map { |key| instance_variable_get(arrow_name(key)) }
end
|
#create! ⇒ Object
28
29
30
31
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 28
def create!
rep = @parent.sacc.create_mountpoint(@parent.token, build_create_options)
init_from_json(rep[:Body][:CreateMountpointResponse][:link].first)
end
|
#delete! ⇒ Object
83
84
85
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 83
def delete!
@parent.sacc.folder_action(@parent.token, :delete, @id)
end
|
#init_from_json(json) ⇒ Object
87
88
89
90
91
92
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 87
def init_from_json(json)
INSTANCE_VARIABLE_KEYS.each do |key|
var_name = "@#{key}"
instance_variable_set(var_name, json[key])
end
end
|
#modify! ⇒ Object
47
48
49
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 47
def modify!
update!(build_update_options)
end
|
#move!(folder_id) ⇒ Object
70
71
72
73
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 70
def move!(folder_id)
@parent.sacc.folder_action(@parent.token, 'move', @id, l: folder_id)
@l = folder_id
end
|
#rename!(new_name) ⇒ Object
65
66
67
68
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 65
def rename!(new_name)
@parent.sacc.folder_action(@parent.token, 'rename', @id, name: new_name)
@name = new_name
end
|
#update!(options) ⇒ Object
51
52
53
|
# File 'lib/zm/client/mountpoint/mountpoint.rb', line 51
def update!(options)
@parent.sacc.folder_action(@parent.token, 'update', @id, options)
end
|