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,79 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
module Template
|
|
3
|
-
# Template for creating CalendarItems
|
|
4
|
-
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
|
|
5
|
-
class CalendarItem < OpenStruct
|
|
1
|
+
# frozen_string_literal: true
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Template
|
|
6
|
+
# Template for creating CalendarItems
|
|
7
|
+
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
|
|
8
|
+
class CalendarItem < OpenStruct
|
|
9
|
+
# Available parameters with the required ordering
|
|
10
|
+
PARAMETERS = %w[mime_content item_id parent_folder_id item_class subject sensitivity body attachments
|
|
11
|
+
date_time_received size categories in_reply_to is_submitted is_draft is_from_me
|
|
12
|
+
is_resend is_unmodified internet_message_headers date_time_sent date_time_created
|
|
13
|
+
response_objects reminder_due_by reminder_is_set reminder_minutes_before_start
|
|
14
|
+
display_cc display_to has_attachments extended_property culture start end original_start
|
|
15
|
+
is_all_day_event legacy_free_busy_status location when is_meeting is_cancelled
|
|
16
|
+
is_recurring meeting_request_was_sent is_response_requested calendar_item_type
|
|
17
|
+
my_response_type organizer required_attendees optional_attendees resources
|
|
18
|
+
conflicting_meeting_count adjacent_meeting_count conflicting_meetings adjacent_meetings
|
|
19
|
+
duration time_zone appointment_reply_time appointment_sequence_number appointment_state
|
|
20
|
+
recurrence first_occurrence last_occurrence modified_occurrences deleted_occurrences
|
|
21
|
+
meeting_time_zone start_time_zone end_time_zone conference_type allow_new_time_proposal
|
|
22
|
+
is_online_meeting meeting_workspace_url net_show_url effective_rights last_modified_name
|
|
23
|
+
last_modified_time is_associated web_client_read_form_query_string
|
|
24
|
+
web_client_edit_form_query_string conversation_id unique_body].map(&:to_sym).freeze
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
# Returns a new CalendarItem template
|
|
27
|
+
def initialize(opts = {})
|
|
28
|
+
super opts.dup
|
|
29
|
+
end
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
# EWS CreateItem container
|
|
32
|
+
# @return [Hash]
|
|
33
|
+
def to_ews_create(opts = {})
|
|
34
|
+
structure = {}
|
|
35
|
+
structure[:message_disposition] = (draft ? 'SaveOnly' : 'SendAndSaveCopy')
|
|
36
|
+
# options
|
|
37
|
+
structure[:send_meeting_invitations] =
|
|
38
|
+
(opts.key?(:send_meeting_invitations) ? opts[:send_meeting_invitations] : 'SendToNone')
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
if saved_item_folder_id
|
|
41
|
+
structure[:saved_item_folder_id] = if saved_item_folder_id.is_a?(Hash)
|
|
42
|
+
saved_item_folder_id
|
|
43
|
+
else
|
|
44
|
+
{ id: saved_item_folder_id }
|
|
45
|
+
end
|
|
40
46
|
end
|
|
41
|
-
end
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
structure[:items] = [{ calendar_item: to_ews_item }]
|
|
49
|
+
structure
|
|
50
|
+
end
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
# EWS Item hash
|
|
53
|
+
#
|
|
54
|
+
# Puts all known parameters in the required ordering and structure
|
|
55
|
+
# @return [Hash]
|
|
56
|
+
def to_ews_item
|
|
57
|
+
item_parameters = {}
|
|
58
|
+
PARAMETERS.each do |key|
|
|
59
|
+
next if (value = send(key)).nil?
|
|
55
60
|
|
|
56
61
|
# Convert non duplicable values to String
|
|
57
62
|
case value
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
when NilClass, FalseClass, TrueClass, Symbol, Numeric
|
|
64
|
+
value = value.to_s
|
|
60
65
|
end
|
|
61
66
|
|
|
62
67
|
# Convert attributes
|
|
63
|
-
case key
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
item_parameters[key] = case key
|
|
69
|
+
when :start, :end
|
|
70
|
+
{ text: value.respond_to?(:iso8601) ? value.iso8601 : value }
|
|
71
|
+
when :body
|
|
72
|
+
{ body_type: body_type || 'Text', text: value.to_s }
|
|
73
|
+
else
|
|
74
|
+
value
|
|
75
|
+
end
|
|
71
76
|
end
|
|
72
|
-
end
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
item_parameters
|
|
79
|
+
end
|
|
75
80
|
end
|
|
76
|
-
|
|
77
81
|
end
|
|
78
82
|
end
|
|
79
83
|
end
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
module Template
|
|
3
|
-
class ForwardItem < Message
|
|
1
|
+
# frozen_string_literal: true
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Template
|
|
6
|
+
# Template for building forward-item requests.
|
|
7
|
+
class ForwardItem < Message
|
|
8
|
+
# Format this object for EWS backend consumption.
|
|
9
|
+
def to_ews
|
|
10
|
+
ews_opts, msg = to_ews_basic
|
|
11
|
+
msg[:reference_item_id] = reference_item_id
|
|
12
|
+
msg[:new_body_content] = { text: new_body_content, body_type: new_body_type }
|
|
13
|
+
ews_opts.merge({ items: [{ forward_item: msg }] })
|
|
14
|
+
end
|
|
14
15
|
|
|
16
|
+
private
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
def init_defaults!
|
|
19
|
+
super
|
|
20
|
+
self.new_body_content ||= ''
|
|
21
|
+
self.new_body_type ||= 'Text'
|
|
22
|
+
end
|
|
20
23
|
end
|
|
21
|
-
|
|
22
24
|
end
|
|
23
25
|
end
|
|
24
26
|
end
|
|
@@ -1,76 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ews_opts, msg = to_ews_basic
|
|
13
|
-
ews_opts.merge({items: [{message: msg}]})
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def has_attachments?
|
|
17
|
-
!(file_attachments.empty? && item_attachments.empty? && inline_attachments.empty?)
|
|
18
|
-
end
|
|
19
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Template
|
|
6
|
+
# Template for building message requests.
|
|
7
|
+
class Message < OpenStruct
|
|
8
|
+
def initialize(opts = {})
|
|
9
|
+
super opts.clone
|
|
10
|
+
init_defaults!
|
|
11
|
+
end
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
# Format this object for EWS backend consumption.
|
|
14
|
+
def to_ews
|
|
15
|
+
ews_opts, msg = to_ews_basic
|
|
16
|
+
ews_opts.merge({ items: [{ message: msg }] })
|
|
17
|
+
end
|
|
22
18
|
|
|
19
|
+
def has_attachments? # rubocop:disable Naming/PredicatePrefix -- public API name
|
|
20
|
+
!(file_attachments.empty? && item_attachments.empty? && inline_attachments.empty?)
|
|
21
|
+
end
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def init_defaults!
|
|
26
|
+
self.subject ||= nil
|
|
27
|
+
self.body ||= nil
|
|
28
|
+
self.body_type ||= 'Text'
|
|
29
|
+
self.importance ||= 'Normal'
|
|
30
|
+
self.draft ||= false
|
|
31
|
+
self.is_read = true if is_read.nil?
|
|
32
|
+
self.to_recipients ||= []
|
|
33
|
+
self.cc_recipients ||= []
|
|
34
|
+
self.bcc_recipients ||= []
|
|
35
|
+
self.file_attachments ||= []
|
|
36
|
+
self.item_attachments ||= []
|
|
37
|
+
self.inline_attachments ||= []
|
|
38
|
+
self.extended_properties ||= []
|
|
39
|
+
self.mime_content_charset ||= 'UTF-8'
|
|
40
|
+
end
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
def to_ews_basic
|
|
43
|
+
ews_opts = {}
|
|
44
|
+
ews_opts[:message_disposition] = message_disposition || (draft ? 'SaveOnly' : 'SendAndSaveCopy')
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if saved_item_folder_id
|
|
47
|
+
ews_opts[:saved_item_folder_id] = if saved_item_folder_id.is_a?(Hash)
|
|
48
|
+
saved_item_folder_id
|
|
49
|
+
else
|
|
50
|
+
{ id: saved_item_folder_id }
|
|
51
|
+
end
|
|
49
52
|
end
|
|
50
|
-
end
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
msg = {}
|
|
55
|
+
msg[:mime_content] = { text: mime_content, character_set: mime_content_charset } if mime_content
|
|
56
|
+
msg[:subject] = subject if subject
|
|
57
|
+
msg[:body] = { text: body, body_type: body_type } if body
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
msg[:importance] = importance if importance
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
to_r = to_recipients.collect { |r| { mailbox: { email_address: r } } }
|
|
62
|
+
msg[:to_recipients] = to_r unless to_r.empty?
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
cc_r = cc_recipients.collect { |r| { mailbox: { email_address: r } } }
|
|
65
|
+
msg[:cc_recipients] = cc_r unless cc_r.empty?
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
bcc_r = bcc_recipients.collect { |r| { mailbox: { email_address: r } } }
|
|
68
|
+
msg[:bcc_recipients] = bcc_r unless bcc_r.empty?
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
msg[:is_read] = is_read
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
msg[:extended_properties] = extended_properties unless extended_properties.empty?
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
[ews_opts, msg]
|
|
75
|
+
end
|
|
72
76
|
end
|
|
73
|
-
|
|
74
77
|
end
|
|
75
78
|
end
|
|
76
79
|
end
|
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
module Template
|
|
3
|
-
class ReplyToItem < Message
|
|
1
|
+
# frozen_string_literal: true
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Template
|
|
6
|
+
# Template for building reply-to-item requests.
|
|
7
|
+
class ReplyToItem < Message
|
|
8
|
+
# Format this object for EWS backend consumption.
|
|
9
|
+
def to_ews
|
|
10
|
+
ews_opts, msg = to_ews_basic
|
|
11
|
+
msg[:reference_item_id] = reference_item_id
|
|
12
|
+
msg[:new_body_content] = { text: new_body_content, body_type: new_body_type }
|
|
13
|
+
ews_opts.merge({ items: [{ ews_type => msg }] })
|
|
14
|
+
end
|
|
14
15
|
|
|
16
|
+
private
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
def init_defaults!
|
|
19
|
+
super
|
|
20
|
+
self.new_body_content ||= ''
|
|
21
|
+
self.new_body_type ||= 'Text'
|
|
22
|
+
self.ews_type = :reply_to_item
|
|
23
|
+
end
|
|
21
24
|
end
|
|
22
|
-
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
end
|
data/lib/ews/templates/task.rb
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
module Template
|
|
3
|
-
# Template for creating Tasks
|
|
4
|
-
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
|
|
5
|
-
class Task < OpenStruct
|
|
1
|
+
# frozen_string_literal: true
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
module Viewpoint
|
|
4
|
+
module EWS
|
|
5
|
+
module Template
|
|
6
|
+
# Template for creating Tasks
|
|
7
|
+
# @see http://msdn.microsoft.com/en-us/library/exchange/aa564765.aspx
|
|
8
|
+
class Task < OpenStruct
|
|
9
|
+
# Available parameters with the required ordering
|
|
10
|
+
PARAMETERS = %w[mime_content item_id parent_folder_id item_class subject sensitivity body attachments
|
|
11
|
+
date_time_received size categories in_reply_to is_submitted is_draft is_from_me is_resend
|
|
12
|
+
is_unmodified internet_message_headers date_time_sent date_time_created response_objects
|
|
13
|
+
reminder_due_by reminder_is_set reminder_minutes_before_start display_cc display_to
|
|
14
|
+
has_attachments extended_property culture actual_work assigned_time billing_information
|
|
15
|
+
change_count companies complete_date contacts delegation_state delegator due_date
|
|
16
|
+
is_assignment_editable is_complete is_recurring is_team_task mileage owner percent_complete
|
|
17
|
+
recurrence start_date status status_description total_work effective_rights last_modified_name
|
|
18
|
+
last_modified_time is_associated web_client_read_form_query_string
|
|
19
|
+
web_client_edit_form_query_string conversation_id unique_body].map(&:to_sym).freeze
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
# Returns a new Task template
|
|
22
|
+
def initialize(opts = {})
|
|
23
|
+
super opts.dup
|
|
24
|
+
end
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
# EWS CreateItem container
|
|
27
|
+
# @return [Hash]
|
|
28
|
+
def to_ews_create
|
|
29
|
+
structure = {}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if saved_item_folder_id
|
|
32
|
+
structure[:saved_item_folder_id] = if saved_item_folder_id.is_a?(Hash)
|
|
33
|
+
saved_item_folder_id
|
|
34
|
+
else
|
|
35
|
+
{ id: saved_item_folder_id }
|
|
36
|
+
end
|
|
35
37
|
end
|
|
36
|
-
end
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
structure[:items] = [{ task: to_ews_item }]
|
|
40
|
+
structure
|
|
41
|
+
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
# EWS Item hash
|
|
44
|
+
#
|
|
45
|
+
# Puts all known parameters in the required ordering and structure
|
|
46
|
+
# @return [Hash]
|
|
47
|
+
def to_ews_item
|
|
48
|
+
item_parameters = {}
|
|
49
|
+
PARAMETERS.each do |key|
|
|
50
|
+
next if (value = send(key)).nil?
|
|
50
51
|
|
|
51
52
|
# Convert non duplicable values to String
|
|
52
53
|
case value
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
when NilClass, FalseClass, TrueClass, Symbol, Numeric
|
|
55
|
+
value = value.to_s
|
|
55
56
|
end
|
|
56
57
|
|
|
57
58
|
# Convert attributes
|
|
58
|
-
case key
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
item_parameters[key] = case key
|
|
60
|
+
when :start_date, :due_date
|
|
61
|
+
{ text: value.respond_to?(:iso8601) ? value.iso8601 : value }
|
|
62
|
+
when :body
|
|
63
|
+
{ body_type: body_type || 'Text', text: value.to_s }
|
|
64
|
+
else
|
|
65
|
+
value
|
|
66
|
+
end
|
|
66
67
|
end
|
|
67
|
-
end
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
item_parameters
|
|
70
|
+
end
|
|
70
71
|
end
|
|
71
|
-
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|