Class: Zm::Client::Document
- Inherits:
-
Base::AccountObject
- Object
- Base::Object
- Base::AccountObject
- Zm::Client::Document
- 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 ct descEnabled ver leb cr cd acl loid sf tn]
Instance Attribute Summary collapse
- #folder ⇒ Object
-
#json ⇒ Object
readonly
Returns the value of attribute json.
Attributes inherited from Base::Object
#grantee_type, #id, #name, #parent, #token
Instance Method Summary collapse
- #concat ⇒ Object
- #download(dest_file_path) ⇒ Object
- #init_from_json(json) ⇒ Object
-
#initialize(parent, json = nil) {|_self| ... } ⇒ Document
constructor
A new instance of Document.
- #tag!(tag_name) ⇒ Object
Methods inherited from Base::AccountObject
Methods inherited from Base::Object
#arrow_name, #clone, #convert_json_string_value, #instance_variables_array, #instance_variables_hash, #recorded?, #save!, #to_s
Constructor Details
#initialize(parent, json = nil) {|_self| ... } ⇒ Document
Returns a new instance of Document.
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
#folder ⇒ Object
26 27 28 |
# File 'lib/zm/client/document/document.rb', line 26 def folder @folder ||= @parent.folders.all.find { |folder| folder.id == l } end |
#json ⇒ Object (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
#concat ⇒ Object
22 23 24 |
# File 'lib/zm/client/document/document.rb', line 22 def concat INSTANCE_VARIABLE_KEYS.map { |key| instance_variable_get(arrow_name(key)) } end |
#download(dest_file_path) ⇒ Object
34 35 36 37 |
# File 'lib/zm/client/document/document.rb', line 34 def download(dest_file_path) uploader = Upload.new(@parent, RestAccountConnector.new) uploader.download_file(folder.absFolderPath, nil, nil, [id], dest_file_path) end |
#init_from_json(json) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/zm/client/document/document.rb', line 39 def init_from_json(json) INSTANCE_VARIABLE_KEYS.each do |key| var_name = "@#{key}" instance_variable_set(var_name, json[key]) end 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 |