viewpoint 1.2.0 → 2.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/README.md +11 -6
- data/lib/ews/calendar_accessors.rb +37 -33
- data/lib/ews/connection.rb +152 -125
- data/lib/ews/connection_helper.rb +36 -33
- data/lib/ews/convert_accessors.rb +58 -54
- data/lib/ews/errors.rb +59 -53
- data/lib/ews/ews_client.rb +92 -79
- data/lib/ews/exceptions/exceptions.rb +61 -61
- data/lib/ews/folder_accessors.rb +235 -234
- data/lib/ews/impersonation.rb +29 -23
- data/lib/ews/item_accessors.rb +215 -213
- data/lib/ews/mailbox_accessors.rb +82 -79
- data/lib/ews/meeting_accessors.rb +38 -31
- data/lib/ews/message_accessors.rb +83 -81
- data/lib/ews/push_subscription_accessors.rb +29 -27
- data/lib/ews/room_accessors.rb +48 -46
- data/lib/ews/roomlist_accessors.rb +47 -45
- data/lib/ews/soap/builders/ews_builder.rb +1191 -1176
- data/lib/ews/soap/ews_response.rb +68 -73
- data/lib/ews/soap/ews_soap_availability_response.rb +57 -57
- data/lib/ews/soap/ews_soap_free_busy_response.rb +115 -117
- data/lib/ews/soap/ews_soap_response.rb +99 -101
- data/lib/ews/soap/ews_soap_room_response.rb +45 -45
- data/lib/ews/soap/ews_soap_roomlist_response.rb +45 -46
- data/lib/ews/soap/exchange_availability.rb +54 -52
- data/lib/ews/soap/exchange_data_services.rb +693 -711
- data/lib/ews/soap/exchange_notification.rb +123 -128
- data/lib/ews/soap/exchange_synchronization.rb +82 -82
- data/lib/ews/soap/exchange_time_zones.rb +41 -44
- data/lib/ews/soap/exchange_user_configuration.rb +30 -27
- data/lib/ews/soap/exchange_web_service.rb +237 -233
- data/lib/ews/soap/parsers/ews_parser.rb +46 -42
- data/lib/ews/soap/parsers/ews_sax_document.rb +63 -58
- data/lib/ews/soap/response_message.rb +69 -68
- data/lib/ews/soap/responses/create_attachment_response_message.rb +45 -45
- data/lib/ews/soap/responses/create_item_response_message.rb +26 -25
- data/lib/ews/soap/responses/find_item_response_message.rb +76 -78
- data/lib/ews/soap/responses/get_events_response_message.rb +52 -51
- data/lib/ews/soap/responses/send_notification_response_message.rb +53 -51
- data/lib/ews/soap/responses/subscribe_response_message.rb +37 -34
- data/lib/ews/soap/responses/sync_folder_hierarchy_response_message.rb +38 -35
- data/lib/ews/soap/responses/sync_folder_items_response_message.rb +38 -35
- data/lib/ews/soap.rb +27 -26
- data/lib/ews/templates/calendar_item.rb +64 -60
- data/lib/ews/templates/forward_item.rb +19 -17
- data/lib/ews/templates/message.rb +61 -58
- data/lib/ews/templates/reply_to_item.rb +20 -18
- data/lib/ews/templates/task.rb +55 -55
- data/lib/ews/types/attachment.rb +75 -74
- data/lib/ews/types/attendee.rb +27 -25
- data/lib/ews/types/calendar_folder.rb +58 -59
- data/lib/ews/types/calendar_item.rb +133 -131
- data/lib/ews/types/contact.rb +11 -5
- data/lib/ews/types/contacts_folder.rb +10 -5
- data/lib/ews/types/copied_event.rb +47 -48
- data/lib/ews/types/created_event.rb +22 -20
- data/lib/ews/types/deleted_event.rb +22 -20
- data/lib/ews/types/distribution_list.rb +11 -5
- data/lib/ews/types/event.rb +60 -59
- data/lib/ews/types/export_items_response_message.rb +54 -50
- data/lib/ews/types/file_attachment.rb +63 -61
- data/lib/ews/types/folder.rb +58 -57
- data/lib/ews/types/free_busy_changed_event.rb +22 -20
- data/lib/ews/types/generic_folder.rb +348 -372
- data/lib/ews/types/item.rb +401 -397
- data/lib/ews/types/item_attachment.rb +87 -80
- data/lib/ews/types/item_field_uri_map.rb +201 -200
- data/lib/ews/types/mailbox_user.rb +146 -154
- data/lib/ews/types/meeting_cancellation.rb +11 -5
- data/lib/ews/types/meeting_message.rb +11 -5
- data/lib/ews/types/meeting_request.rb +11 -5
- data/lib/ews/types/meeting_response.rb +11 -5
- data/lib/ews/types/message.rb +11 -5
- data/lib/ews/types/modified_event.rb +43 -45
- data/lib/ews/types/moved_event.rb +47 -48
- data/lib/ews/types/new_mail_event.rb +22 -20
- data/lib/ews/types/out_of_office.rb +145 -144
- data/lib/ews/types/post_item.rb +11 -5
- data/lib/ews/types/search_folder.rb +10 -5
- data/lib/ews/types/status_event.rb +37 -36
- data/lib/ews/types/task.rb +39 -33
- data/lib/ews/types/tasks_folder.rb +31 -25
- data/lib/ews/types.rb +134 -139
- data/lib/viewpoint/logging/config.rb +19 -19
- data/lib/viewpoint/logging.rb +23 -17
- data/lib/viewpoint/string_utils.rb +31 -32
- data/lib/viewpoint.rb +18 -18
- metadata +50 -25
- data/Changelog.txt +0 -1004
|
@@ -1,146 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
# This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
4
|
+
#
|
|
5
|
+
# Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
5
18
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module SOAP
|
|
22
|
+
# Exchange Notification operations as listed in the EWS Documentation.
|
|
23
|
+
# @see http://msdn.microsoft.com/en-us/library/bb409286.aspx
|
|
24
|
+
module ExchangeNotification
|
|
25
|
+
include Viewpoint::EWS::SOAP
|
|
9
26
|
|
|
10
|
-
|
|
27
|
+
# Used to subscribe client applications to either push, pull or stream notifications.
|
|
28
|
+
# @see http://msdn.microsoft.com/en-us/library/aa566188(v=EXCHG.140).aspx
|
|
29
|
+
# @param [Array<Hash>] subscriptions An array of Hash objects that describe each
|
|
30
|
+
# subscription.
|
|
31
|
+
# Ex: [ {:pull_subscription_request => {
|
|
32
|
+
# :subscribe_to_all_folders => false,
|
|
33
|
+
# :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
|
|
34
|
+
# :event_types=> %w{CopiedEvent CreatedEvent},
|
|
35
|
+
# :watermark => 'watermark id',
|
|
36
|
+
# :timeout => intval
|
|
37
|
+
# }},
|
|
38
|
+
# {:push_subscription_request => {
|
|
39
|
+
# :subscribe_to_all_folders => true,
|
|
40
|
+
# :event_types=> %w{CopiedEvent CreatedEvent},
|
|
41
|
+
# :status_frequency => 15,
|
|
42
|
+
# :uRL => 'http://my.endpoint.for.updates/',
|
|
43
|
+
# }},
|
|
44
|
+
# {:streaming_subscription_request => {
|
|
45
|
+
# :subscribe_to_all_folders => false,
|
|
46
|
+
# :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
|
|
47
|
+
# :event_types=> %w{NewMailEvent DeletedEvent},
|
|
48
|
+
# }},
|
|
49
|
+
# ]
|
|
50
|
+
def subscribe(subscriptions)
|
|
51
|
+
req = build_soap! { |type, builder|
|
|
52
|
+
unless type == :header
|
|
53
|
+
builder.nbuild.Subscribe {
|
|
54
|
+
builder.nbuild.parent.default_namespace = @default_ns
|
|
55
|
+
subscriptions.each do |sub|
|
|
56
|
+
subtype = sub.keys.first
|
|
57
|
+
raise EwsBadArgumentError, "Bad subscription type. #{subtype}" unless builder.respond_to?(subtype)
|
|
11
58
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
See the License for the specific language governing permissions and
|
|
16
|
-
limitations under the License.
|
|
17
|
-
=end
|
|
18
|
-
|
|
19
|
-
module Viewpoint::EWS::SOAP
|
|
20
|
-
|
|
21
|
-
# Exchange Notification operations as listed in the EWS Documentation.
|
|
22
|
-
# @see http://msdn.microsoft.com/en-us/library/bb409286.aspx
|
|
23
|
-
module ExchangeNotification
|
|
24
|
-
include Viewpoint::EWS::SOAP
|
|
25
|
-
|
|
26
|
-
# Used to subscribe client applications to either push, pull or stream notifications.
|
|
27
|
-
# @see http://msdn.microsoft.com/en-us/library/aa566188(v=EXCHG.140).aspx
|
|
28
|
-
# @param [Array<Hash>] subscriptions An array of Hash objects that describe each
|
|
29
|
-
# subscription.
|
|
30
|
-
# Ex: [ {:pull_subscription_request => {
|
|
31
|
-
# :subscribe_to_all_folders => false,
|
|
32
|
-
# :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
|
|
33
|
-
# :event_types=> %w{CopiedEvent CreatedEvent},
|
|
34
|
-
# :watermark => 'watermark id',
|
|
35
|
-
# :timeout => intval
|
|
36
|
-
# }},
|
|
37
|
-
# {:push_subscription_request => {
|
|
38
|
-
# :subscribe_to_all_folders => true,
|
|
39
|
-
# :event_types=> %w{CopiedEvent CreatedEvent},
|
|
40
|
-
# :status_frequency => 15,
|
|
41
|
-
# :uRL => 'http://my.endpoint.for.updates/',
|
|
42
|
-
# }},
|
|
43
|
-
# {:streaming_subscription_request => {
|
|
44
|
-
# :subscribe_to_all_folders => false,
|
|
45
|
-
# :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
|
|
46
|
-
# :event_types=> %w{NewMailEvent DeletedEvent},
|
|
47
|
-
# }},
|
|
48
|
-
# ]
|
|
49
|
-
def subscribe(subscriptions)
|
|
50
|
-
req = build_soap! do |type, builder|
|
|
51
|
-
if(type == :header)
|
|
52
|
-
else
|
|
53
|
-
builder.nbuild.Subscribe {
|
|
54
|
-
builder.nbuild.parent.default_namespace = @default_ns
|
|
55
|
-
subscriptions.each do |sub|
|
|
56
|
-
subtype = sub.keys.first
|
|
57
|
-
if(builder.respond_to?(subtype))
|
|
58
|
-
builder.send subtype, sub[subtype]
|
|
59
|
-
else
|
|
60
|
-
raise EwsBadArgumentError, "Bad subscription type. #{subtype}"
|
|
61
|
-
end
|
|
59
|
+
builder.send subtype, sub[subtype]
|
|
60
|
+
end
|
|
61
|
+
}
|
|
62
62
|
end
|
|
63
63
|
}
|
|
64
|
+
do_soap_request(req, response_class: EwsResponse)
|
|
64
65
|
end
|
|
65
|
-
end
|
|
66
|
-
do_soap_request(req, response_class: EwsResponse)
|
|
67
|
-
end
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
# End a pull notification subscription.
|
|
68
|
+
# @see http://msdn.microsoft.com/en-us/library/aa564263.aspx
|
|
69
|
+
#
|
|
70
|
+
# @param [String] subscription_id The Id of the subscription
|
|
71
|
+
def unsubscribe(subscription_id)
|
|
72
|
+
req = build_soap! { |type, builder|
|
|
73
|
+
unless type == :header
|
|
74
|
+
builder.nbuild.Unsubscribe {
|
|
75
|
+
builder.nbuild.parent.default_namespace = @default_ns
|
|
76
|
+
builder.subscription_id!(subscription_id)
|
|
77
|
+
}
|
|
78
|
+
end
|
|
80
79
|
}
|
|
80
|
+
do_soap_request(req, response_class: EwsResponse)
|
|
81
81
|
end
|
|
82
|
-
end
|
|
83
|
-
do_soap_request(req, response_class: EwsResponse)
|
|
84
|
-
end
|
|
85
82
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
# Used by pull subscription clients to request notifications from the Client Access server
|
|
84
|
+
# @see http://msdn.microsoft.com/en-us/library/aa566199.aspx GetEvents on MSDN
|
|
85
|
+
#
|
|
86
|
+
# @param [String] subscription_id Subscription identifier
|
|
87
|
+
# @param [String] watermark Event bookmark in the events queue
|
|
88
|
+
def get_events(subscription_id, watermark)
|
|
89
|
+
req = build_soap! { |type, builder|
|
|
90
|
+
unless type == :header
|
|
91
|
+
builder.nbuild.GetEvents {
|
|
92
|
+
builder.nbuild.parent.default_namespace = @default_ns
|
|
93
|
+
builder.subscription_id!(subscription_id)
|
|
94
|
+
builder.watermark!(watermark, NS_EWS_MESSAGES)
|
|
95
|
+
}
|
|
96
|
+
end
|
|
99
97
|
}
|
|
98
|
+
do_soap_request(req, response_class: EwsResponse)
|
|
100
99
|
end
|
|
101
|
-
end
|
|
102
|
-
do_soap_request(req, response_class: EwsResponse)
|
|
103
|
-
end
|
|
104
|
-
|
|
105
100
|
|
|
106
|
-
|
|
101
|
+
# ------- convenience methods ------- #
|
|
107
102
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
103
|
+
# Create a pull subscription to a single folder
|
|
104
|
+
# @param folder [Hash] a hash with the folder :id and :change_key
|
|
105
|
+
# @param evtypes [Array] the events you would like to subscribe to.
|
|
106
|
+
# @param timeout [Fixnum] http://msdn.microsoft.com/en-us/library/aa565201.aspx
|
|
107
|
+
# @param watermark [String] http://msdn.microsoft.com/en-us/library/aa565886.aspx
|
|
108
|
+
def pull_subscribe_folder(folder, evtypes, timeout = nil, watermark = nil)
|
|
109
|
+
timeout ||= 240 # 4 hour default timeout
|
|
110
|
+
psr = {
|
|
111
|
+
subscribe_to_all_folders: false,
|
|
112
|
+
folder_ids: [{ id: folder[:id], change_key: folder[:change_key] }],
|
|
113
|
+
event_types: evtypes,
|
|
114
|
+
timeout: timeout
|
|
115
|
+
}
|
|
116
|
+
psr[:watermark] = watermark if watermark
|
|
117
|
+
subscribe([{ pull_subscription_request: psr }])
|
|
118
|
+
end
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
120
|
+
# Create a push subscription to a single folder
|
|
121
|
+
# @param folder [Hash] a hash with the folder :id and :change_key
|
|
122
|
+
# @param evtypes [Array] the events you would like to subscribe to.
|
|
123
|
+
# @param url [String,URI] http://msdn.microsoft.com/en-us/library/aa566309.aspx
|
|
124
|
+
# @param watermark [String] http://msdn.microsoft.com/en-us/library/aa565886.aspx
|
|
125
|
+
# @param status_frequency [Fixnum] http://msdn.microsoft.com/en-us/library/aa564048.aspx
|
|
126
|
+
def push_subscribe_folder(folder, evtypes, url, status_frequency = nil, watermark = nil)
|
|
127
|
+
status_frequency ||= 30
|
|
128
|
+
psr = {
|
|
129
|
+
subscribe_to_all_folders: false,
|
|
130
|
+
folder_ids: [{ id: folder[:id], change_key: folder[:change_key] }],
|
|
131
|
+
event_types: evtypes,
|
|
132
|
+
status_frequency: status_frequency,
|
|
133
|
+
uRL: url.to_s
|
|
134
|
+
}
|
|
135
|
+
psr[:watermark] = watermark if watermark
|
|
136
|
+
subscribe([{ push_subscription_request: psr }])
|
|
137
|
+
end
|
|
138
|
+
end
|
|
142
139
|
end
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
end #ExchangeNotification
|
|
140
|
+
end
|
|
146
141
|
end
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
# This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
4
|
+
#
|
|
5
|
+
# Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
5
18
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module SOAP
|
|
22
|
+
# Exchange Synchronization operations as listed in the EWS Documentation.
|
|
23
|
+
# @see http://msdn.microsoft.com/en-us/library/bb409286.aspx
|
|
24
|
+
module ExchangeSynchronization
|
|
25
|
+
include Viewpoint::EWS::SOAP
|
|
9
26
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# @option opts [Hash] :sync_folder_id An optional Hash that represents a FolderId or
|
|
32
|
-
# DistinguishedFolderId.
|
|
33
|
-
# Ex: {:id => :inbox}
|
|
34
|
-
# @option opts [Hash] :sync_state The Base64 sync state id. If this is the
|
|
35
|
-
# first time syncing this does not need to be passed.
|
|
36
|
-
def sync_folder_hierarchy(opts)
|
|
37
|
-
opts = opts.clone
|
|
38
|
-
req = build_soap! do |type, builder|
|
|
39
|
-
if(type == :header)
|
|
40
|
-
else
|
|
41
|
-
builder.nbuild.SyncFolderHierarchy {
|
|
42
|
-
builder.nbuild.parent.default_namespace = @default_ns
|
|
43
|
-
builder.folder_shape!(opts[:folder_shape])
|
|
44
|
-
builder.sync_folder_id!(opts[:sync_folder_id]) if opts[:sync_folder_id]
|
|
45
|
-
builder.sync_state!(opts[:sync_state]) if opts[:sync_state]
|
|
27
|
+
# Defines a request to synchronize a folder hierarchy on a client
|
|
28
|
+
# @see http://msdn.microsoft.com/en-us/library/aa580990.aspx
|
|
29
|
+
# @param [Hash] opts
|
|
30
|
+
# @option opts [Hash] :folder_shape The folder shape properties
|
|
31
|
+
# Ex: {:base_shape => 'Default', :additional_properties => 'bla bla bla'}
|
|
32
|
+
# @option opts [Hash] :sync_folder_id An optional Hash that represents a FolderId or
|
|
33
|
+
# DistinguishedFolderId.
|
|
34
|
+
# Ex: {:id => :inbox}
|
|
35
|
+
# @option opts [Hash] :sync_state The Base64 sync state id. If this is the
|
|
36
|
+
# first time syncing this does not need to be passed.
|
|
37
|
+
def sync_folder_hierarchy(opts)
|
|
38
|
+
opts = opts.clone
|
|
39
|
+
req = build_soap! { |type, builder|
|
|
40
|
+
unless type == :header
|
|
41
|
+
builder.nbuild.SyncFolderHierarchy {
|
|
42
|
+
builder.nbuild.parent.default_namespace = @default_ns
|
|
43
|
+
builder.folder_shape!(opts[:folder_shape])
|
|
44
|
+
builder.sync_folder_id!(opts[:sync_folder_id]) if opts[:sync_folder_id]
|
|
45
|
+
builder.sync_state!(opts[:sync_state]) if opts[:sync_state]
|
|
46
|
+
}
|
|
47
|
+
end
|
|
46
48
|
}
|
|
49
|
+
do_soap_request(req, response_class: EwsResponse)
|
|
47
50
|
end
|
|
48
|
-
end
|
|
49
|
-
do_soap_request(req, response_class: EwsResponse)
|
|
50
|
-
end
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
52
|
+
# Synchronizes items between the Exchange server and the client
|
|
53
|
+
# @see http://msdn.microsoft.com/en-us/library/aa563967(v=EXCHG.140).aspx
|
|
54
|
+
# @param [Hash] opts
|
|
55
|
+
# @option opts [Hash] :item_shape The item shape properties
|
|
56
|
+
# Ex: {:base_shape => 'Default', :additional_properties => 'bla bla bla'}
|
|
57
|
+
# @option opts [Hash] :sync_folder_id A Hash that represents a FolderId or
|
|
58
|
+
# DistinguishedFolderId. [ Ex: {:id => :inbox} ] OPTIONAL
|
|
59
|
+
# @option opts [String] :sync_state The Base64 sync state id. If this is the
|
|
60
|
+
# first time syncing this does not need to be passed. OPTIONAL on first call
|
|
61
|
+
# @option opts [Array <String>] :ignore An Array of ItemIds for items to ignore
|
|
62
|
+
# during the sync process. Ex: [{:id => 'id1', :change_key => 'ck'}, {:id => 'id2'}]
|
|
63
|
+
# OPTIONAL
|
|
64
|
+
# @option opts [Integer] :max_changes_returned ('required') The amount of items to sync per call.
|
|
65
|
+
# @option opts [String] :sync_scope specifies whether just items or items and folder associated
|
|
66
|
+
# information are returned. OPTIONAL
|
|
67
|
+
# options: 'NormalItems' or 'NormalAndAssociatedItems'
|
|
68
|
+
# @example
|
|
69
|
+
# { :item_shape => {:base_shape => 'Default'},
|
|
70
|
+
# :sync_folder_id => {:id => :inbox},
|
|
71
|
+
# :sync_state => myBase64id,
|
|
72
|
+
# :max_changes_returned => 256 }
|
|
73
|
+
def sync_folder_items(opts)
|
|
74
|
+
opts = opts.clone
|
|
75
|
+
req = build_soap! { |type, builder|
|
|
76
|
+
unless type == :header
|
|
77
|
+
builder.nbuild.SyncFolderItems {
|
|
78
|
+
builder.nbuild.parent.default_namespace = @default_ns
|
|
79
|
+
builder.item_shape!(opts[:item_shape])
|
|
80
|
+
builder.sync_folder_id!(opts[:sync_folder_id]) if opts[:sync_folder_id]
|
|
81
|
+
builder.sync_state!(opts[:sync_state]) if opts[:sync_state]
|
|
82
|
+
builder.ignore!(opts[:ignore]) if opts[:ignore]
|
|
83
|
+
builder.max_changes_returned!(opts[:max_changes_returned])
|
|
84
|
+
builder.sync_scope!(opts[:sync_scope]) if opts[:sync_scope]
|
|
85
|
+
}
|
|
86
|
+
end
|
|
86
87
|
}
|
|
88
|
+
do_soap_request(req, response_class: EwsResponse)
|
|
87
89
|
end
|
|
88
90
|
end
|
|
89
|
-
do_soap_request(req, response_class: EwsResponse)
|
|
90
91
|
end
|
|
91
|
-
|
|
92
|
-
end #ExchangeSynchronization
|
|
92
|
+
end
|
|
93
93
|
end
|
|
@@ -1,56 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module SOAP
|
|
6
|
+
# Known Exchange time zone definitions.
|
|
7
|
+
module ExchangeTimeZones
|
|
8
|
+
include Viewpoint::EWS::SOAP
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
result = do_soap_request req, response_class: EwsSoapResponse
|
|
10
|
+
# Request list of server known time zones
|
|
11
|
+
# @param full [Boolean] Request full time zone definition? Returns only name and id if false.
|
|
12
|
+
# @param ids [Array] Returns only the specified time zones instead of all if present
|
|
13
|
+
# @return [Array] Array of Objects responding to #id() and #name()
|
|
14
|
+
# @example Retrieving server time zones
|
|
15
|
+
# ews_client = Viewpoint::EWSClient.new # ...
|
|
16
|
+
# zones = ews_client.ews.get_time_zones
|
|
17
|
+
# @todo Implement TimeZoneDefinition with sub elements Periods, TransitionsGroups and Transitions
|
|
18
|
+
def get_time_zones(full = false, ids = nil) # rubocop:disable Style/OptionalBooleanParameter -- public API
|
|
19
|
+
req = build_soap! { |type, builder|
|
|
20
|
+
builder.get_server_time_zones!(full: full, ids: ids) unless type == :header
|
|
21
|
+
}
|
|
22
|
+
result = do_soap_request req, response_class: EwsSoapResponse
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
raise EwsError, 'Could not get time zones' unless result.success?
|
|
25
|
+
|
|
26
|
+
zones = []
|
|
27
|
+
result.response_messages.each do |message|
|
|
28
|
+
elements = message[:get_server_time_zones_response_message][:elems][:time_zone_definitions][:elems]
|
|
29
|
+
elements.each do |definition|
|
|
30
|
+
data = {
|
|
28
31
|
id: definition[:time_zone_definition][:attribs][:id],
|
|
29
32
|
name: definition[:time_zone_definition][:attribs][:name]
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
}
|
|
34
|
+
zones << OpenStruct.new(data)
|
|
35
|
+
end
|
|
32
36
|
end
|
|
37
|
+
zones
|
|
33
38
|
end
|
|
34
|
-
zones
|
|
35
|
-
else
|
|
36
|
-
raise EwsError, "Could not get time zones"
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
else
|
|
51
|
-
@time_zone_context = nil
|
|
40
|
+
# Sets the time zone context header
|
|
41
|
+
# @param id [String] Identifier of a Microsoft well known time zone
|
|
42
|
+
# @example Set time zone context for connection
|
|
43
|
+
# ews_client = Viewpoint::EWSClient.new # ...
|
|
44
|
+
# ews_client.set_time_zone 'AUS Central Standard Time'
|
|
45
|
+
# # subsequent request will send the TimeZoneContext header
|
|
46
|
+
# @see EWSClient#set_time_zone
|
|
47
|
+
def set_time_zone_context(id) # rubocop:disable Naming/AccessorMethodName -- public API name
|
|
48
|
+
@time_zone_context = ({ id: id } if id)
|
|
49
|
+
end
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
|
-
|
|
55
52
|
end
|
|
56
53
|
end
|
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module SOAP
|
|
6
|
+
# Exchange User Configuration operations as listed in the EWS Documentation.
|
|
7
|
+
# @see http://msdn.microsoft.com/en-us/library/bb409286.aspx
|
|
8
|
+
module ExchangeUserConfiguration
|
|
9
|
+
include Viewpoint::EWS::SOAP
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
# The GetUserConfiguration operation gets a user configuration object from
|
|
12
|
+
# a folder.
|
|
13
|
+
# @see http://msdn.microsoft.com/en-us/library/aa563465.aspx
|
|
14
|
+
# @param [Hash] opts
|
|
15
|
+
# @option opts [Hash] :user_config_name
|
|
16
|
+
# @option opts [String] :user_config_props
|
|
17
|
+
def get_user_configuration(opts)
|
|
18
|
+
opts = opts.clone
|
|
19
|
+
%i[user_config_name user_config_props].each do |k|
|
|
20
|
+
validate_param(opts, k, true)
|
|
21
|
+
end
|
|
22
|
+
req = build_soap! { |type, builder|
|
|
23
|
+
unless type == :header
|
|
24
|
+
builder.nbuild.GetUserConfiguration { |x|
|
|
25
|
+
x.parent.default_namespace = @default_ns
|
|
26
|
+
builder.user_configuration_name!(opts[:user_config_name])
|
|
27
|
+
builder.user_configuration_properties!(opts[:user_config_props])
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
}
|
|
31
|
+
do_soap_request(req, response_class: EwsSoapAvailabilityResponse)
|
|
27
32
|
end
|
|
28
33
|
end
|
|
29
|
-
do_soap_request(req, response_class: EwsSoapAvailabilityResponse)
|
|
30
34
|
end
|
|
31
|
-
|
|
32
|
-
end #ExchangeUserConfiguration
|
|
35
|
+
end
|
|
33
36
|
end
|