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