zm-ruby-client 2.2.7 → 3.0.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/.rubocop.yml +6 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +10 -6
- data/Gemfile +1 -6
- data/README.md +10 -15
- data/VERSION +1 -1
- data/lib/zm/client/account/account.rb +35 -22
- data/lib/zm/client/account/account_aliases_collection.rb +14 -6
- data/lib/zm/client/account/account_dls_membership_collection.rb +10 -4
- data/lib/zm/client/account/account_dls_owner_collection.rb +8 -5
- data/lib/zm/client/account/account_jsns_builder.rb +31 -19
- data/lib/zm/client/account/account_jsns_initializer.rb +4 -14
- data/lib/zm/client/account/accounts_builder.rb +1 -1
- data/lib/zm/client/account/accounts_collection.rb +15 -8
- data/lib/zm/client/ace/ace.rb +5 -5
- data/lib/zm/client/ace/ace_jsns_builder.rb +8 -8
- data/lib/zm/client/ace/ace_jsns_initializer.rb +7 -7
- data/lib/zm/client/ace/aces_builder.rb +1 -1
- data/lib/zm/client/ace/aces_collection.rb +2 -2
- data/lib/zm/client/appointment/appointment.rb +27 -24
- data/lib/zm/client/appointment/appointment_jsns_builder.rb +29 -20
- data/lib/zm/client/appointment/appointment_jsns_initializer.rb +14 -13
- data/lib/zm/client/appointment/appointments_builder.rb +1 -1
- data/lib/zm/client/appointment/appointments_collection.rb +8 -7
- data/lib/zm/client/backup/backup.rb +6 -2
- data/lib/zm/client/backup/backup_jsns_initializer.rb +14 -12
- data/lib/zm/client/backup/backups_builder.rb +1 -1
- data/lib/zm/client/backup/backups_collection.rb +2 -1
- data/lib/zm/client/base/account_search_objects_collection.rb +46 -20
- data/lib/zm/client/base/admin_objects_collection.rb +22 -27
- data/lib/zm/client/base/base_account_jsns_builder.rb +1 -4
- data/lib/zm/client/base/base_jsns_initializer.rb +8 -8
- data/lib/zm/client/base/mailbox_infos_collection.rb +23 -15
- data/lib/zm/client/base/mailbox_object.rb +174 -69
- data/lib/zm/client/base/mailbox_prefs_collection.rb +4 -8
- data/lib/zm/client/base/object.rb +2 -2
- data/lib/zm/client/base/objects_builder.rb +7 -3
- data/lib/zm/client/base/objects_collection.rb +4 -13
- data/lib/zm/client/base/zimbra_attribute.rb +4 -17
- data/lib/zm/client/base/zimbra_attributes_collection.rb +16 -9
- data/lib/zm/client/base.rb +0 -1
- data/lib/zm/client/cluster/batch_request.rb +50 -0
- data/lib/zm/client/cluster/cluster.rb +49 -27
- data/lib/zm/client/cluster/cluster_config.rb +129 -40
- data/lib/zm/client/common/recipients.rb +2 -2
- data/lib/zm/client/common/utils.rb +1 -13
- data/lib/zm/client/common.rb +0 -1
- data/lib/zm/client/connector/{rest_account.rb → rest_connector.rb} +40 -50
- data/lib/zm/client/connector/soap_account.rb +19 -15
- data/lib/zm/client/connector/soap_admin.rb +9 -9
- data/lib/zm/client/connector/soap_base.rb +24 -17
- data/lib/zm/client/connector/soap_error.rb +3 -23
- data/lib/zm/client/constant.rb +18 -16
- data/lib/zm/client/contact/contact.rb +21 -40
- data/lib/zm/client/contact/contact_jsns_builder.rb +1 -1
- data/lib/zm/client/contact/contact_jsns_initializer.rb +4 -26
- data/lib/zm/client/contact/contacts_builder.rb +1 -1
- data/lib/zm/client/contact/contacts_collection.rb +4 -24
- data/lib/zm/client/contact/group_contact_jsns_builder.rb +18 -13
- data/lib/zm/client/contact/mod_group_contact.rb +6 -2
- data/lib/zm/client/cos/cos.rb +35 -11
- data/lib/zm/client/cos/cos_domains_collection.rb +1 -1
- data/lib/zm/client/cos/cos_jsns_builder.rb +22 -9
- data/lib/zm/client/cos/cos_jsns_initializer.rb +2 -6
- data/lib/zm/client/cos/cos_servers_collection.rb +5 -6
- data/lib/zm/client/cos/coses_builder.rb +1 -1
- data/lib/zm/client/cos/coses_collection.rb +6 -4
- data/lib/zm/client/datasource/datasource.rb +27 -34
- data/lib/zm/client/datasource/datasource_jsns_builder.rb +1 -1
- data/lib/zm/client/datasource/datasource_jsns_initializer.rb +5 -6
- data/lib/zm/client/datasource/datasources_builder.rb +6 -9
- data/lib/zm/client/datasource/datasources_collection.rb +6 -5
- data/lib/zm/client/distributionlist/distributionlist.rb +22 -42
- data/lib/zm/client/distributionlist/distributionlist_aliases_collection.rb +14 -6
- data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +20 -16
- data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +2 -11
- data/lib/zm/client/distributionlist/distributionlist_members_collection.rb +20 -12
- data/lib/zm/client/distributionlist/distributionlist_owners_collection.rb +16 -5
- data/lib/zm/client/distributionlist/distributionlists_builder.rb +1 -1
- data/lib/zm/client/distributionlist/distributionlists_collection.rb +12 -6
- data/lib/zm/client/distributionlist/dls_membership_collection.rb +12 -6
- data/lib/zm/client/document/document.rb +16 -8
- data/lib/zm/client/document/document_jsns_builder.rb +1 -1
- data/lib/zm/client/document/document_jsns_initializer.rb +27 -26
- data/lib/zm/client/document/documents_builder.rb +1 -1
- data/lib/zm/client/document/documents_collection.rb +1 -1
- data/lib/zm/client/domain/domain.rb +18 -37
- data/lib/zm/client/domain/domain_accounts_collection.rb +1 -1
- data/lib/zm/client/domain/domain_distributionlists_collection.rb +1 -1
- data/lib/zm/client/domain/domain_jsns_builder.rb +18 -9
- data/lib/zm/client/domain/domain_jsns_initializer.rb +2 -6
- data/lib/zm/client/domain/domain_resources_collection.rb +1 -1
- data/lib/zm/client/domain/domains_builder.rb +1 -1
- data/lib/zm/client/domain/domains_collection.rb +12 -6
- data/lib/zm/client/filter_rules/filter_rule.rb +0 -9
- data/lib/zm/client/filter_rules/filter_rule_jsns_initializer.rb +7 -6
- data/lib/zm/client/filter_rules/filter_rules_builder.rb +1 -1
- data/lib/zm/client/filter_rules/filter_rules_collection.rb +5 -15
- data/lib/zm/client/filter_rules/outgoing_filter_rules_collection.rb +5 -2
- data/lib/zm/client/folder/folder.rb +73 -56
- data/lib/zm/client/folder/folder_grant.rb +7 -5
- data/lib/zm/client/folder/folder_grant_jsns_builder.rb +6 -3
- data/lib/zm/client/folder/folder_grants_collection.rb +2 -4
- data/lib/zm/client/folder/folder_jsns_builder.rb +14 -7
- data/lib/zm/client/folder/folder_jsns_initializer.rb +58 -40
- data/lib/zm/client/folder/folder_retention_policies_collection.rb +4 -2
- data/lib/zm/client/folder/folders_builder.rb +1 -1
- data/lib/zm/client/folder/folders_collection.rb +21 -18
- data/lib/zm/client/folder/folders_jsns_builder.rb +4 -2
- data/lib/zm/client/folder/mod_document_folder.rb +5 -4
- data/lib/zm/client/identity/identities_builder.rb +1 -1
- data/lib/zm/client/identity/identities_collection.rb +6 -5
- data/lib/zm/client/identity/identity.rb +9 -29
- data/lib/zm/client/identity/identity_jsns_builder.rb +8 -4
- data/lib/zm/client/identity/identity_jsns_initializer.rb +5 -4
- data/lib/zm/client/license/license.rb +7 -1
- data/lib/zm/client/license/license_jsns_initializer.rb +8 -5
- data/lib/zm/client/license/licenses_collection.rb +1 -1
- data/lib/zm/client/mailbox/mailbox_item_concern.rb +33 -0
- data/lib/zm/client/mailbox/mailbox_item_id.rb +7 -0
- data/lib/zm/client/message/attachments_collection.rb +2 -2
- data/lib/zm/client/message/message.rb +56 -52
- data/lib/zm/client/message/message_flags.rb +21 -13
- data/lib/zm/client/message/message_jsns_builder.rb +11 -6
- data/lib/zm/client/message/message_jsns_initializer.rb +24 -23
- data/lib/zm/client/message/messages_builder.rb +1 -1
- data/lib/zm/client/message/messages_collection.rb +1 -15
- data/lib/zm/client/mountpoint/mountpoint.rb +17 -25
- data/lib/zm/client/mountpoint/mountpoint_jsns_builder.rb +6 -3
- data/lib/zm/client/mountpoint/mountpoint_jsns_initializer.rb +25 -24
- data/lib/zm/client/mountpoint/mountpoints_builder.rb +1 -1
- data/lib/zm/client/mountpoint/mountpoints_collection.rb +13 -9
- data/lib/zm/client/mta_queue/mta_queue.rb +6 -2
- data/lib/zm/client/mta_queue/mta_queue_jsns_initializer.rb +3 -7
- data/lib/zm/client/mta_queue/mta_queues_builder.rb +3 -1
- data/lib/zm/client/mta_queue_item/mta_queue_item.rb +5 -3
- data/lib/zm/client/mta_queue_item/mta_queue_item_jsns_initializer.rb +1 -5
- data/lib/zm/client/mta_queue_item/mta_queue_items_builder.rb +3 -1
- data/lib/zm/client/mta_queue_item/mta_queue_items_collection.rb +3 -1
- data/lib/zm/client/resource/resource.rb +6 -18
- data/lib/zm/client/resource/resource_jsns_builder.rb +20 -13
- data/lib/zm/client/resource/resource_jsns_initializer.rb +4 -14
- data/lib/zm/client/resource/resources_builder.rb +1 -1
- data/lib/zm/client/resource/resources_collection.rb +12 -7
- data/lib/zm/client/search_folder/search_folder.rb +13 -29
- data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +6 -6
- data/lib/zm/client/search_folder/search_folder_jsns_initializer.rb +19 -18
- data/lib/zm/client/search_folder/search_folders_builder.rb +1 -1
- data/lib/zm/client/search_folder/search_folders_collection.rb +6 -5
- data/lib/zm/client/server/server.rb +9 -3
- data/lib/zm/client/server/server_accounts_collection.rb +4 -2
- data/lib/zm/client/server/server_jsns_initializer.rb +1 -5
- data/lib/zm/client/server/servers_builder.rb +1 -1
- data/lib/zm/client/server/servers_collection.rb +17 -9
- data/lib/zm/client/share/share.rb +5 -3
- data/lib/zm/client/share/share_jsns_initializer.rb +15 -14
- data/lib/zm/client/share/share_mountpoints_collection.rb +3 -6
- data/lib/zm/client/share/shares_builder.rb +1 -1
- data/lib/zm/client/share/shares_collection.rb +6 -3
- data/lib/zm/client/signature/signature.rb +6 -21
- data/lib/zm/client/signature/signature_jsns_builder.rb +12 -7
- data/lib/zm/client/signature/signature_jsns_initializer.rb +5 -4
- data/lib/zm/client/signature/signatures_builder.rb +1 -1
- data/lib/zm/client/signature/signatures_collection.rb +6 -5
- data/lib/zm/client/soap_request/request_methods_admin.rb +56 -0
- data/lib/zm/client/soap_request/request_methods_mailbox.rb +60 -0
- data/lib/zm/client/soap_request/soap_constants.rb +7 -0
- data/lib/zm/client/soap_request/soap_context.rb +11 -2
- data/lib/zm/client/soap_request.rb +3 -0
- data/lib/zm/client/tag/account_object_tags_collection.rb +11 -9
- data/lib/zm/client/tag/tag.rb +8 -44
- data/lib/zm/client/tag/tag_jsns_builder.rb +4 -2
- data/lib/zm/client/tag/tag_jsns_initializer.rb +7 -6
- data/lib/zm/client/tag/tags_builder.rb +1 -1
- data/lib/zm/client/tag/tags_collection.rb +6 -5
- data/lib/zm/client/task/task.rb +6 -5
- data/lib/zm/client/task/task_jsns_initializer.rb +28 -27
- data/lib/zm/client/task/tasks_builder.rb +1 -1
- data/lib/zm/client/task/tasks_collection.rb +2 -2
- data/lib/zm/client/token.rb +52 -0
- data/lib/zm/client/upload/upload.rb +101 -95
- data/lib/zm/client/zm_logger.rb +83 -0
- data/lib/zm/client.rb +6 -1
- data/lib/zm/modules/base.rb +0 -1
- data/lib/zm/modules/belongs_to_folder.rb +6 -7
- data/lib/zm/modules/belongs_to_tag.rb +3 -1
- data/lib/zm/modules/common/zimbra-attrs.csv +3 -4
- data/lib/zm/modules/inspector.rb +2 -2
- data/lib/zm/modules/missing_method_static_collection.rb +2 -2
- data/lib/zm/support/cache/entry.rb +63 -0
- data/lib/zm/support/cache/file_store.rb +141 -0
- data/lib/zm/support/cache/null_store.rb +43 -0
- data/lib/zm/support/cache/request_strategy.rb +10 -0
- data/lib/zm/support/cache/store.rb +197 -0
- data/lib/zm/support/cache/strategy.rb +13 -0
- data/lib/zm/support/cache.rb +26 -0
- data/lib/zm-ruby-client.rb +2 -2
- data/zm-ruby-client.gemspec +10 -15
- metadata +37 -36
- data/lib/zm/client/common/token_metadata.rb +0 -44
- data/lib/zm/modules/zm_logger.rb +0 -26
|
@@ -6,8 +6,10 @@ module Zm
|
|
|
6
6
|
class Appointment < Base::Object
|
|
7
7
|
include BelongsToFolder
|
|
8
8
|
include BelongsToTag
|
|
9
|
+
include RequestMethodsMailbox
|
|
10
|
+
include MailboxItemConcern
|
|
9
11
|
|
|
10
|
-
attr_accessor :
|
|
12
|
+
attr_accessor :uid, :name, :desc, :start_at, :dur, :end_at, :tn, :allDay, :organizer, :timezone,
|
|
11
13
|
:calItemId, :apptId, :invId, :rev, :fb, :transp
|
|
12
14
|
attr_reader :recipients, :attendees, :body
|
|
13
15
|
|
|
@@ -24,25 +26,28 @@ module Zm
|
|
|
24
26
|
yield(self) if block_given?
|
|
25
27
|
end
|
|
26
28
|
|
|
27
|
-
def download(dest_file_path, fmt
|
|
28
|
-
uploader =
|
|
29
|
-
uploader.download_file(
|
|
29
|
+
def download(dest_file_path, fmt: 'ics')
|
|
30
|
+
uploader = @parent.build_uploader
|
|
31
|
+
uploader.download_file(dest_file_path, id, FolderView::APPOINTMENT, fmt:)
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
def create!
|
|
33
|
-
|
|
34
|
-
rep = @parent.sacc.invoke(soap_request)
|
|
35
|
+
rep = @parent.soap_connector.invoke(build_create)
|
|
35
36
|
|
|
36
37
|
aji = AppointmentJsnsInitializer.new(@parent, rep[:CreateAppointmentResponse])
|
|
37
38
|
aji.appointment = self
|
|
38
39
|
aji.update
|
|
39
|
-
|
|
40
|
+
id
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
def
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
def build_create
|
|
44
|
+
SoapElement.mail(SoapMailConstants::CREATE_APPOINTMENT_REQUEST)
|
|
45
|
+
.add_attributes(jsns_builder.to_jsns)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def build_modify
|
|
49
|
+
SoapElement.mail(SoapMailConstants::MODIFY_APPOINTMENT_REQUEST)
|
|
50
|
+
.add_attributes(jsns_builder.to_update)
|
|
46
51
|
end
|
|
47
52
|
|
|
48
53
|
def update!(*args)
|
|
@@ -53,18 +58,16 @@ module Zm
|
|
|
53
58
|
raise NotImplementedError
|
|
54
59
|
end
|
|
55
60
|
|
|
56
|
-
def
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
@parent.sacc.invoke(jsns_builder.to_delete)
|
|
60
|
-
@id = nil
|
|
61
|
+
def build_rename(*args)
|
|
62
|
+
raise NotImplementedError
|
|
61
63
|
end
|
|
62
64
|
|
|
63
65
|
def reload!
|
|
64
|
-
jsns = { m: { id:
|
|
66
|
+
jsns = { m: { id: id, html: SoapUtils::ON } }
|
|
65
67
|
|
|
66
|
-
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
67
|
-
|
|
68
|
+
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
69
|
+
.add_attributes(jsns)
|
|
70
|
+
rep = @parent.soap_connector.invoke(soap_request)
|
|
68
71
|
entry = rep[:GetMsgResponse][:m].first
|
|
69
72
|
|
|
70
73
|
aji = AppointmentJsnsInitializer.new(@parent, entry)
|
|
@@ -107,8 +110,8 @@ module Zm
|
|
|
107
110
|
@attendees = []
|
|
108
111
|
end
|
|
109
112
|
|
|
110
|
-
def map(&
|
|
111
|
-
@attendees.map(&
|
|
113
|
+
def map(&)
|
|
114
|
+
@attendees.map(&)
|
|
112
115
|
end
|
|
113
116
|
|
|
114
117
|
def add(attendee)
|
|
@@ -144,10 +147,10 @@ module Zm
|
|
|
144
147
|
end
|
|
145
148
|
end
|
|
146
149
|
|
|
147
|
-
private
|
|
148
|
-
|
|
149
150
|
def jsns_builder
|
|
150
|
-
@jsns_builder
|
|
151
|
+
return @jsns_builder if defined? @jsns_builder
|
|
152
|
+
|
|
153
|
+
@jsns_builder = AppointmentJsnsBuilder.new(self)
|
|
151
154
|
end
|
|
152
155
|
end
|
|
153
156
|
end
|
|
@@ -22,7 +22,7 @@ module Zm
|
|
|
22
22
|
|
|
23
23
|
def to_update
|
|
24
24
|
jsns = to_jsns
|
|
25
|
-
jsns[:comp] =
|
|
25
|
+
jsns[:comp] = SoapUtils::OFF
|
|
26
26
|
jsns[:id] = @item.id
|
|
27
27
|
jsns[:m][:inv][:uid] = @item.uid
|
|
28
28
|
jsns
|
|
@@ -30,11 +30,13 @@ module Zm
|
|
|
30
30
|
|
|
31
31
|
def recipients_to_jsns
|
|
32
32
|
@item.recipients.map do |recipient|
|
|
33
|
-
{
|
|
33
|
+
h = {
|
|
34
34
|
t: recipient.field,
|
|
35
35
|
a: recipient.email,
|
|
36
36
|
p: recipient.display_name
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
|
+
h.compact!
|
|
39
|
+
h
|
|
38
40
|
end
|
|
39
41
|
end
|
|
40
42
|
|
|
@@ -56,29 +58,32 @@ module Zm
|
|
|
56
58
|
end
|
|
57
59
|
|
|
58
60
|
def comp_to_jsns
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
h = {
|
|
62
|
+
allDay: @item.allDay,
|
|
63
|
+
at: attendees_to_jsns,
|
|
64
|
+
e: end_at_jsns,
|
|
65
|
+
s: start_at_jsns,
|
|
66
|
+
or: organizer_to_jsns,
|
|
67
|
+
name: @item.name,
|
|
68
|
+
fb: @item.fb,
|
|
69
|
+
transp: @item.transp
|
|
70
|
+
}
|
|
71
|
+
h.compact!
|
|
72
|
+
|
|
73
|
+
[h]
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
def attendees_to_jsns
|
|
74
77
|
@item.attendees.map do |attendee|
|
|
75
|
-
{
|
|
78
|
+
h = {
|
|
76
79
|
a: attendee.email,
|
|
77
80
|
d: attendee.display_name,
|
|
78
81
|
role: attendee.role,
|
|
79
82
|
ptst: attendee.ptst,
|
|
80
83
|
rsvp: attendee.rsvp
|
|
81
|
-
}
|
|
84
|
+
}
|
|
85
|
+
h.compact!
|
|
86
|
+
h
|
|
82
87
|
end
|
|
83
88
|
end
|
|
84
89
|
|
|
@@ -99,14 +104,18 @@ module Zm
|
|
|
99
104
|
def organizer_to_jsns
|
|
100
105
|
return nil if @item.organizer.nil?
|
|
101
106
|
|
|
102
|
-
{
|
|
107
|
+
h = {
|
|
103
108
|
a: @item.organizer.email,
|
|
104
109
|
d: @item.organizer.display_name
|
|
105
|
-
}
|
|
110
|
+
}
|
|
111
|
+
h.compact!
|
|
112
|
+
h
|
|
106
113
|
end
|
|
107
114
|
|
|
108
115
|
def time_format
|
|
109
|
-
@time_format
|
|
116
|
+
return @time_format if defined? @time_format
|
|
117
|
+
|
|
118
|
+
@time_format = @item.allDay ? '%Y%m%d' : '%Y%m%dT%H%M00'
|
|
110
119
|
end
|
|
111
120
|
end
|
|
112
121
|
end
|
|
@@ -9,16 +9,17 @@ module Zm
|
|
|
9
9
|
def initialize(parent, json)
|
|
10
10
|
@parent = parent
|
|
11
11
|
@json = json
|
|
12
|
+
@inv_id = @json.delete(:invId)
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
def update
|
|
15
16
|
return false if @appointment.nil?
|
|
16
17
|
|
|
17
|
-
@appointment.calItemId = @json
|
|
18
|
-
@appointment.apptId = @json
|
|
19
|
-
@appointment.invId = @
|
|
20
|
-
@appointment.id = @
|
|
21
|
-
@appointment.rev = @json
|
|
18
|
+
@appointment.calItemId = @json.delete(:calItemId)
|
|
19
|
+
@appointment.apptId = @json.delete(:apptId)
|
|
20
|
+
@appointment.invId = @inv_id
|
|
21
|
+
@appointment.id = @inv_id
|
|
22
|
+
@appointment.rev = @json.delete(:rev)
|
|
22
23
|
|
|
23
24
|
true
|
|
24
25
|
end
|
|
@@ -26,10 +27,10 @@ module Zm
|
|
|
26
27
|
def create
|
|
27
28
|
@appointment ||= Appointment.new(@parent)
|
|
28
29
|
|
|
29
|
-
@appointment.id = @json
|
|
30
|
-
@appointment.tn = @json
|
|
31
|
-
@appointment.l = @json
|
|
32
|
-
@appointment.uid = @json
|
|
30
|
+
@appointment.id = @json.delete(:id)
|
|
31
|
+
@appointment.tn = @json.delete(:tn)
|
|
32
|
+
@appointment.l = @json.delete(:l)
|
|
33
|
+
@appointment.uid = @json.delete(:uid)
|
|
33
34
|
|
|
34
35
|
if inv.nil?
|
|
35
36
|
init_from_search
|
|
@@ -48,10 +49,10 @@ module Zm
|
|
|
48
49
|
unless search_organizer_name.nil?
|
|
49
50
|
@appointment.organizer = Zm::Client::Appointment::Organizer.new(search_organizer_name)
|
|
50
51
|
end
|
|
51
|
-
@appointment.name = @json
|
|
52
|
-
@appointment.id = @
|
|
53
|
-
@appointment.desc = @json
|
|
54
|
-
@appointment.allDay = @json
|
|
52
|
+
@appointment.name = @json.delete(:name)
|
|
53
|
+
@appointment.id = @inv_id
|
|
54
|
+
@appointment.desc = @json.delete(:fr)
|
|
55
|
+
@appointment.allDay = @json.delete(:allDay) unless @json[:allDay].nil?
|
|
55
56
|
search_make_date
|
|
56
57
|
end
|
|
57
58
|
|
|
@@ -5,7 +5,7 @@ module Zm
|
|
|
5
5
|
# collection of appointments
|
|
6
6
|
class AppointmentsCollection < Base::AccountSearchObjectsCollection
|
|
7
7
|
def initialize(parent)
|
|
8
|
-
super
|
|
8
|
+
super
|
|
9
9
|
@child_class = Appointment
|
|
10
10
|
@builder_class = AppointmentsBuilder
|
|
11
11
|
@type = SoapConstants::APPOINTMENT
|
|
@@ -13,19 +13,20 @@ module Zm
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def find(id)
|
|
16
|
-
jsns = { m: { id: id, html:
|
|
16
|
+
jsns = { m: { id: id, html: SoapUtils::ON } }
|
|
17
17
|
|
|
18
|
-
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
19
|
-
|
|
18
|
+
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
19
|
+
.add_attributes(jsns)
|
|
20
|
+
rep = @parent.soap_connector.invoke(soap_request)
|
|
20
21
|
entry = rep[:GetMsgResponse][:m].first
|
|
21
22
|
|
|
22
23
|
AppointmentJsnsInitializer.new(@parent, entry).create
|
|
23
24
|
end
|
|
24
25
|
|
|
25
26
|
def find_each(offset: 0, limit: 500, &block)
|
|
26
|
-
(
|
|
27
|
-
@start_at
|
|
28
|
-
@end_at
|
|
27
|
+
(Time.at(0).year..(Time.now.year + 10)).each do |year|
|
|
28
|
+
@start_at ||= Time.new(year, 1, 1).to_i * 1000
|
|
29
|
+
@end_at ||= Time.new(year, 12, 31).to_i * 1000
|
|
29
30
|
@more = true
|
|
30
31
|
@offset = offset
|
|
31
32
|
@limit = limit
|
|
@@ -12,13 +12,17 @@ module Zm
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def start_at
|
|
15
|
-
@start_at
|
|
15
|
+
return @start_at if defined? @start_at
|
|
16
|
+
|
|
17
|
+
@start_at = Time.at(@start / 1000)
|
|
16
18
|
rescue StandardError
|
|
17
19
|
nil
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def end_at
|
|
21
|
-
@end_at
|
|
23
|
+
return @end_at if defined? @end_at
|
|
24
|
+
|
|
25
|
+
@end_at = Time.at(@end / 1000)
|
|
22
26
|
rescue StandardError
|
|
23
27
|
nil
|
|
24
28
|
end
|
|
@@ -6,19 +6,21 @@ module Zm
|
|
|
6
6
|
class BackupJsnsInitializer
|
|
7
7
|
class << self
|
|
8
8
|
def create(parent, json)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
item.aborted = json[:aborted]
|
|
14
|
-
item.start = json[:start].to_i
|
|
15
|
-
item.end = json[:end].to_i
|
|
16
|
-
item.minRedoSeq = json[:minRedoSeq]
|
|
17
|
-
item.maxRedoSeq = json[:maxRedoSeq]
|
|
18
|
-
item.live = json[:live]
|
|
19
|
-
item.accounts = json[:accounts]
|
|
9
|
+
Backup.new(parent).tap do |item|
|
|
10
|
+
update(item, json)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
def update(item, json)
|
|
15
|
+
item.label = json.delete(:label)
|
|
16
|
+
item.type = json.delete(:type)
|
|
17
|
+
item.aborted = json.delete(:aborted)
|
|
18
|
+
item.start = json.delete(:start)
|
|
19
|
+
item.end = json.delete(:end)
|
|
20
|
+
item.minRedoSeq = json.delete(:minRedoSeq)
|
|
21
|
+
item.maxRedoSeq = json.delete(:maxRedoSeq)
|
|
22
|
+
item.live = json.delete(:live)
|
|
23
|
+
item.accounts = json.delete(:accounts)
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -11,7 +11,8 @@ module Zm
|
|
|
11
11
|
private
|
|
12
12
|
|
|
13
13
|
def make_query
|
|
14
|
-
soap_request = SoapElement.admin(SoapAdminConstants::BACKUP_QUERY_REQUEST)
|
|
14
|
+
soap_request = SoapElement.admin(SoapAdminConstants::BACKUP_QUERY_REQUEST)
|
|
15
|
+
.add_attribute(SoapConstants::QUERY, {})
|
|
15
16
|
sac.target_invoke(soap_request, @parent.id)
|
|
16
17
|
end
|
|
17
18
|
|
|
@@ -8,28 +8,38 @@ module Zm
|
|
|
8
8
|
attr_accessor :more
|
|
9
9
|
|
|
10
10
|
def initialize(parent)
|
|
11
|
-
super
|
|
11
|
+
super
|
|
12
12
|
@more = true
|
|
13
13
|
reset_query_params
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def find(id)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
soap_request = SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST).add_attributes(jsns)
|
|
20
|
-
rep = @parent.sacc.invoke(soap_request)
|
|
17
|
+
rep = @parent.soap_connector.invoke(build_find(id))
|
|
21
18
|
entry = rep[:GetMsgResponse][:m].first
|
|
22
19
|
|
|
23
20
|
MessageJsnsInitializer.create(@parent, entry)
|
|
24
21
|
end
|
|
25
22
|
|
|
23
|
+
def build_find(id)
|
|
24
|
+
SoapElement.mail(SoapMailConstants::GET_MSG_REQUEST)
|
|
25
|
+
.add_attributes({ m: { id: id, html: SoapUtils::ON } })
|
|
26
|
+
end
|
|
27
|
+
|
|
26
28
|
def start_at(start_at)
|
|
27
|
-
@start_at = start_at
|
|
29
|
+
@start_at = if start_at.is_a?(Time)
|
|
30
|
+
start_at.to_i * 1000
|
|
31
|
+
elsif start_at.is_a?(Date)
|
|
32
|
+
start_at.to_time.to_i * 1000
|
|
33
|
+
end
|
|
28
34
|
self
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
def end_at(end_at)
|
|
32
|
-
@end_at = end_at
|
|
38
|
+
@end_at = if end_at.is_a?(Time)
|
|
39
|
+
end_at.to_i * 1000
|
|
40
|
+
elsif end_at.is_a?(Date)
|
|
41
|
+
end_at.to_time.to_i * 1000
|
|
42
|
+
end
|
|
33
43
|
self
|
|
34
44
|
end
|
|
35
45
|
|
|
@@ -59,7 +69,6 @@ module Zm
|
|
|
59
69
|
def order(sort_by)
|
|
60
70
|
return self if @sort_by == sort_by
|
|
61
71
|
|
|
62
|
-
@all = nil
|
|
63
72
|
@sort_by = sort_by
|
|
64
73
|
self
|
|
65
74
|
end
|
|
@@ -73,9 +82,11 @@ module Zm
|
|
|
73
82
|
reset_query_params
|
|
74
83
|
end
|
|
75
84
|
|
|
76
|
-
private
|
|
77
|
-
|
|
78
85
|
def make_query
|
|
86
|
+
@parent.soap_connector.invoke(build_query)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def build_query
|
|
79
90
|
jsns = {
|
|
80
91
|
types: @type,
|
|
81
92
|
offset: @offset,
|
|
@@ -87,12 +98,28 @@ module Zm
|
|
|
87
98
|
|
|
88
99
|
jsns.merge!(build_options)
|
|
89
100
|
|
|
90
|
-
jsns.
|
|
101
|
+
jsns.compact!
|
|
91
102
|
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
SoapElement.mail(SoapMailConstants::SEARCH_REQUEST)
|
|
104
|
+
.add_attributes(jsns)
|
|
94
105
|
end
|
|
95
106
|
|
|
107
|
+
def delete_all(ids)
|
|
108
|
+
attrs = {
|
|
109
|
+
op: :delete,
|
|
110
|
+
id: ids.join(',')
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
attrs.compact!
|
|
114
|
+
|
|
115
|
+
soap_request = SoapElement.mail(SoapMailConstants::ITEM_ACTION_REQUEST)
|
|
116
|
+
node_action = SoapElement.create(SoapConstants::ACTION).add_attributes(attrs)
|
|
117
|
+
soap_request.add_node(node_action)
|
|
118
|
+
@parent.soap_connector.invoke(soap_request)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
private
|
|
122
|
+
|
|
96
123
|
def search_builder
|
|
97
124
|
@builder_class.new(@parent, search_response)
|
|
98
125
|
end
|
|
@@ -122,14 +149,13 @@ module Zm
|
|
|
122
149
|
end
|
|
123
150
|
|
|
124
151
|
def build_options
|
|
125
|
-
|
|
126
|
-
end_at_ts = @end_at.is_a?(Time) ? (@end_at.to_f * 1000).to_i : nil
|
|
127
|
-
|
|
128
|
-
{
|
|
152
|
+
h = {
|
|
129
153
|
resultMode: @resultMode,
|
|
130
|
-
calExpandInstStart:
|
|
131
|
-
calExpandInstEnd:
|
|
132
|
-
}
|
|
154
|
+
calExpandInstStart: @start_at,
|
|
155
|
+
calExpandInstEnd: @end_at
|
|
156
|
+
}
|
|
157
|
+
h.compact!
|
|
158
|
+
h
|
|
133
159
|
end
|
|
134
160
|
|
|
135
161
|
def reset_query_params
|
|
@@ -12,9 +12,6 @@ module Zm
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def find_by(hash)
|
|
15
|
-
item = find_in_cache(hash)
|
|
16
|
-
return item unless item.nil?
|
|
17
|
-
|
|
18
15
|
find_by!(hash)
|
|
19
16
|
end
|
|
20
17
|
|
|
@@ -25,28 +22,26 @@ module Zm
|
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
def ldap
|
|
28
|
-
@all = nil
|
|
29
25
|
@apply_cos = SoapUtils::OFF
|
|
30
26
|
self
|
|
31
27
|
end
|
|
32
28
|
|
|
33
29
|
def where(ldap_query)
|
|
34
|
-
|
|
30
|
+
ldap_filter.add(ldap_query)
|
|
35
31
|
|
|
36
32
|
self
|
|
37
33
|
end
|
|
38
34
|
|
|
39
|
-
def attrs(*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
def attrs(*attributes)
|
|
36
|
+
attributes.flatten!
|
|
37
|
+
attributes.map! { |attr| attr.to_s.strip }
|
|
38
|
+
attributes.sort!
|
|
39
|
+
attributes.uniq!
|
|
40
|
+
attributes.delete_if { |attr| attr.nil? || attr.empty? }
|
|
45
41
|
|
|
46
|
-
return self if @attrs ==
|
|
42
|
+
return self if @attrs == attributes
|
|
47
43
|
|
|
48
|
-
@
|
|
49
|
-
@attrs = attrs
|
|
44
|
+
@attrs = attributes
|
|
50
45
|
self
|
|
51
46
|
end
|
|
52
47
|
|
|
@@ -59,7 +54,6 @@ module Zm
|
|
|
59
54
|
end
|
|
60
55
|
|
|
61
56
|
def clear
|
|
62
|
-
@all = nil
|
|
63
57
|
ldap_filter.clear
|
|
64
58
|
reset_query_params
|
|
65
59
|
self
|
|
@@ -87,28 +81,27 @@ module Zm
|
|
|
87
81
|
@persistent = previous_persistent
|
|
88
82
|
end
|
|
89
83
|
|
|
90
|
-
private
|
|
91
|
-
|
|
92
84
|
def make_query
|
|
93
|
-
|
|
94
|
-
soap_request.add_attributes(jsns)
|
|
95
|
-
response = sac.invoke(soap_request)
|
|
85
|
+
response = sac.invoke(build_query)
|
|
96
86
|
clear unless @persistent
|
|
97
87
|
response
|
|
98
88
|
end
|
|
99
89
|
|
|
100
|
-
def
|
|
101
|
-
|
|
90
|
+
def build_query
|
|
91
|
+
SoapElement.admin(SoapAdminConstants::SEARCH_DIRECTORY_REQUEST)
|
|
92
|
+
.add_attributes(jsns)
|
|
102
93
|
end
|
|
103
94
|
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
private
|
|
96
|
+
|
|
97
|
+
def ldap_filter
|
|
98
|
+
return @ldap_filter if defined? @ldap_filter
|
|
106
99
|
|
|
107
|
-
@
|
|
100
|
+
@ldap_filter = LdapFilter.new
|
|
108
101
|
end
|
|
109
102
|
|
|
110
103
|
def jsns
|
|
111
|
-
{
|
|
104
|
+
h = {
|
|
112
105
|
query: ldap_filter.join,
|
|
113
106
|
maxResults: @max_result,
|
|
114
107
|
limit: @limit,
|
|
@@ -121,7 +114,9 @@ module Zm
|
|
|
121
114
|
sortAscending: @sort_ascending,
|
|
122
115
|
countOnly: @count_only,
|
|
123
116
|
attrs: attrs_comma
|
|
124
|
-
}
|
|
117
|
+
}
|
|
118
|
+
h.compact!
|
|
119
|
+
h
|
|
125
120
|
end
|
|
126
121
|
end
|
|
127
122
|
end
|
|
@@ -38,7 +38,7 @@ module Zm
|
|
|
38
38
|
id: @item.id
|
|
39
39
|
}.merge(hash)
|
|
40
40
|
|
|
41
|
-
attrs.
|
|
41
|
+
attrs.compact!
|
|
42
42
|
|
|
43
43
|
build(attrs)
|
|
44
44
|
end
|
|
@@ -72,9 +72,6 @@ module Zm
|
|
|
72
72
|
color: @item.color
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
# attrs[:rgb] = @item.rgb if @item.rgb_changed?
|
|
76
|
-
# attrs[:color] = @item.color if @item.color_changed?
|
|
77
|
-
|
|
78
75
|
build(attrs)
|
|
79
76
|
end
|
|
80
77
|
|
|
@@ -6,9 +6,15 @@ module Zm
|
|
|
6
6
|
# class for account object jsns initializer
|
|
7
7
|
class BaseJsnsInitializer
|
|
8
8
|
class << self
|
|
9
|
+
def create(parent, json)
|
|
10
|
+
klass.new(parent).tap do |item|
|
|
11
|
+
update(item, json)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
9
15
|
def update(item, json)
|
|
10
|
-
item.id = json
|
|
11
|
-
item.name = json
|
|
16
|
+
item.id = json.delete(:id)
|
|
17
|
+
item.name = json.delete(:name)
|
|
12
18
|
|
|
13
19
|
formatted_json(json).each do |k, v|
|
|
14
20
|
valorise(item, k, v)
|
|
@@ -47,12 +53,6 @@ module Zm
|
|
|
47
53
|
c = value.to_i
|
|
48
54
|
c.to_s == value ? c : value
|
|
49
55
|
end
|
|
50
|
-
|
|
51
|
-
# def arrow_name(name)
|
|
52
|
-
# return name if name.to_s.start_with?('@')
|
|
53
|
-
#
|
|
54
|
-
# "@#{name}"
|
|
55
|
-
# end
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|