Class: Zm::Client::MountpointJsnsBuilder

Inherits:
Base::BaseJsnsBuilder show all
Defined in:
lib/zm/client/mountpoint/mountpoint_jsns_builder.rb

Overview

class for account folder

Instance Method Summary collapse

Methods inherited from Base::BaseJsnsBuilder

#initialize

Constructor Details

This class inherits a constructor from Zm::Client::Base::BaseJsnsBuilder

Instance Method Details

#to_colorObject



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_deleteObject



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_emptyObject



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_findObject



8
9
10
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 8

def to_find
  { link: { l: @item.id } }
end

#to_jsnsObject 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_moveObject



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_renameObject



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_updateObject



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