zm-ruby-client 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +96 -0
- data/README.md +128 -27
- data/VERSION +1 -1
- data/lib/zm/client/account/account.rb +12 -19
- data/lib/zm/client/account/account_aliases_collection.rb +6 -4
- data/lib/zm/client/account/account_dls_membership_collection.rb +4 -3
- data/lib/zm/client/account/account_dls_owner_collection.rb +3 -2
- data/lib/zm/client/account/account_jsns_builder.rb +10 -10
- data/lib/zm/client/account/accounts_collection.rb +27 -16
- data/lib/zm/client/ace/ace.rb +3 -6
- data/lib/zm/client/ace/ace_jsns_builder.rb +6 -6
- data/lib/zm/client/appointment/appointment.rb +32 -14
- data/lib/zm/client/appointment/appointment_jsns_builder.rb +5 -5
- data/lib/zm/client/appointment/appointment_jsns_initializer.rb +6 -1
- data/lib/zm/client/appointment/appointments_collection.rb +12 -9
- data/lib/zm/client/backup/backup.rb +5 -2
- data/lib/zm/client/backup/backups_collection.rb +3 -2
- data/lib/zm/client/base/account_objects_collection.rb +1 -0
- data/lib/zm/client/base/account_search_objects_collection.rb +6 -6
- data/lib/zm/client/base/admin_objects_collection.rb +60 -7
- data/lib/zm/client/base/base_account_jsns_builder.rb +89 -87
- data/lib/zm/client/base/base_jsns_builder.rb +3 -3
- data/lib/zm/client/base/base_jsns_initializer.rb +20 -15
- data/lib/zm/client/base/mailbox_infos_collection.rb +92 -90
- data/lib/zm/client/base/mailbox_object.rb +49 -160
- data/lib/zm/client/base/mailbox_prefs_collection.rb +54 -52
- data/lib/zm/client/base/object.rb +19 -2
- data/lib/zm/client/base/objects_collection.rb +10 -10
- data/lib/zm/client/base/zimbra_attribute.rb +28 -42
- data/lib/zm/client/base/zimbra_attributes_collection.rb +38 -24
- data/lib/zm/client/{cluster/batch_request.rb → batch_request.rb} +1 -1
- data/lib/zm/client/cluster/cluster.rb +24 -61
- data/lib/zm/client/cluster/cluster_config.rb +35 -15
- data/lib/zm/client/contact/contact.rb +15 -13
- data/lib/zm/client/contact/contact_jsns_builder.rb +9 -6
- data/lib/zm/client/contact/contact_jsns_initializer.rb +2 -2
- data/lib/zm/client/contact/contact_member.rb +3 -3
- data/lib/zm/client/contact/contact_members_collection.rb +3 -3
- data/lib/zm/client/contact/contacts_builder.rb +1 -1
- data/lib/zm/client/contact/contacts_collection.rb +2 -2
- data/lib/zm/client/contact/group_contact_jsns_builder.rb +18 -14
- data/lib/zm/client/contact/mod_group_contact.rb +12 -8
- data/lib/zm/client/cos/cos.rb +15 -31
- data/lib/zm/client/cos/cos_jsns_builder.rb +21 -21
- data/lib/zm/client/cos/coses_collection.rb +11 -6
- data/lib/zm/client/datasource/datasource.rb +3 -9
- data/lib/zm/client/datasource/datasource_jsns_builder.rb +4 -4
- data/lib/zm/client/datasource/datasources_builder.rb +1 -1
- data/lib/zm/client/datasource/datasources_collection.rb +2 -2
- data/lib/zm/client/deprecated_constants.rb +36 -0
- data/lib/zm/client/distributionlist/distributionlist.rb +15 -47
- data/lib/zm/client/distributionlist/distributionlist_aces_collection.rb +4 -4
- data/lib/zm/client/distributionlist/distributionlist_aliases_collection.rb +7 -5
- data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +29 -41
- data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +14 -3
- data/lib/zm/client/distributionlist/distributionlist_members_collection.rb +14 -10
- data/lib/zm/client/distributionlist/distributionlist_owners_collection.rb +13 -13
- data/lib/zm/client/distributionlist/distributionlists_collection.rb +15 -7
- data/lib/zm/client/distributionlist/dls_membership_collection.rb +8 -6
- data/lib/zm/client/document/document.rb +5 -11
- data/lib/zm/client/document/document_jsns_builder.rb +2 -2
- data/lib/zm/client/document/documents_collection.rb +4 -4
- data/lib/zm/client/domain/domain.rb +8 -25
- data/lib/zm/client/domain/domain_jsns_builder.rb +13 -13
- data/lib/zm/client/domain/domains_collection.rb +13 -6
- data/lib/zm/client/filter_rules/filter_rules_collection.rb +1 -1
- data/lib/zm/client/filter_rules/outgoing_filter_rules_collection.rb +1 -1
- data/lib/zm/client/folder/folder.rb +34 -21
- data/lib/zm/client/folder/folder_default.rb +39 -0
- data/lib/zm/client/folder/folder_grant_jsns_builder.rb +3 -3
- data/lib/zm/client/folder/folder_grants_collection.rb +1 -1
- data/lib/zm/client/folder/folder_jsns_builder.rb +12 -12
- data/lib/zm/client/folder/folder_jsns_initializer.rb +1 -1
- data/lib/zm/client/folder/folder_retention_policies_collection.rb +6 -2
- data/lib/zm/client/folder/folder_view.rb +15 -0
- data/lib/zm/client/folder/folders_jsns_builder.rb +1 -1
- data/lib/zm/client/folder/mod_document_folder.rb +16 -12
- data/lib/zm/client/identity/identities_collection.rb +1 -1
- data/lib/zm/client/identity/identity.rb +3 -9
- data/lib/zm/client/identity/identity_jsns_builder.rb +8 -8
- data/lib/zm/client/{base/ldap_filter.rb → ldap_filter.rb} +1 -1
- data/lib/zm/client/license/licenses_collection.rb +1 -1
- data/lib/zm/client/mailbox/mailbox_item_concern.rb +0 -2
- data/lib/zm/client/message/message.rb +14 -19
- data/lib/zm/client/message/message_attachments_collection.rb +39 -0
- data/lib/zm/client/message/message_flags_collection.rb +130 -0
- data/lib/zm/client/message/message_jsns_builder.rb +4 -8
- data/lib/zm/client/message/message_jsns_initializer.rb +4 -4
- data/lib/zm/client/message/message_recipients.rb +19 -43
- data/lib/zm/client/message/messages_collection.rb +20 -4
- data/lib/zm/client/mountpoint/{mountpoint.rb → mount_point.rb} +4 -10
- data/lib/zm/client/mountpoint/{mountpoint_jsns_builder.rb → mount_point_jsns_builder.rb} +3 -3
- data/lib/zm/client/mountpoint/{mountpoint_jsns_initializer.rb → mount_point_jsns_initializer.rb} +1 -1
- data/lib/zm/client/mountpoint/{mountpoints_builder.rb → mount_points_builder.rb} +1 -1
- data/lib/zm/client/mta_queue/mta_queue.rb +4 -16
- data/lib/zm/client/mta_queue/mta_queue_action.rb +12 -0
- data/lib/zm/client/mta_queue/mta_queue_jsns_builder.rb +7 -7
- data/lib/zm/client/mta_queue/mta_queue_name.rb +14 -0
- data/lib/zm/client/mta_queue/mta_queues_collection.rb +4 -3
- data/lib/zm/client/mta_queue_item/mta_queue_items_collection.rb +1 -0
- data/lib/zm/client/recipient.rb +21 -0
- data/lib/zm/client/{common/recipients.rb → recipients.rb} +0 -16
- data/lib/zm/client/resource/resource.rb +3 -7
- data/lib/zm/client/resource/resource_jsns_builder.rb +13 -13
- data/lib/zm/client/resource/resources_collection.rb +20 -7
- data/lib/zm/client/search_folder/search_folder.rb +4 -11
- data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +6 -6
- data/lib/zm/client/search_folder/search_folders_collection.rb +1 -1
- data/lib/zm/client/server/server.rb +16 -22
- data/lib/zm/client/server/server_services.rb +26 -0
- data/lib/zm/client/server/servers_collection.rb +6 -6
- data/lib/zm/client/share/share.rb +2 -5
- data/lib/zm/client/share/shares_builder.rb +1 -1
- data/lib/zm/client/share/shares_collection.rb +5 -4
- data/lib/zm/client/signature/signature.rb +7 -13
- data/lib/zm/client/signature/signature_jsns_builder.rb +13 -13
- data/lib/zm/client/signature/signature_jsns_initializer.rb +2 -2
- data/lib/zm/client/signature/signatures_collection.rb +1 -1
- data/lib/zm/client/tag/account_object_tags_collection.rb +45 -47
- data/lib/zm/client/tag/tag.rb +3 -9
- data/lib/zm/client/tag/tag_jsns_builder.rb +3 -3
- data/lib/zm/client/tag/tags_builder.rb +1 -1
- data/lib/zm/client/tag/tags_collection.rb +2 -2
- data/lib/zm/client/task/task.rb +2 -2
- data/lib/zm/client/task/tasks_collection.rb +2 -2
- data/lib/zm/client/token.rb +4 -1
- data/lib/zm/client/upload.rb +179 -1
- data/lib/zm/client/{common/utils.rb → utils.rb} +6 -3
- data/lib/zm/client/zm_logger.rb +1 -1
- data/lib/zm/client.rb +227 -10
- data/lib/zm/connector/network_error_handler.rb +18 -0
- data/lib/zm/{client/connector → connector}/rest_connector.rb +46 -40
- data/lib/zm/{client/connector/soap_account.rb → connector/soap_account_connector.rb} +15 -17
- data/lib/zm/{client/connector/soap_admin.rb → connector/soap_admin_connector.rb} +3 -5
- data/lib/zm/connector/soap_base_connector.rb +115 -0
- data/lib/zm/connector.rb +13 -0
- data/lib/zm/error/auth_error.rb +8 -0
- data/lib/zm/error/connection_error.rb +8 -0
- data/lib/zm/error/rest_error.rb +8 -0
- data/lib/zm/{client/connector → error}/soap_error.rb +1 -10
- data/lib/zm/error/zm_error.rb +8 -0
- data/lib/zm/error.rb +11 -0
- data/lib/zm/relationship/has_many.rb +22 -0
- data/lib/zm/relationship/jsns_builder.rb +21 -0
- data/lib/zm/relationship/relationship.rb +113 -0
- data/lib/zm/relationship/schema.rb +32 -0
- data/lib/zm/relationship.rb +5 -0
- data/lib/zm/{client/soap_request → soap_request}/request_methods_admin.rb +11 -5
- data/lib/zm/{client/soap_request → soap_request}/request_methods_mailbox.rb +1 -1
- data/lib/zm/{client/soap_request/account_soap_constants.rb → soap_request/soap_account_constants.rb} +1 -1
- data/lib/zm/{client/soap_request/admin_soap_constants.rb → soap_request/soap_admin_constants.rb} +1 -1
- data/lib/zm/{client/soap_request → soap_request}/soap_constants.rb +1 -1
- data/lib/zm/{client/soap_request → soap_request}/soap_context.rb +13 -5
- data/lib/zm/{client/soap_request → soap_request}/soap_element.rb +1 -1
- data/lib/zm/{client/soap_request/mail_soap_constants.rb → soap_request/soap_mail_constants.rb} +1 -1
- data/lib/zm/soap_request.rb +14 -0
- data/lib/zm/support/cache/entry.rb +3 -3
- data/lib/zm/support/cache/file_store.rb +4 -6
- data/lib/zm/support/cache/null_store.rb +2 -4
- data/lib/zm/support/cache/store.rb +17 -9
- data/lib/zm/support/cache.rb +13 -8
- data/lib/zm/support.rb +7 -0
- data/lib/zm/{modules → utils}/belongs_to_folder.rb +1 -1
- data/lib/zm/{modules → utils}/belongs_to_tag.rb +2 -2
- data/lib/zm/utils/content_part.rb +9 -0
- data/lib/zm/utils/content_type.rb +11 -0
- data/lib/zm/{modules → utils}/has_soap_admin_connector.rb +1 -1
- data/lib/zm/utils/inspector.rb +26 -0
- data/lib/zm/utils/log_filter.rb +30 -0
- data/lib/zm/utils/missing_method_static_collection.rb +17 -0
- data/lib/zm/utils/regex.rb +11 -0
- data/lib/zm/utils/search_utils.rb +13 -0
- data/lib/zm/utils.rb +16 -0
- data/lib/zm-ruby-client.rb +12 -0
- data/sig/zm/client/admin_objects.rbs +261 -0
- data/sig/zm/client/base.rbs +191 -0
- data/sig/zm/client/cluster.rbs +152 -0
- data/sig/zm/client/mailbox.rbs +766 -0
- data/sig/zm/error.rbs +23 -0
- metadata +99 -91
- data/.gitignore +0 -59
- data/.rubocop.yml +0 -6
- data/.ruby-version +0 -1
- data/Gemfile +0 -11
- data/SECURITY.md +0 -21
- data/bin/console +0 -11
- data/lib/zm/client/account.rb +0 -9
- data/lib/zm/client/ace.rb +0 -7
- data/lib/zm/client/appointment.rb +0 -7
- data/lib/zm/client/backup.rb +0 -6
- data/lib/zm/client/base.rb +0 -21
- data/lib/zm/client/cluster.rb +0 -4
- data/lib/zm/client/common/message.rb +0 -10
- data/lib/zm/client/common.rb +0 -5
- data/lib/zm/client/connector/soap_base.rb +0 -104
- data/lib/zm/client/constant.rb +0 -229
- data/lib/zm/client/contact.rb +0 -11
- data/lib/zm/client/cos.rb +0 -10
- data/lib/zm/client/datasource.rb +0 -7
- data/lib/zm/client/distributionlist.rb +0 -8
- data/lib/zm/client/document.rb +0 -7
- data/lib/zm/client/domain.rb +0 -10
- data/lib/zm/client/filter_rule.rb +0 -7
- data/lib/zm/client/folder.rb +0 -14
- data/lib/zm/client/identity.rb +0 -7
- data/lib/zm/client/license.rb +0 -5
- data/lib/zm/client/message/attachments_collection.rb +0 -55
- data/lib/zm/client/message/message_flags.rb +0 -115
- data/lib/zm/client/message.rb +0 -10
- data/lib/zm/client/mountpoint.rb +0 -7
- data/lib/zm/client/mta_queue.rb +0 -7
- data/lib/zm/client/mta_queue_item.rb +0 -6
- data/lib/zm/client/resource.rb +0 -7
- data/lib/zm/client/search_folder.rb +0 -7
- data/lib/zm/client/server.rb +0 -7
- data/lib/zm/client/share.rb +0 -7
- data/lib/zm/client/signature.rb +0 -7
- data/lib/zm/client/soap_request.rb +0 -11
- data/lib/zm/client/tag.rb +0 -8
- data/lib/zm/client/task.rb +0 -6
- data/lib/zm/client/upload/upload.rb +0 -160
- data/lib/zm/modules/base.rb +0 -9
- data/lib/zm/modules/common/zimbra-attrs.json +0 -58
- data/lib/zm/modules/inspector.rb +0 -24
- data/lib/zm/modules/missing_method_static_collection.rb +0 -13
- data/lib/zm/modules/zm_model.rb +0 -43
- data/zm-ruby-client.gemspec +0 -27
- /data/lib/zm/client/mountpoint/{mountpoints_collection.rb → mount_points_collection.rb} +0 -0
|
@@ -4,26 +4,35 @@ module Zm
|
|
|
4
4
|
module Client
|
|
5
5
|
# class for account appointment
|
|
6
6
|
class Appointment < Base::Object
|
|
7
|
-
include BelongsToFolder
|
|
8
|
-
include BelongsToTag
|
|
9
|
-
include RequestMethodsMailbox
|
|
7
|
+
include Zm::Utils::BelongsToFolder
|
|
8
|
+
include Zm::Utils::BelongsToTag
|
|
9
|
+
include SoapRequest::RequestMethodsMailbox
|
|
10
10
|
include MailboxItemConcern
|
|
11
|
+
extend Zm::Relationship
|
|
12
|
+
has_jsns_builder
|
|
11
13
|
|
|
12
14
|
attr_accessor :uid, :name, :desc, :start_at, :dur, :end_at, :tn, :allDay, :organizer, :timezone,
|
|
13
|
-
:calItemId, :apptId, :invId, :rev, :fb, :transp
|
|
15
|
+
:calItemId, :apptId, :invId, :rev, :fb, :transp, :recur, :s, :ms, :f
|
|
14
16
|
attr_reader :recipients, :attendees, :body
|
|
15
17
|
|
|
16
18
|
alias description desc
|
|
19
|
+
alias recurrent recur
|
|
20
|
+
alias size s
|
|
17
21
|
|
|
18
22
|
def initialize(parent)
|
|
19
|
-
@parent = parent
|
|
20
23
|
@recipients = Recipients.new
|
|
21
24
|
@body = BodyMail.new
|
|
22
25
|
@attendees = Attendees.new
|
|
23
26
|
@allDay = false
|
|
24
27
|
@timezone = 'Europe/Berlin'
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
super
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def flags
|
|
33
|
+
return @flags if defined? @flags
|
|
34
|
+
|
|
35
|
+
@flags = f.chars
|
|
27
36
|
end
|
|
28
37
|
|
|
29
38
|
def download(dest_file_path, fmt: 'ics')
|
|
@@ -31,6 +40,11 @@ module Zm
|
|
|
31
40
|
uploader.download_file(dest_file_path, id, FolderView::APPOINTMENT, fmt:)
|
|
32
41
|
end
|
|
33
42
|
|
|
43
|
+
def read
|
|
44
|
+
uploader = @parent.build_uploader
|
|
45
|
+
uploader.read_file(id, FolderView::APPOINTMENT, fmt: 'ics')
|
|
46
|
+
end
|
|
47
|
+
|
|
34
48
|
def create!
|
|
35
49
|
rep = @parent.soap_connector.invoke(build_create)
|
|
36
50
|
|
|
@@ -41,12 +55,12 @@ module Zm
|
|
|
41
55
|
end
|
|
42
56
|
|
|
43
57
|
def build_create
|
|
44
|
-
SoapElement.mail(SoapMailConstants::CREATE_APPOINTMENT_REQUEST)
|
|
58
|
+
SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::CREATE_APPOINTMENT_REQUEST)
|
|
45
59
|
.add_attributes(jsns_builder.to_jsns)
|
|
46
60
|
end
|
|
47
61
|
|
|
48
62
|
def build_modify
|
|
49
|
-
SoapElement.mail(SoapMailConstants::MODIFY_APPOINTMENT_REQUEST)
|
|
63
|
+
SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::MODIFY_APPOINTMENT_REQUEST)
|
|
50
64
|
.add_attributes(jsns_builder.to_update)
|
|
51
65
|
end
|
|
52
66
|
|
|
@@ -63,9 +77,9 @@ module Zm
|
|
|
63
77
|
end
|
|
64
78
|
|
|
65
79
|
def reload!
|
|
66
|
-
jsns = { m: { id
|
|
80
|
+
jsns = { m: { id:, html: Zm::Utils::SearchUtils::ON } }
|
|
67
81
|
|
|
68
|
-
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
82
|
+
soap_request = SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::GET_MSG_REQUEST)
|
|
69
83
|
.add_attributes(jsns)
|
|
70
84
|
rep = @parent.soap_connector.invoke(soap_request)
|
|
71
85
|
entry = rep[:GetMsgResponse][:m].first
|
|
@@ -147,11 +161,15 @@ module Zm
|
|
|
147
161
|
end
|
|
148
162
|
end
|
|
149
163
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
@jsns_builder = AppointmentJsnsBuilder.new(self)
|
|
164
|
+
class BodyMail
|
|
165
|
+
attr_accessor :text, :html
|
|
154
166
|
end
|
|
167
|
+
|
|
168
|
+
# def jsns_builder
|
|
169
|
+
# return @jsns_builder if defined? @jsns_builder
|
|
170
|
+
#
|
|
171
|
+
# @jsns_builder = AppointmentJsnsBuilder.new(self)
|
|
172
|
+
# end
|
|
155
173
|
end
|
|
156
174
|
end
|
|
157
175
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Zm
|
|
4
4
|
module Client
|
|
5
5
|
# class for account appointment
|
|
6
|
-
class AppointmentJsnsBuilder < BaseAccountJsnsBuilder
|
|
6
|
+
class AppointmentJsnsBuilder < Base::BaseAccountJsnsBuilder
|
|
7
7
|
def to_jsns
|
|
8
8
|
{
|
|
9
9
|
m: {
|
|
@@ -22,7 +22,7 @@ module Zm
|
|
|
22
22
|
|
|
23
23
|
def to_update
|
|
24
24
|
jsns = to_jsns
|
|
25
|
-
jsns[:comp] =
|
|
25
|
+
jsns[:comp] = Zm::Utils::SearchUtils::OFF
|
|
26
26
|
jsns[:id] = @item.id
|
|
27
27
|
jsns[:m][:inv][:uid] = @item.uid
|
|
28
28
|
jsns
|
|
@@ -43,18 +43,18 @@ module Zm
|
|
|
43
43
|
def body_to_jsns
|
|
44
44
|
[
|
|
45
45
|
{
|
|
46
|
-
ct: ContentPart::ALTERNATIVE,
|
|
46
|
+
ct: Zm::Utils::ContentPart::ALTERNATIVE,
|
|
47
47
|
mp: [body_text_jsns, body_html_jsns]
|
|
48
48
|
}
|
|
49
49
|
]
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def body_text_jsns
|
|
53
|
-
{ ct: ContentType::TEXT, content: { _content: @item.body.text } }
|
|
53
|
+
{ ct: Zm::Utils::ContentType::TEXT, content: { _content: @item.body.text } }
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def body_html_jsns
|
|
57
|
-
{ ct: ContentType::HTML, content: { _content: @item.body.html } }
|
|
57
|
+
{ ct: Zm::Utils::ContentType::HTML, content: { _content: @item.body.html } }
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def comp_to_jsns
|
|
@@ -31,6 +31,11 @@ module Zm
|
|
|
31
31
|
@appointment.tn = @json.delete(:tn)
|
|
32
32
|
@appointment.l = @json.delete(:l)
|
|
33
33
|
@appointment.uid = @json.delete(:uid)
|
|
34
|
+
@appointment.recur = @json.delete(:recur) || false
|
|
35
|
+
@appointment.s = @json.delete(:s).to_i
|
|
36
|
+
@appointment.ms = @json.delete(:ms).to_i
|
|
37
|
+
@appointment.rev = @json.delete(:rev).to_i
|
|
38
|
+
@appointment.f = @json.delete(:f) || ''
|
|
34
39
|
|
|
35
40
|
if inv.nil?
|
|
36
41
|
init_from_search
|
|
@@ -108,7 +113,7 @@ module Zm
|
|
|
108
113
|
end
|
|
109
114
|
|
|
110
115
|
def comp
|
|
111
|
-
raise Zm::
|
|
116
|
+
raise Zm::Error::ZmError, 'invalid appointment received' if inv[:comp].nil?
|
|
112
117
|
|
|
113
118
|
@comp ||= inv[:comp].first
|
|
114
119
|
end
|
|
@@ -8,14 +8,14 @@ module Zm
|
|
|
8
8
|
super
|
|
9
9
|
@child_class = Appointment
|
|
10
10
|
@builder_class = AppointmentsBuilder
|
|
11
|
-
@type = SoapConstants::APPOINTMENT
|
|
12
|
-
@sort_by = SoapConstants::DATE_ASC
|
|
11
|
+
@type = SoapRequest::SoapConstants::APPOINTMENT
|
|
12
|
+
@sort_by = SoapRequest::SoapConstants::DATE_ASC
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def find(id)
|
|
16
|
-
jsns = { m: { id
|
|
16
|
+
jsns = { m: { id:, html: Zm::Utils::SearchUtils::ON } }
|
|
17
17
|
|
|
18
|
-
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
18
|
+
soap_request = SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::GET_MSG_REQUEST)
|
|
19
19
|
.add_attributes(jsns)
|
|
20
20
|
rep = @parent.soap_connector.invoke(soap_request)
|
|
21
21
|
entry = rep[:GetMsgResponse][:m].first
|
|
@@ -23,16 +23,19 @@ module Zm
|
|
|
23
23
|
AppointmentJsnsInitializer.new(@parent, entry).create
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
def find_each(offset: 0, limit: 500, &
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
def find_each(offset: 0, limit: 500, start_year: nil, end_year: nil, &)
|
|
27
|
+
start_year ||= Time.now.year - 10
|
|
28
|
+
end_year ||= Time.now.year + 10
|
|
29
|
+
|
|
30
|
+
(start_year..end_year).each do |year|
|
|
31
|
+
@start_at = Time.new(year, 1, 1).to_i * 1000
|
|
32
|
+
@end_at = Time.new(year, 12, 31).to_i * 1000
|
|
30
33
|
@more = true
|
|
31
34
|
@offset = offset
|
|
32
35
|
@limit = limit
|
|
33
36
|
|
|
34
37
|
while @more
|
|
35
|
-
build_response.each
|
|
38
|
+
build_response.each(&)
|
|
36
39
|
@offset += @limit
|
|
37
40
|
end
|
|
38
41
|
end
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
module Zm
|
|
4
4
|
module Client
|
|
5
5
|
class Backup < Base::Object
|
|
6
|
+
FULL = 'full'
|
|
7
|
+
INCREMENTAL = 'incremental'
|
|
8
|
+
|
|
6
9
|
attr_accessor :label, :type, :aborted, :start, :end, :minRedoSeq, :maxRedoSeq, :live, :accounts
|
|
7
10
|
|
|
8
11
|
alias name label
|
|
@@ -28,11 +31,11 @@ module Zm
|
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
def full?
|
|
31
|
-
@type ==
|
|
34
|
+
@type == FULL
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
def incremental?
|
|
35
|
-
@type ==
|
|
38
|
+
@type == INCREMENTAL
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
41
|
end
|
|
@@ -5,14 +5,15 @@ module Zm
|
|
|
5
5
|
# Collection Backups
|
|
6
6
|
class BackupsCollection < Base::ObjectsCollection
|
|
7
7
|
def initialize(parent)
|
|
8
|
+
super()
|
|
8
9
|
@parent = parent
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
private
|
|
12
13
|
|
|
13
14
|
def make_query
|
|
14
|
-
soap_request = SoapElement.admin(SoapAdminConstants::BACKUP_QUERY_REQUEST)
|
|
15
|
-
.add_attribute(SoapConstants::QUERY, {})
|
|
15
|
+
soap_request = Zm::SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::BACKUP_QUERY_REQUEST)
|
|
16
|
+
.add_attribute(Zm::SoapRequest::SoapConstants::QUERY, {})
|
|
16
17
|
sac.target_invoke(soap_request, @parent.id)
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -21,8 +21,8 @@ module Zm
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def build_find(id)
|
|
24
|
-
SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
25
|
-
.add_attributes({ m: { id
|
|
24
|
+
SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::GET_MSG_REQUEST)
|
|
25
|
+
.add_attributes({ m: { id:, html: Zm::Utils::SearchUtils::ON } })
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def start_at(start_at)
|
|
@@ -92,7 +92,7 @@ module Zm
|
|
|
92
92
|
offset: @offset,
|
|
93
93
|
limit: @limit,
|
|
94
94
|
sortBy: @sort_by,
|
|
95
|
-
query
|
|
95
|
+
query:,
|
|
96
96
|
header: @headers
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ module Zm
|
|
|
100
100
|
|
|
101
101
|
jsns.compact!
|
|
102
102
|
|
|
103
|
-
SoapElement.mail(SoapMailConstants::SEARCH_REQUEST)
|
|
103
|
+
SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::SEARCH_REQUEST)
|
|
104
104
|
.add_attributes(jsns)
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -112,8 +112,8 @@ module Zm
|
|
|
112
112
|
|
|
113
113
|
attrs.compact!
|
|
114
114
|
|
|
115
|
-
soap_request = SoapElement.mail(SoapMailConstants::ITEM_ACTION_REQUEST)
|
|
116
|
-
node_action = SoapElement.create(SoapConstants::ACTION).add_attributes(attrs)
|
|
115
|
+
soap_request = SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::ITEM_ACTION_REQUEST)
|
|
116
|
+
node_action = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACTION).add_attributes(attrs)
|
|
117
117
|
soap_request.add_node(node_action)
|
|
118
118
|
@parent.soap_connector.invoke(soap_request)
|
|
119
119
|
end
|
|
@@ -5,7 +5,10 @@ module Zm
|
|
|
5
5
|
module Base
|
|
6
6
|
# Collection AdminObjectsCollection
|
|
7
7
|
class AdminObjectsCollection < ObjectsCollection
|
|
8
|
+
ONERRORS = %w[continue stop].freeze
|
|
9
|
+
|
|
8
10
|
def initialize(parent)
|
|
11
|
+
super()
|
|
9
12
|
@parent = parent
|
|
10
13
|
@persistent = false
|
|
11
14
|
reset_query_params
|
|
@@ -15,14 +18,14 @@ module Zm
|
|
|
15
18
|
find_by!(hash)
|
|
16
19
|
end
|
|
17
20
|
|
|
18
|
-
def find_by_or_nil(hash, error_handler = SoapError)
|
|
21
|
+
def find_by_or_nil(hash, error_handler = Zm::Error::SoapError)
|
|
19
22
|
find_by(hash)
|
|
20
23
|
rescue error_handler => _e
|
|
21
24
|
nil
|
|
22
25
|
end
|
|
23
26
|
|
|
24
27
|
def ldap
|
|
25
|
-
@apply_cos =
|
|
28
|
+
@apply_cos = Zm::Utils::SearchUtils::OFF
|
|
26
29
|
self
|
|
27
30
|
end
|
|
28
31
|
|
|
@@ -47,9 +50,9 @@ module Zm
|
|
|
47
50
|
|
|
48
51
|
def count
|
|
49
52
|
reset_query_params
|
|
50
|
-
@count_only =
|
|
53
|
+
@count_only = Zm::Utils::SearchUtils::ON
|
|
51
54
|
json = make_query
|
|
52
|
-
@count_only =
|
|
55
|
+
@count_only = Zm::Utils::SearchUtils::OFF
|
|
53
56
|
json[:SearchDirectoryResponse][:num]
|
|
54
57
|
end
|
|
55
58
|
|
|
@@ -59,7 +62,7 @@ module Zm
|
|
|
59
62
|
self
|
|
60
63
|
end
|
|
61
64
|
|
|
62
|
-
def find_each(offset: 0, limit: 1_000, &
|
|
65
|
+
def find_each(offset: 0, limit: 1_000, &)
|
|
63
66
|
previous_persistent = @persistent.dup
|
|
64
67
|
@persistent = true
|
|
65
68
|
|
|
@@ -71,7 +74,7 @@ module Zm
|
|
|
71
74
|
@limit = limit
|
|
72
75
|
|
|
73
76
|
while @offset < total
|
|
74
|
-
build_response.each
|
|
77
|
+
build_response.each(&)
|
|
75
78
|
@offset += @limit
|
|
76
79
|
end
|
|
77
80
|
|
|
@@ -88,12 +91,62 @@ module Zm
|
|
|
88
91
|
end
|
|
89
92
|
|
|
90
93
|
def build_query
|
|
91
|
-
SoapElement.admin(SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
|
|
94
|
+
SoapRequest::SoapElement.admin(Zm::SoapRequest::SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
|
|
92
95
|
.add_attributes(jsns)
|
|
93
96
|
end
|
|
94
97
|
|
|
98
|
+
def update_all!(hash = nil, onerror: ONERRORS.first, update_attributes: true, **attrs)
|
|
99
|
+
mass_update!(build_response, hash, onerror:, update_attributes:, **attrs)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def mass_update!(items, hash = nil, onerror: ONERRORS.first, update_attributes: true, **attrs)
|
|
103
|
+
hash = hash.nil? ? attrs : hash.merge(attrs)
|
|
104
|
+
format_mass_items_parameter(items)
|
|
105
|
+
|
|
106
|
+
items.each do |item|
|
|
107
|
+
item.update!(hash, update_attributes:)
|
|
108
|
+
rescue Zm::Error::SoapError => e
|
|
109
|
+
@parent.logger.error e.message
|
|
110
|
+
@parent.logger.debug e.backtrace.join("\n")
|
|
111
|
+
|
|
112
|
+
return items if onerror == ONERRORS.last
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
items
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def delete_all!(onerror: ONERRORS.first)
|
|
119
|
+
mass_delete!(build_response, onerror:)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def mass_delete!(items, onerror: ONERRORS.first)
|
|
123
|
+
format_mass_items_parameter(items)
|
|
124
|
+
|
|
125
|
+
items.each do |item|
|
|
126
|
+
item.delete!
|
|
127
|
+
rescue Zm::Error::SoapError => e
|
|
128
|
+
@parent.logger.error e.message
|
|
129
|
+
@parent.logger.debug e.backtrace.join("\n")
|
|
130
|
+
|
|
131
|
+
return items if onerror == ONERRORS.last
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
items
|
|
135
|
+
end
|
|
136
|
+
|
|
95
137
|
private
|
|
96
138
|
|
|
139
|
+
def format_mass_items_parameter(items)
|
|
140
|
+
items.map! do |item|
|
|
141
|
+
if item.is_a?(@child_class)
|
|
142
|
+
item.updated = false
|
|
143
|
+
item
|
|
144
|
+
else
|
|
145
|
+
new { |acc| acc.id = item }
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
97
150
|
def ldap_filter
|
|
98
151
|
return @ldap_filter if defined? @ldap_filter
|
|
99
152
|
|
|
@@ -2,93 +2,95 @@
|
|
|
2
2
|
|
|
3
3
|
module Zm
|
|
4
4
|
module Client
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tag_name
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
new_folder_id
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
new_name
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
5
|
+
module Base
|
|
6
|
+
# class for account tag jsns builder
|
|
7
|
+
class BaseAccountJsnsBuilder
|
|
8
|
+
def initialize(item)
|
|
9
|
+
@item = item
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_tag(tag_name = nil)
|
|
13
|
+
tag_name ||= @item.tn
|
|
14
|
+
|
|
15
|
+
attrs = {
|
|
16
|
+
op: :tag,
|
|
17
|
+
id: @item.id,
|
|
18
|
+
tn: tag_name
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
build(attrs)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_move(new_folder_id = nil)
|
|
25
|
+
new_folder_id ||= @item.l
|
|
26
|
+
|
|
27
|
+
attrs = {
|
|
28
|
+
op: :move,
|
|
29
|
+
id: @item.id,
|
|
30
|
+
l: new_folder_id
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
build(attrs)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_patch(hash)
|
|
37
|
+
attrs = {
|
|
38
|
+
op: :update,
|
|
39
|
+
id: @item.id
|
|
40
|
+
}.merge(hash)
|
|
41
|
+
|
|
42
|
+
attrs.compact!
|
|
43
|
+
|
|
44
|
+
build(attrs)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def to_delete
|
|
48
|
+
attrs = {
|
|
49
|
+
op: :delete,
|
|
50
|
+
id: @item.id
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
build(attrs)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def to_rename(new_name = nil)
|
|
57
|
+
new_name ||= @item.name
|
|
58
|
+
|
|
59
|
+
attrs = {
|
|
60
|
+
op: :rename,
|
|
61
|
+
id: @item.id,
|
|
62
|
+
name: new_name
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
build(attrs)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def to_color
|
|
69
|
+
attrs = {
|
|
70
|
+
op: :color,
|
|
71
|
+
id: @item.id,
|
|
72
|
+
rgb: @item.rgb,
|
|
73
|
+
color: @item.color
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
build(attrs)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def to_trash
|
|
80
|
+
attrs = {
|
|
81
|
+
op: :trash,
|
|
82
|
+
id: @item.id
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
build(attrs)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def build(attrs)
|
|
89
|
+
soap_request = SoapRequest::SoapElement.mail(SoapRequest::SoapMailConstants::ITEM_ACTION_REQUEST)
|
|
90
|
+
node_action = SoapRequest::SoapElement.create(SoapRequest::SoapConstants::ACTION).add_attributes(attrs)
|
|
91
|
+
soap_request.add_node(node_action)
|
|
92
|
+
soap_request
|
|
93
|
+
end
|
|
92
94
|
end
|
|
93
95
|
end
|
|
94
96
|
end
|
|
@@ -15,7 +15,7 @@ module Zm
|
|
|
15
15
|
def to_jsns
|
|
16
16
|
{
|
|
17
17
|
name: @item.name,
|
|
18
|
-
a: instance_variables_array.
|
|
18
|
+
a: instance_variables_array.flat_map(&A_ARRAY_PROC).map(&A_NODE_PROC)
|
|
19
19
|
}
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -24,14 +24,14 @@ module Zm
|
|
|
24
24
|
def to_update
|
|
25
25
|
{
|
|
26
26
|
id: @item.id,
|
|
27
|
-
a: instance_variables_array.
|
|
27
|
+
a: instance_variables_array.flat_map(&A_ARRAY_PROC).map(&A_NODE_PROC)
|
|
28
28
|
}
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def to_patch(hash)
|
|
32
32
|
{
|
|
33
33
|
id: @item.id,
|
|
34
|
-
a: hash.
|
|
34
|
+
a: hash.flat_map(&A_ARRAY_PROC).map(&A_NODE_PROC)
|
|
35
35
|
}
|
|
36
36
|
end
|
|
37
37
|
|