Class: Zm::Client::Folder
- Inherits:
-
Base::Object
- Object
- Base::Object
- Zm::Client::Folder
- Includes:
- BelongsToFolder, MailboxItemConcern, RequestMethodsMailbox
- Defined in:
- lib/zm/client/folder/folder.rb
Overview
class for account folder
Instance Attribute Summary collapse
-
#absFolderPath ⇒ Object
Returns the value of attribute absFolderPath.
-
#acl ⇒ Object
Returns the value of attribute acl.
-
#activesyncdisabled ⇒ Object
Returns the value of attribute activesyncdisabled.
-
#broken ⇒ Object
Returns the value of attribute broken.
-
#color ⇒ Object
Returns the value of attribute color.
-
#deletable ⇒ Object
Returns the value of attribute deletable.
-
#f ⇒ Object
Returns the value of attribute f.
-
#fb ⇒ Object
Returns the value of attribute fb.
-
#folders ⇒ Object
Returns the value of attribute folders.
-
#i4ms ⇒ Object
Returns the value of attribute i4ms.
-
#i4next ⇒ Object
Returns the value of attribute i4next.
-
#itemCount ⇒ Object
Returns the value of attribute itemCount.
-
#luuid ⇒ Object
Returns the value of attribute luuid.
-
#ms ⇒ Object
Returns the value of attribute ms.
-
#n ⇒ Object
(also: #nb_messages, #nb_items)
Returns the value of attribute n.
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
-
#reminder ⇒ Object
Returns the value of attribute reminder.
-
#rev ⇒ Object
Returns the value of attribute rev.
-
#rgb ⇒ Object
Returns the value of attribute rgb.
-
#rid ⇒ Object
Returns the value of attribute rid.
-
#ruuid ⇒ Object
Returns the value of attribute ruuid.
-
#s ⇒ Object
(also: #size)
Returns the value of attribute s.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
-
#view ⇒ Object
Returns the value of attribute view.
-
#webOfflineSyncDays ⇒ Object
Returns the value of attribute webOfflineSyncDays.
-
#zid ⇒ Object
Returns the value of attribute zid.
Attributes inherited from Base::Object
Instance Method Summary collapse
- #add_appointments(ics) ⇒ Object
- #add_contacts(csv) ⇒ Object
- #add_message(eml, d = nil, f = nil, tn = nil) ⇒ Object
- #build_add_appointments(ics) ⇒ Object
- #build_add_contacts(csv) ⇒ Object
- #build_add_message(eml, d = nil, f = nil, tn = nil) ⇒ Object
- #build_color ⇒ Object
- #build_empty ⇒ Object
- #color! ⇒ Object
- #create! ⇒ Object
- #delete! ⇒ Object
- #download(dest_file_path, fmt: nil) ⇒ Object
- #empty! ⇒ Object (also: #clear)
- #empty? ⇒ Boolean
- #grants ⇒ Object
-
#initialize(parent) {|_self| ... } ⇒ Folder
constructor
A new instance of Folder.
- #is_immutable? ⇒ Boolean
- #l ⇒ Object (also: #folder_id)
- #reload! ⇒ Object
- #remove_flag!(pattern) ⇒ Object
- #retention_policies ⇒ Object
- #to_query ⇒ Object
- #upload(src_file_path, fmt: nil, resolve: nil) ⇒ Object
Methods included from MailboxItemConcern
Methods included from RequestMethodsMailbox
#build_create, #build_delete, #build_modify, #build_rename, #modify!, #rename!, #update!
Methods included from BelongsToFolder
#folder, #folder!, #folder=, #move!, #trash!
Methods inherited from Base::Object
#clone, #inspect, #instance_variables_map, #logger, #recorded?, #save!, #to_h, #to_s, #update_attribute
Constructor Details
#initialize(parent) {|_self| ... } ⇒ Folder
Returns a new instance of Folder.
19 20 21 22 23 24 25 26 |
# File 'lib/zm/client/folder/folder.rb', line 19 def initialize(parent) super @type = :folder @folders = [] yield(self) if block_given? end |
Instance Attribute Details
#absFolderPath ⇒ Object
Returns the value of attribute absFolderPath.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def absFolderPath @absFolderPath end |
#acl ⇒ Object
Returns the value of attribute acl.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def acl @acl end |
#activesyncdisabled ⇒ Object
Returns the value of attribute activesyncdisabled.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def activesyncdisabled @activesyncdisabled end |
#broken ⇒ Object
Returns the value of attribute broken.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def broken @broken end |
#color ⇒ Object
Returns the value of attribute color.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def color @color end |
#deletable ⇒ Object
Returns the value of attribute deletable.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def deletable @deletable end |
#f ⇒ Object
Returns the value of attribute f.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def f @f end |
#fb ⇒ Object
Returns the value of attribute fb.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def fb @fb end |
#folders ⇒ Object
Returns the value of attribute folders.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def folders @folders end |
#i4ms ⇒ Object
Returns the value of attribute i4ms.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def i4ms @i4ms end |
#i4next ⇒ Object
Returns the value of attribute i4next.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def i4next @i4next end |
#itemCount ⇒ Object
Returns the value of attribute itemCount.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def itemCount @itemCount end |
#luuid ⇒ Object
Returns the value of attribute luuid.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def luuid @luuid end |
#ms ⇒ Object
Returns the value of attribute ms.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def ms @ms end |
#n ⇒ Object Also known as: nb_messages, nb_items
Returns the value of attribute n.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def n @n end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def owner @owner end |
#reminder ⇒ Object
Returns the value of attribute reminder.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def reminder @reminder end |
#rev ⇒ Object
Returns the value of attribute rev.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def rev @rev end |
#rgb ⇒ Object
Returns the value of attribute rgb.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def rgb @rgb end |
#rid ⇒ Object
Returns the value of attribute rid.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def rid @rid end |
#ruuid ⇒ Object
Returns the value of attribute ruuid.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def ruuid @ruuid end |
#s ⇒ Object Also known as: size
Returns the value of attribute s.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def s @s end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def url @url end |
#uuid ⇒ Object
Returns the value of attribute uuid.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def uuid @uuid end |
#view ⇒ Object
Returns the value of attribute view.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def view @view end |
#webOfflineSyncDays ⇒ Object
Returns the value of attribute webOfflineSyncDays.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def webOfflineSyncDays @webOfflineSyncDays end |
#zid ⇒ Object
Returns the value of attribute zid.
11 12 13 |
# File 'lib/zm/client/folder/folder.rb', line 11 def zid @zid end |
Instance Method Details
#add_appointments(ics) ⇒ Object
127 128 129 |
# File 'lib/zm/client/folder/folder.rb', line 127 def add_appointments(ics) @parent.soap_connector.invoke(build_add_appointments(ics)).dig(:ImportAppointmentsResponse, :appt) end |
#add_contacts(csv) ⇒ Object
139 140 141 |
# File 'lib/zm/client/folder/folder.rb', line 139 def add_contacts(csv) @parent.soap_connector.invoke(build_add_contacts(csv)).dig(:ImportContactsResponse, :cn) end |
#add_message(eml, d = nil, f = nil, tn = nil) ⇒ Object
107 108 109 |
# File 'lib/zm/client/folder/folder.rb', line 107 def (eml, d = nil, f = nil, tn = nil) @parent.soap_connector.invoke((eml, d, f, tn)) end |
#build_add_appointments(ics) ⇒ Object
131 132 133 134 135 136 137 |
# File 'lib/zm/client/folder/folder.rb', line 131 def build_add_appointments(ics) attrs = { l: id, ct: SoapConstants::TEXT_CALENDAR } soap_request = SoapElement.mail(SoapMailConstants::IMPORT_APPOINTMENTS_REQUEST).add_attributes(attrs) node_content = SoapElement.create(SoapConstants::CONTENT).add_content(ics) soap_request.add_node(node_content) soap_request end |
#build_add_contacts(csv) ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/zm/client/folder/folder.rb', line 143 def build_add_contacts(csv) attrs = { l: id, ct: SoapConstants::CSV } soap_request = SoapElement.mail(SoapMailConstants::IMPORT_CONTACTS_REQUEST).add_attributes(attrs) node_content = SoapElement.create(SoapConstants::CONTENT).add_content(csv) soap_request.add_node(node_content) soap_request end |
#build_add_message(eml, d = nil, f = nil, tn = nil) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/zm/client/folder/folder.rb', line 111 def (eml, d = nil, f = nil, tn = nil) m = { l: id, d: d, f: f, tn: tn, content: { _content: eml } } m.compact! attrs = { m: m } SoapElement.mail(SoapMailConstants::ADD_MSG_REQUEST) .add_attributes(attrs) end |
#build_color ⇒ Object
69 70 71 |
# File 'lib/zm/client/folder/folder.rb', line 69 def build_color jsns_builder.to_color end |
#build_empty ⇒ Object
92 93 94 |
# File 'lib/zm/client/folder/folder.rb', line 92 def build_empty jsns_builder.to_empty end |
#color! ⇒ Object
64 65 66 67 |
# File 'lib/zm/client/folder/folder.rb', line 64 def color! @parent.soap_connector.invoke(build_color) true end |
#create! ⇒ Object
57 58 59 60 61 62 |
# File 'lib/zm/client/folder/folder.rb', line 57 def create! rep = @parent.soap_connector.invoke(build_create) json = rep[:CreateFolderResponse][:folder].first FolderJsnsInitializer.update(self, json) id end |
#delete! ⇒ Object
96 97 98 99 100 |
# File 'lib/zm/client/folder/folder.rb', line 96 def delete! return false if is_immutable? || id.nil? @parent.soap_connector.invoke(build_delete) end |
#download(dest_file_path, fmt: nil) ⇒ Object
151 152 153 154 |
# File 'lib/zm/client/folder/folder.rb', line 151 def download(dest_file_path, fmt: nil) uploader = @parent.build_uploader uploader.download_folder(dest_file_path, id, fmt:) end |
#empty! ⇒ Object Also known as: clear
84 85 86 87 88 89 |
# File 'lib/zm/client/folder/folder.rb', line 84 def empty! return false if empty? @parent.soap_connector.invoke(build_empty) @n = 0 end |
#empty? ⇒ Boolean
80 81 82 |
# File 'lib/zm/client/folder/folder.rb', line 80 def empty? @n.zero? end |
#grants ⇒ Object
35 36 37 38 39 |
# File 'lib/zm/client/folder/folder.rb', line 35 def grants return @grants if defined? @grants @grants = FolderGrantsCollection.new(self) end |
#is_immutable? ⇒ Boolean
47 48 49 50 51 |
# File 'lib/zm/client/folder/folder.rb', line 47 def is_immutable? return @is_immutable if defined? @is_immutable @is_immutable = Zm::Client::FolderDefault::IDS.include?(id.to_i) end |
#l ⇒ Object Also known as: folder_id
28 29 30 31 32 |
# File 'lib/zm/client/folder/folder.rb', line 28 def l return @l if defined? @l FolderDefault::ROOT.id end |
#reload! ⇒ Object
73 74 75 76 77 78 |
# File 'lib/zm/client/folder/folder.rb', line 73 def reload! rep = @parent.soap_connector.invoke(jsns_builder.to_find) json = rep[:GetFolderResponse][:folder].first FolderJsnsInitializer.update(self, json) true end |
#remove_flag!(pattern) ⇒ Object
102 103 104 105 |
# File 'lib/zm/client/folder/folder.rb', line 102 def remove_flag!(pattern) flags = f.tr(pattern, '') update!(f: flags) end |
#retention_policies ⇒ Object
41 42 43 44 45 |
# File 'lib/zm/client/folder/folder.rb', line 41 def retention_policies return @retention_policies if defined? @retention_policies @retention_policies = FolderRetentionPoliciesCollection.new(self) end |
#to_query ⇒ Object
53 54 55 |
# File 'lib/zm/client/folder/folder.rb', line 53 def to_query "inid:#{id}" end |
#upload(src_file_path, fmt: nil, resolve: nil) ⇒ Object
156 157 158 159 |
# File 'lib/zm/client/folder/folder.rb', line 156 def upload(src_file_path, fmt: nil, resolve: nil) uploader = @parent.build_uploader uploader.send_file(src_file_path, id, fmt:, type: view, resolve:) end |