Class: Zm::Client::MountpointJsnsBuilder

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

Overview

class for account folder

Instance Method Summary collapse

Methods inherited from BaseAccountJsnsBuilder

#build, #initialize, #to_color, #to_delete, #to_move, #to_patch, #to_rename, #to_tag, #to_trash

Constructor Details

This class inherits a constructor from Zm::Client::BaseAccountJsnsBuilder

Instance Method Details

#to_findObject



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

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

#to_jsnsObject Also known as: to_create



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 11

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? }

  attrs = { link: link }

  SoapElement.mail(SoapMailConstants::CREATE_MOUNTPOINT_REQUEST).add_attributes(attrs)
end

#to_updateObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/zm/client/mountpoint/mountpoint_jsns_builder.rb', line 31

def to_update
  attrs = {
    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?
    attrs.delete(:name)
    attrs.delete(:l)
  end

  build(attrs)
end