Class: Zm::Client::FolderGrantJsnsBuilder

Inherits:
Base::BaseJsnsBuilder show all
Defined in:
lib/zm/client/folder/folder_grant_jsns_builder.rb

Overview

class for account folder grant jsns builder

Constant Summary

Constants inherited from Base::BaseJsnsBuilder

Base::BaseJsnsBuilder::A_ARRAY_PROC, Base::BaseJsnsBuilder::A_NODE_PROC

Instance Method Summary collapse

Methods inherited from Base::BaseJsnsBuilder

#arrow_name, #initialize, #instance_variables_array, #to_patch, #to_update

Constructor Details

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

Instance Method Details

#delete_zidObject



45
46
47
48
49
50
51
# File 'lib/zm/client/folder/folder_grant_jsns_builder.rb', line 45

def delete_zid
  return @item.zid unless @item.zid.nil?

  return '99999999-9999-9999-9999-999999999999' if @item.gt == 'pub'

  '00000000-0000-0000-0000-000000000000'
end

#to_deleteObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/zm/client/folder/folder_grant_jsns_builder.rb', line 30

def to_delete
  attrs = {
    action: {
      op: '!grant',
      id: @item.folder_id,
      zid: delete_zid,
      gt: @item.gt,
      perm: @item.perm,
      d: @item.d
    }
  }

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

#to_jsnsObject Also known as: to_create



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zm/client/folder/folder_grant_jsns_builder.rb', line 7

def to_jsns
  grant = {
    zid: @item.zid,
    gt: @item.gt,
    perm: @item.perm,
    d: @item.d,
    expiry: @item.expiry,
    key: @item.key
  }.delete_if { |_, v| v.nil? }

  attrs = {
    action: {
      op: :grant,
      id: @item.folder_id,
      grant: grant
    }
  }

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