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,8 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
class ContactsFolder
|
|
3
|
-
include Viewpoint::EWS
|
|
4
|
-
include Viewpoint::EWS::Types
|
|
5
|
-
include Viewpoint::EWS::Types::GenericFolder
|
|
1
|
+
# frozen_string_literal: true
|
|
6
2
|
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Types
|
|
6
|
+
class ContactsFolder
|
|
7
|
+
include Viewpoint::EWS
|
|
8
|
+
include Viewpoint::EWS::Types
|
|
9
|
+
include Viewpoint::EWS::Types::GenericFolder
|
|
10
|
+
end
|
|
11
|
+
end
|
|
7
12
|
end
|
|
8
13
|
end
|
|
@@ -1,51 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module Viewpoint
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module Types
|
|
22
|
+
# Copied Event EWS data type.
|
|
23
|
+
class CopiedEvent < Event
|
|
24
|
+
COPIED_EVENT_KEY_PATHS = {
|
|
25
|
+
old_item_id: %i[old_item_id attribs],
|
|
26
|
+
old_folder_id: %i[old_folder_id attribs],
|
|
27
|
+
old_parent_folder_id: %i[old_parent_folder_id attribs]
|
|
28
|
+
}.freeze
|
|
29
|
+
|
|
30
|
+
COPIED_EVENT_KEY_TYPES = {}.freeze
|
|
31
|
+
|
|
32
|
+
COPIED_EVENT_KEY_ALIAS = {}.freeze
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def key_paths
|
|
37
|
+
@key_paths ||= super.merge COPIED_EVENT_KEY_PATHS
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def key_types
|
|
41
|
+
@key_types ||= super.merge COPIED_EVENT_KEY_TYPES
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def key_alias
|
|
45
|
+
@key_alias ||= super.merge COPIED_EVENT_KEY_ALIAS
|
|
46
|
+
end
|
|
47
|
+
end
|
|
40
48
|
end
|
|
41
|
-
|
|
42
|
-
def key_types
|
|
43
|
-
@key_types ||= super.merge COPIED_EVENT_KEY_TYPES
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def key_alias
|
|
47
|
-
@key_alias ||= super.merge COPIED_EVENT_KEY_ALIAS
|
|
48
|
-
end
|
|
49
|
-
|
|
50
49
|
end
|
|
51
50
|
end
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module Viewpoint::EWS::Types
|
|
20
|
-
|
|
21
|
-
class CreatedEvent < Event
|
|
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.
|
|
22
18
|
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module Types
|
|
22
|
+
class CreatedEvent < Event
|
|
23
|
+
end
|
|
24
|
+
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module Viewpoint::EWS::Types
|
|
20
|
-
|
|
21
|
-
class DeletedEvent < Event
|
|
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.
|
|
22
18
|
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module Types
|
|
22
|
+
class DeletedEvent < Event
|
|
23
|
+
end
|
|
24
|
+
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Types
|
|
6
|
+
class DistributionList
|
|
7
|
+
include Viewpoint::EWS
|
|
8
|
+
include Viewpoint::EWS::Types
|
|
9
|
+
include Viewpoint::EWS::Types::Item
|
|
10
|
+
end
|
|
11
|
+
end
|
|
6
12
|
end
|
|
7
13
|
end
|
data/lib/ews/types/event.rb
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module Viewpoint
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module Types
|
|
22
|
+
# Event EWS data type.
|
|
23
|
+
class Event
|
|
24
|
+
include Viewpoint::EWS
|
|
25
|
+
include Viewpoint::EWS::Types
|
|
26
|
+
include Viewpoint::EWS::Types::Item
|
|
27
|
+
|
|
28
|
+
EVENT_KEY_PATHS = {
|
|
29
|
+
watermark: %i[watermark text],
|
|
30
|
+
timestamp: %i[time_stamp text],
|
|
31
|
+
item_id: %i[item_id attribs],
|
|
32
|
+
folder_id: %i[folder_id attribs],
|
|
33
|
+
parent_folder_id: %i[parent_folder_id attribs]
|
|
34
|
+
}.freeze
|
|
35
|
+
|
|
36
|
+
EVENT_KEY_TYPES = {
|
|
37
|
+
timestamp: ->(ts) { DateTime.iso8601(ts) }
|
|
38
|
+
}.freeze
|
|
39
|
+
|
|
40
|
+
EVENT_KEY_ALIAS = {}.freeze
|
|
41
|
+
|
|
42
|
+
def initialize(ews, event)
|
|
43
|
+
@ews = ews
|
|
44
|
+
super(ews, event)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def key_paths
|
|
50
|
+
@key_paths ||= EVENT_KEY_PATHS
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def key_types
|
|
54
|
+
@key_types ||= EVENT_KEY_TYPES
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def key_alias
|
|
58
|
+
@key_alias ||= EVENT_KEY_ALIAS
|
|
59
|
+
end
|
|
60
|
+
end
|
|
43
61
|
end
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
private
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def key_paths
|
|
50
|
-
@key_paths ||= EVENT_KEY_PATHS
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def key_types
|
|
54
|
-
@key_types ||= EVENT_KEY_TYPES
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def key_alias
|
|
58
|
-
@key_alias ||= EVENT_KEY_ALIAS
|
|
59
|
-
end
|
|
60
|
-
|
|
61
62
|
end
|
|
62
63
|
end
|
|
@@ -1,52 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Types
|
|
6
|
+
# Parses the Export Items operation SOAP response.
|
|
7
|
+
class ExportItemsResponseMessage
|
|
8
|
+
include Viewpoint::EWS
|
|
9
|
+
include Viewpoint::EWS::Types
|
|
10
|
+
include Viewpoint::EWS::Types::Item
|
|
11
|
+
|
|
12
|
+
BULK_KEY_PATHS = {
|
|
13
|
+
id: %i[item_id attribs id],
|
|
14
|
+
change_key: %i[item_id attribs change_key],
|
|
15
|
+
data: %i[data text]
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
BULK_KEY_TYPES = {}.freeze
|
|
19
|
+
|
|
20
|
+
BULK_KEY_ALIAS = {}.freeze
|
|
21
|
+
|
|
22
|
+
def initialize(ews, bulk_item)
|
|
23
|
+
super(ews, bulk_item)
|
|
24
|
+
@item = bulk_item
|
|
25
|
+
@ews = ews
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def id
|
|
29
|
+
@item[:item_id][:attribs][:id]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def change_key
|
|
33
|
+
@item[:item_id][:attribs][:change_key]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def data
|
|
37
|
+
@item[:data][:text]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def key_paths
|
|
43
|
+
@key_paths ||= BULK_KEY_PATHS
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def key_types
|
|
47
|
+
@key_types ||= BULK_KEY_TYPES
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def key_alias
|
|
51
|
+
@key_alias ||= BULK_KEY_ALIAS
|
|
52
|
+
end
|
|
53
|
+
end
|
|
22
54
|
end
|
|
23
|
-
|
|
24
|
-
def id
|
|
25
|
-
@item[:item_id][:attribs][:id]
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def change_key
|
|
29
|
-
@item[:item_id][:attribs][:change_key]
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def data
|
|
33
|
-
@item[:data][:text]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
def key_paths
|
|
40
|
-
@key_paths ||= BULK_KEY_PATHS
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def key_types
|
|
44
|
-
@key_types ||= BULK_KEY_TYPES
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def key_alias
|
|
48
|
-
@key_alias ||= BULK_KEY_ALIAS
|
|
49
|
-
end
|
|
50
|
-
|
|
51
55
|
end
|
|
52
|
-
end
|
|
56
|
+
end
|
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module Viewpoint
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
module Viewpoint
|
|
20
|
+
module EWS
|
|
21
|
+
module Types
|
|
22
|
+
# File Attachment EWS data type.
|
|
23
|
+
class FileAttachment < Attachment
|
|
24
|
+
FILE_ATTACH_KEY_PATHS = {
|
|
25
|
+
is_contact_photo?: %i[is_contact_photo text],
|
|
26
|
+
content: %i[content text]
|
|
27
|
+
}.freeze
|
|
28
|
+
|
|
29
|
+
FILE_ATTACH_KEY_TYPES = {
|
|
30
|
+
is_contact_photo?: ->(str) { str.downcase == 'true' }
|
|
31
|
+
}.freeze
|
|
32
|
+
|
|
33
|
+
FILE_ATTACH_KEY_ALIAS = {
|
|
34
|
+
file_name: :name
|
|
35
|
+
}.freeze
|
|
36
|
+
|
|
37
|
+
def get_all_properties!
|
|
38
|
+
resp = ews.get_attachment attachment_ids: [id]
|
|
39
|
+
@ews_item.merge!(parse_response(resp))
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def key_paths
|
|
45
|
+
super.merge(FILE_ATTACH_KEY_PATHS)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def key_types
|
|
49
|
+
super.merge(FILE_ATTACH_KEY_TYPES)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def key_alias
|
|
53
|
+
super.merge(FILE_ATTACH_KEY_ALIAS)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def parse_response(resp)
|
|
57
|
+
unless resp.status == 'Success'
|
|
58
|
+
raise EwsError,
|
|
59
|
+
"Could not retrieve #{self.class}. #{resp.code}: #{resp.message}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
resp.response_message[:elems][:attachments][:elems][0][:file_attachment][:elems].inject(&:merge)
|
|
63
|
+
end
|
|
60
64
|
end
|
|
61
65
|
end
|
|
62
|
-
|
|
63
66
|
end
|
|
64
67
|
end
|
|
65
|
-
|