Class: Zm::Client::Document

Inherits:
Base::AccountObject show all
Defined in:
lib/zm/client/document/document.rb

Overview

class for account document

Constant Summary collapse

INSTANCE_VARIABLE_KEYS =
%i[id uuid name s d l luuid ms mdver md rev f tn t meta ct descEnabled ver leb cr cd acl loid sf tn]

Instance Attribute Summary collapse

Attributes inherited from Base::Object

#grantee_type, #id, #name, #parent, #token

Instance Method Summary collapse

Methods inherited from Base::AccountObject

#concat, #create!, #init_from_json, #modify!, #rename!, #soap_account_connector, #to_h

Methods inherited from Base::Object

#arrow_name, #clone, #concat, #convert_json_string_value, #disable_builder, #enable_builder, #init_from_json, #instance_variables_array, #instance_variables_hash, #logger, #recorded?, #save!, #to_s, #use_builder?

Constructor Details

#initialize(parent, json = nil) {|_self| ... } ⇒ Document

Returns a new instance of Document.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
# File 'lib/zm/client/document/document.rb', line 16

def initialize(parent, json = nil)
  @parent = parent
  init_from_json(json) if json.is_a?(Hash)
  yield(self) if block_given?
end

Instance Attribute Details

#folderObject



26
27
28
# File 'lib/zm/client/document/document.rb', line 26

def folder
  @folder ||= @parent.folders.all.find { |folder| folder.id == l }
end

#jsonObject (readonly)

Returns the value of attribute json.



12
13
14
# File 'lib/zm/client/document/document.rb', line 12

def json
  @json
end

Instance Method Details

#all_instance_variable_keysObject



22
23
24
# File 'lib/zm/client/document/document.rb', line 22

def all_instance_variable_keys
  INSTANCE_VARIABLE_KEYS
end

#delete!Object



39
40
41
# File 'lib/zm/client/document/document.rb', line 39

def delete!
  @parent.sacc.item_action(@parent.token, :delete, @id)
end

#download(dest_file_path) ⇒ Object



43
44
45
46
# File 'lib/zm/client/document/document.rb', line 43

def download(dest_file_path)
  uploader = Upload.new(@parent, RestAccountConnector.new)
  uploader.download_file(folder.absFolderPath, nil, nil, [id], dest_file_path)
end

#move!(folder_id) ⇒ Object



34
35
36
37
# File 'lib/zm/client/document/document.rb', line 34

def move!(folder_id)
  @parent.sacc.item_action(@parent.token, 'move', @id, l: folder_id)
  @l = folder_id
end

#tag!(tag_name) ⇒ Object



30
31
32
# File 'lib/zm/client/document/document.rb', line 30

def tag!(tag_name)
  @parent.sacc.item_action(@parent.token, :tag, @id, tn: tag_name)
end