viewpoint 1.1.1 → 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 +13 -8
- data/lib/ews/calendar_accessors.rb +37 -33
- data/lib/ews/connection.rb +151 -124
- 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 +1186 -1188
- 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 -67
- 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 +60 -44
- data/lib/ews/types/calendar_item.rb +134 -116
- 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 +32 -22
- 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 +82 -11
- data/Changelog.txt +0 -1004
data/lib/ews/errors.rb
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
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
|
-
|
|
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 Errors
|
|
22
|
+
# Raised for EWS error responses.
|
|
23
|
+
class ResponseError < RuntimeError
|
|
24
|
+
attr_reader :response
|
|
25
|
+
|
|
26
|
+
def initialize(message, response)
|
|
27
|
+
super(message)
|
|
28
|
+
@response = response
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def status
|
|
32
|
+
response.status
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def body
|
|
36
|
+
response.body
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class UnhandledResponseError < ResponseError
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class ServerError < ResponseError
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
class UnauthorizedResponseError < ResponseError
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Raised for SOAP-level error responses.
|
|
50
|
+
class SoapResponseError < ResponseError
|
|
51
|
+
attr_reader :faultcode,
|
|
52
|
+
:faultstring
|
|
53
|
+
|
|
54
|
+
def initialize(message, response, faultcode, faultstring)
|
|
55
|
+
super(message, response)
|
|
56
|
+
@faultcode = faultcode
|
|
57
|
+
@faultstring = faultstring
|
|
58
|
+
end
|
|
59
|
+
end
|
|
54
60
|
end
|
|
55
61
|
end
|
|
56
62
|
end
|
data/lib/ews/ews_client.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'ews/folder_accessors'
|
|
2
4
|
require 'ews/item_accessors'
|
|
3
5
|
require 'ews/message_accessors'
|
|
@@ -10,96 +12,107 @@ require 'ews/convert_accessors'
|
|
|
10
12
|
require 'ews/meeting_accessors'
|
|
11
13
|
|
|
12
14
|
# This class is the glue between the Models and the Web Service.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
module Viewpoint
|
|
16
|
+
# Main entry point for the Exchange Web Services client.
|
|
17
|
+
class EWSClient
|
|
18
|
+
include Viewpoint::EWS
|
|
19
|
+
include Viewpoint::EWS::FolderAccessors
|
|
20
|
+
include Viewpoint::EWS::ItemAccessors
|
|
21
|
+
include Viewpoint::EWS::MessageAccessors
|
|
22
|
+
include Viewpoint::EWS::MailboxAccessors
|
|
23
|
+
include Viewpoint::EWS::PushSubscriptionAccessors
|
|
24
|
+
include Viewpoint::EWS::CalendarAccessors
|
|
25
|
+
include Viewpoint::EWS::RoomAccessors
|
|
26
|
+
include Viewpoint::EWS::RoomlistAccessors
|
|
27
|
+
include Viewpoint::EWS::ConvertAccessors
|
|
28
|
+
include Viewpoint::EWS::MeetingAccessors
|
|
29
|
+
include Viewpoint::StringUtils
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
# The instance of Viewpoint::EWS::SOAP::ExchangeWebService
|
|
32
|
+
attr_reader :ews, :endpoint, :username
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
@
|
|
46
|
-
|
|
47
|
-
opts
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
34
|
+
# Initialize the EWSClient instance.
|
|
35
|
+
# @param [Hash] auth authentication details
|
|
36
|
+
# @option auth [String] :endpoint The EWS endpoint we will be connecting to
|
|
37
|
+
# @option auth [String] :type the authentication type: 'basic' or 'oauth'
|
|
38
|
+
# @option auth [String] :user The user to authenticate as (basic auth). If
|
|
39
|
+
# you are using NTLM or Negotiate authentication you do not need to pass
|
|
40
|
+
# this parameter.
|
|
41
|
+
# @option auth [String] :password The user password (basic auth). If you are
|
|
42
|
+
# using NTLM or Negotiate authentication you do not need to pass this
|
|
43
|
+
# parameter.
|
|
44
|
+
# @option auth [String] :token The OAuth bearer token (oauth auth)
|
|
45
|
+
# @param [Hash] opts Various options to pass to the backends
|
|
46
|
+
# @option opts [String] :server_version The Exchange server version to
|
|
47
|
+
# target. See the VERSION_* constants in
|
|
48
|
+
# Viewpoint::EWS::SOAP::ExchangeWebService.
|
|
49
|
+
# @option opts [Object] :http_class specify an alternate HTTP connection class.
|
|
50
|
+
# @option opts [Hash] :http_opts options to pass to the connection
|
|
51
|
+
def initialize(auth, opts = {})
|
|
52
|
+
# dup all. @see ticket https://github.com/zenchild/Viewpoint/issues/68
|
|
53
|
+
auth = auth.dup
|
|
54
|
+
opts = opts.dup
|
|
55
|
+
|
|
56
|
+
@auth_type = auth[:type]
|
|
57
|
+
@auth_token = auth[:token]
|
|
58
|
+
|
|
59
|
+
@endpoint = auth[:endpoint]
|
|
60
|
+
@username = auth[:user]
|
|
61
|
+
password = @auth_type == 'basic' ? auth[:password] : nil
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if deepen
|
|
60
|
-
ews.auto_deepen = true
|
|
61
|
-
else
|
|
62
|
-
behavior = [:raise, :nil].include?(behavior) ? behavior : :raise
|
|
63
|
-
ews.no_auto_deepen_behavior = behavior
|
|
64
|
-
ews.auto_deepen = false
|
|
63
|
+
http_klass = opts[:http_class] || Viewpoint::EWS::Connection
|
|
64
|
+
connection = http_klass.new(auth, opts[:http_opts] || {})
|
|
65
|
+
connection.set_auth(@username, password) unless password.nil?
|
|
66
|
+
|
|
67
|
+
@ews = SOAP::ExchangeWebService.new(connection, opts)
|
|
65
68
|
end
|
|
66
|
-
end
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
# @param deepen [Boolean] true to autodeepen, false otherwise
|
|
71
|
+
# @param behavior [Symbol] :raise, :nil When setting autodeepen to false you
|
|
72
|
+
# can choose what the behavior is when an attribute does not exist. The
|
|
73
|
+
# default is to raise a EwsMinimalObjectError.
|
|
74
|
+
def set_auto_deepen(deepen, behavior = :raise)
|
|
75
|
+
if deepen
|
|
76
|
+
ews.auto_deepen = true
|
|
77
|
+
else
|
|
78
|
+
behavior = %i[raise nil].include?(behavior) ? behavior : :raise
|
|
79
|
+
ews.no_auto_deepen_behavior = behavior
|
|
80
|
+
ews.auto_deepen = false
|
|
81
|
+
end
|
|
82
|
+
end
|
|
71
83
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def set_time_zone(microsoft_time_zone_id)
|
|
76
|
-
ews.set_time_zone_context microsoft_time_zone_id
|
|
77
|
-
end
|
|
84
|
+
def auto_deepen=(deepen)
|
|
85
|
+
set_auto_deepen deepen
|
|
86
|
+
end
|
|
78
87
|
|
|
79
|
-
|
|
88
|
+
# Specify a default time zone context for all time attributes
|
|
89
|
+
# @param id [String] Identifier of a Microsoft well known time zone (e.g: 'UTC', 'W. Europe Standard Time')
|
|
90
|
+
# @note A list of time zones known by the server can be requested via {EWS::SOAP::ExchangeTimeZones#get_time_zones}
|
|
91
|
+
def set_time_zone(microsoft_time_zone_id) # rubocop:disable Naming/AccessorMethodName -- public API name
|
|
92
|
+
ews.set_time_zone_context microsoft_time_zone_id
|
|
93
|
+
end
|
|
80
94
|
|
|
95
|
+
private
|
|
81
96
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
# This method also exists in EWS::Types, but there is a lot of other stuff
|
|
98
|
+
# in there that I didn't want to include directly in this class.
|
|
99
|
+
def class_by_name(cname)
|
|
100
|
+
cname = camel_case(cname) if cname.instance_of? Symbol
|
|
101
|
+
Viewpoint::EWS::Types.const_get(cname)
|
|
87
102
|
end
|
|
88
|
-
Viewpoint::EWS::Types.const_get(cname)
|
|
89
|
-
end
|
|
90
103
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
# Used for multiple accessors
|
|
105
|
+
def merge_restrictions!(obj, merge_type = :and)
|
|
106
|
+
if obj.opts[:restriction] && !obj.opts[:restriction].empty? && !obj.restriction.empty?
|
|
107
|
+
obj.opts[:restriction] = {
|
|
108
|
+
merge_type => [
|
|
109
|
+
obj.opts.delete(:restriction),
|
|
110
|
+
obj.restriction
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
elsif !obj.restriction.empty?
|
|
114
|
+
obj.opts[:restriction] = obj.restriction
|
|
115
|
+
end
|
|
102
116
|
end
|
|
103
117
|
end
|
|
104
|
-
|
|
105
118
|
end
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
module Viewpoint
|
|
19
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
end
|
|
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
|
+
module Viewpoint
|
|
19
|
+
module EWS
|
|
20
|
+
# Generic Ews Error
|
|
21
|
+
class EwsError < StandardError; end
|
|
22
|
+
|
|
23
|
+
# Raise when authentication/authorization issues occur.
|
|
24
|
+
class EwsLoginError < EwsError; end
|
|
25
|
+
|
|
26
|
+
class EwsSubscriptionError < EwsError; end
|
|
27
|
+
|
|
28
|
+
# Raised when a user tries to query a folder subscription after the
|
|
29
|
+
# subscription has timed out.
|
|
30
|
+
class EwsSubscriptionTimeout < EwsSubscriptionError; end
|
|
31
|
+
|
|
32
|
+
# Represents a function in EWS that is not yet implemented in Viewpoint
|
|
33
|
+
class EwsNotImplemented < EwsError; end
|
|
34
|
+
|
|
35
|
+
# Raised when an method is called in the wrong way
|
|
36
|
+
class EwsBadArgumentError < EwsError; end
|
|
37
|
+
|
|
38
|
+
# Raised when an item that is asked for is not found
|
|
39
|
+
class EwsItemNotFound < EwsError; end
|
|
40
|
+
|
|
41
|
+
# Raised when a folder that is asked for is not found
|
|
42
|
+
class EwsFolderNotFound < EwsError; end
|
|
43
|
+
|
|
44
|
+
# Raise an Exchange Server version error. This is in case some functionality
|
|
45
|
+
# does not exist in a particular Server version but is called.
|
|
46
|
+
class EwsServerVersionError < EwsError; end
|
|
47
|
+
|
|
48
|
+
# Raised when #auto_deepen == false and a method is called for attributes
|
|
49
|
+
# that have not yet been fetched.
|
|
50
|
+
class EwsMinimalObjectError < EwsError; end
|
|
51
|
+
|
|
52
|
+
class EwsFrozenObjectError < EwsError; end
|
|
53
|
+
|
|
54
|
+
# Failed to save an object back to the EWS store.
|
|
55
|
+
class SaveFailed < EwsError; end
|
|
56
|
+
|
|
57
|
+
class EwsCreateItemError < EwsError; end
|
|
58
|
+
|
|
59
|
+
class EwsSendItemError < EwsError; end
|
|
60
|
+
end
|
|
61
|
+
end
|