stxt-viewpoint 1.0.0.beta.3
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 +7 -0
- data/Changelog.txt +1004 -0
- data/README.md +201 -0
- data/TODO +17 -0
- data/lib/ews/calendar_accessors.rb +46 -0
- data/lib/ews/connection.rb +120 -0
- data/lib/ews/connection_helper.rb +35 -0
- data/lib/ews/convert_accessors.rb +56 -0
- data/lib/ews/errors.rb +56 -0
- data/lib/ews/ews_client.rb +101 -0
- data/lib/ews/exceptions/exceptions.rb +61 -0
- data/lib/ews/folder_accessors.rb +264 -0
- data/lib/ews/impersonation.rb +30 -0
- data/lib/ews/item_accessors.rb +231 -0
- data/lib/ews/mailbox_accessors.rb +92 -0
- data/lib/ews/message_accessors.rb +93 -0
- data/lib/ews/push_subscription_accessors.rb +33 -0
- data/lib/ews/room_accessors.rb +48 -0
- data/lib/ews/roomlist_accessors.rb +47 -0
- data/lib/ews/soap/builders/ews_builder.rb +1257 -0
- data/lib/ews/soap/ews_response.rb +84 -0
- data/lib/ews/soap/ews_soap_availability_response.rb +58 -0
- data/lib/ews/soap/ews_soap_free_busy_response.rb +119 -0
- data/lib/ews/soap/ews_soap_response.rb +103 -0
- data/lib/ews/soap/ews_soap_room_response.rb +53 -0
- data/lib/ews/soap/ews_soap_roomlist_response.rb +54 -0
- data/lib/ews/soap/exchange_availability.rb +61 -0
- data/lib/ews/soap/exchange_data_services.rb +780 -0
- data/lib/ews/soap/exchange_notification.rb +146 -0
- data/lib/ews/soap/exchange_synchronization.rb +93 -0
- data/lib/ews/soap/exchange_time_zones.rb +56 -0
- data/lib/ews/soap/exchange_user_configuration.rb +33 -0
- data/lib/ews/soap/exchange_web_service.rb +264 -0
- data/lib/ews/soap/parsers/ews_parser.rb +43 -0
- data/lib/ews/soap/parsers/ews_sax_document.rb +70 -0
- data/lib/ews/soap/response_message.rb +80 -0
- data/lib/ews/soap/responses/create_attachment_response_message.rb +47 -0
- data/lib/ews/soap/responses/create_item_response_message.rb +25 -0
- data/lib/ews/soap/responses/find_item_response_message.rb +80 -0
- data/lib/ews/soap/responses/get_events_response_message.rb +53 -0
- data/lib/ews/soap/responses/send_notification_response_message.rb +59 -0
- data/lib/ews/soap/responses/subscribe_response_message.rb +35 -0
- data/lib/ews/soap/responses/sync_folder_hierarchy_response_message.rb +36 -0
- data/lib/ews/soap/responses/sync_folder_items_response_message.rb +36 -0
- data/lib/ews/soap.rb +63 -0
- data/lib/ews/templates/calendar_item.rb +78 -0
- data/lib/ews/templates/forward_item.rb +24 -0
- data/lib/ews/templates/message.rb +73 -0
- data/lib/ews/templates/reply_to_item.rb +25 -0
- data/lib/ews/templates/task.rb +74 -0
- data/lib/ews/types/attachment.rb +77 -0
- data/lib/ews/types/attendee.rb +27 -0
- data/lib/ews/types/calendar_folder.rb +50 -0
- data/lib/ews/types/calendar_item.rb +122 -0
- data/lib/ews/types/contact.rb +7 -0
- data/lib/ews/types/contacts_folder.rb +8 -0
- data/lib/ews/types/copied_event.rb +51 -0
- data/lib/ews/types/created_event.rb +24 -0
- data/lib/ews/types/deleted_event.rb +24 -0
- data/lib/ews/types/distribution_list.rb +7 -0
- data/lib/ews/types/event.rb +62 -0
- data/lib/ews/types/export_items_response_message.rb +52 -0
- data/lib/ews/types/file_attachment.rb +65 -0
- data/lib/ews/types/folder.rb +60 -0
- data/lib/ews/types/free_busy_changed_event.rb +24 -0
- data/lib/ews/types/generic_folder.rb +420 -0
- data/lib/ews/types/item.rb +438 -0
- data/lib/ews/types/item_attachment.rb +84 -0
- data/lib/ews/types/item_field_uri_map.rb +224 -0
- data/lib/ews/types/mailbox_user.rb +156 -0
- data/lib/ews/types/meeting_cancellation.rb +7 -0
- data/lib/ews/types/meeting_message.rb +7 -0
- data/lib/ews/types/meeting_request.rb +7 -0
- data/lib/ews/types/meeting_response.rb +7 -0
- data/lib/ews/types/message.rb +7 -0
- data/lib/ews/types/modified_event.rb +48 -0
- data/lib/ews/types/moved_event.rb +51 -0
- data/lib/ews/types/new_mail_event.rb +24 -0
- data/lib/ews/types/out_of_office.rb +147 -0
- data/lib/ews/types/search_folder.rb +8 -0
- data/lib/ews/types/status_event.rb +39 -0
- data/lib/ews/types/task.rb +37 -0
- data/lib/ews/types/tasks_folder.rb +27 -0
- data/lib/ews/types.rb +191 -0
- data/lib/viewpoint/logging/config.rb +24 -0
- data/lib/viewpoint/logging.rb +27 -0
- data/lib/viewpoint/string_utils.rb +44 -0
- data/lib/viewpoint.rb +109 -0
- metadata +191 -0
@@ -0,0 +1,147 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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::Types
|
20
|
+
|
21
|
+
OOF_KEY_PATHS = {
|
22
|
+
:enabled? => [:oof_settings, :oof_state],
|
23
|
+
:scheduled? => [:oof_settings, :oof_state],
|
24
|
+
:duration => [:oof_settings, :duration],
|
25
|
+
}
|
26
|
+
|
27
|
+
OOF_KEY_TYPES = {
|
28
|
+
:enabled? => ->(str){str == :enabled},
|
29
|
+
:scheduled? => ->(str){str == :scheduled},
|
30
|
+
:duration => ->(hsh){ hsh[:start_time]..hsh[:end_time] },
|
31
|
+
}
|
32
|
+
|
33
|
+
OOF_KEY_ALIAS = {}
|
34
|
+
|
35
|
+
# This represents OutOfOffice settings
|
36
|
+
# @see http://msdn.microsoft.com/en-us/library/aa563465.aspx
|
37
|
+
class OutOfOffice
|
38
|
+
include Viewpoint::EWS
|
39
|
+
include Viewpoint::EWS::Types
|
40
|
+
|
41
|
+
attr_reader :user
|
42
|
+
|
43
|
+
# @param [MailboxUser] user
|
44
|
+
# @param [Hash] ews_item
|
45
|
+
def initialize(user, ews_item)
|
46
|
+
@ews = user.ews
|
47
|
+
@user = user
|
48
|
+
@ews_item = ews_item
|
49
|
+
@changed = false
|
50
|
+
simplify!
|
51
|
+
end
|
52
|
+
|
53
|
+
def changed?
|
54
|
+
@changed
|
55
|
+
end
|
56
|
+
|
57
|
+
def save!
|
58
|
+
return true unless changed?
|
59
|
+
opts = { mailbox: {address: user.email_address} }.merge(@ews_item[:oof_settings])
|
60
|
+
resp = @ews.set_user_oof_settings(opts)
|
61
|
+
if resp.success?
|
62
|
+
@changed = false
|
63
|
+
true
|
64
|
+
else
|
65
|
+
raise SaveFailed, "Could not save #{self.class}. #{resp.code}: #{resp.message}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def enable
|
70
|
+
return true if enabled?
|
71
|
+
@changed = true
|
72
|
+
@ews_item[:oof_settings][:oof_state] = :enabled
|
73
|
+
end
|
74
|
+
|
75
|
+
def disable
|
76
|
+
return true unless enabled? || scheduled?
|
77
|
+
@changed = true
|
78
|
+
@ews_item[:oof_settings][:oof_state] = :disabled
|
79
|
+
end
|
80
|
+
|
81
|
+
# Schedule an out of office.
|
82
|
+
# @param [DateTime] start_time
|
83
|
+
# @param [DateTime] end_time
|
84
|
+
def schedule(start_time, end_time)
|
85
|
+
@changed = true
|
86
|
+
@ews_item[:oof_settings][:oof_state] = :scheduled
|
87
|
+
set_duration start_time, end_time
|
88
|
+
end
|
89
|
+
|
90
|
+
# Specify a duration for this Out Of Office setting
|
91
|
+
# @param [DateTime] start_time
|
92
|
+
# @param [DateTime] end_time
|
93
|
+
def set_duration(start_time, end_time)
|
94
|
+
@changed = true
|
95
|
+
@ews_item[:oof_settings][:duration][:start_time] = start_time
|
96
|
+
@ews_item[:oof_settings][:duration][:end_time] = end_time
|
97
|
+
end
|
98
|
+
|
99
|
+
# A message to send to internal users
|
100
|
+
# @param [String] message
|
101
|
+
def internal_reply=(message)
|
102
|
+
@changed = true
|
103
|
+
@ews_item[:oof_settings][:internal_reply] = message
|
104
|
+
end
|
105
|
+
|
106
|
+
# A message to send to external users
|
107
|
+
# @param [String] message
|
108
|
+
def external_reply=(message)
|
109
|
+
@changed = true
|
110
|
+
@ews_item[:oof_settings][:external_reply] = message
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def key_paths
|
117
|
+
@key_paths ||= super.merge(OOF_KEY_PATHS)
|
118
|
+
end
|
119
|
+
|
120
|
+
def key_types
|
121
|
+
@key_types ||= super.merge(OOF_KEY_TYPES)
|
122
|
+
end
|
123
|
+
|
124
|
+
def key_alias
|
125
|
+
@key_alias ||= super.merge(OOF_KEY_ALIAS)
|
126
|
+
end
|
127
|
+
|
128
|
+
def simplify!
|
129
|
+
oof_settings = @ews_item[:oof_settings][:elems].inject(:merge)
|
130
|
+
oof_settings[:oof_state] = oof_settings[:oof_state][:text].downcase.to_sym
|
131
|
+
oof_settings[:external_audience] = oof_settings[:external_audience][:text]
|
132
|
+
if oof_settings[:duration]
|
133
|
+
dur = oof_settings[:duration][:elems].inject(:merge)
|
134
|
+
oof_settings[:duration] = {
|
135
|
+
start_time: DateTime.iso8601(dur[:start_time][:text]),
|
136
|
+
end_time: DateTime.iso8601(dur[:end_time][:text])
|
137
|
+
}
|
138
|
+
end
|
139
|
+
oof_settings[:internal_reply] = oof_settings[:internal_reply][:elems][0][:message][:text] || ""
|
140
|
+
oof_settings[:external_reply] = oof_settings[:external_reply][:elems][0][:message][:text] || ""
|
141
|
+
@ews_item[:oof_settings] = oof_settings
|
142
|
+
@ews_item[:allow_external_oof] = @ews_item[:allow_external_oof][:text]
|
143
|
+
end
|
144
|
+
|
145
|
+
end #OutOfOffice
|
146
|
+
|
147
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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::Types
|
20
|
+
|
21
|
+
class StatusEvent
|
22
|
+
include Viewpoint::EWS
|
23
|
+
include Viewpoint::EWS::Types
|
24
|
+
include Viewpoint::EWS::Types::Item
|
25
|
+
|
26
|
+
STATUS_EVENT_KEY_PATHS = {
|
27
|
+
:watermark => [:watermark, :text],
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
|
34
|
+
def key_paths
|
35
|
+
@key_paths ||= STATUS_EVENT_KEY_PATHS
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Viewpoint::EWS::Types
|
2
|
+
class Task
|
3
|
+
include Viewpoint::EWS
|
4
|
+
include Viewpoint::EWS::Types
|
5
|
+
include Viewpoint::EWS::Types::Item
|
6
|
+
|
7
|
+
TASK_KEY_PATHS = {
|
8
|
+
complete?: [:is_complete, :text],
|
9
|
+
recurring?: [:is_recurring, :text],
|
10
|
+
start_date: [:start_date, :text],
|
11
|
+
due_date: [:end_date, :text],
|
12
|
+
reminder_due_by: [:reminder_due_by, :text],
|
13
|
+
reminder?: [:reminder_is_set, :text],
|
14
|
+
}
|
15
|
+
|
16
|
+
TASK_KEY_TYPES = {
|
17
|
+
recurring?: ->(str){str.downcase == 'true'},
|
18
|
+
complete?: ->(str){str.downcase == 'true'},
|
19
|
+
reminder?: ->(str){str.downcase == 'true'},
|
20
|
+
}
|
21
|
+
TASK_KEY_ALIAS = {}
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def key_paths
|
26
|
+
super.merge(TASK_KEY_PATHS)
|
27
|
+
end
|
28
|
+
|
29
|
+
def key_types
|
30
|
+
super.merge(TASK_KEY_TYPES)
|
31
|
+
end
|
32
|
+
|
33
|
+
def key_alias
|
34
|
+
super.merge(TASK_KEY_ALIAS)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Viewpoint::EWS::Types
|
2
|
+
class TasksFolder
|
3
|
+
include Viewpoint::EWS
|
4
|
+
include Viewpoint::EWS::Types
|
5
|
+
include Viewpoint::EWS::Types::GenericFolder
|
6
|
+
|
7
|
+
# Creates a new task
|
8
|
+
# @param attributes [Hash] Parameters of the task. Some example attributes are listed below.
|
9
|
+
# @option attributes :subject [String]
|
10
|
+
# @option attributes :start_date [Time]
|
11
|
+
# @option attributes :due_date [Time]
|
12
|
+
# @option attributes :reminder_due_by [Time]
|
13
|
+
# @option attributes :reminder_is_set [Boolean]
|
14
|
+
# @return [Task]
|
15
|
+
# @see Template::Task
|
16
|
+
def create_item(attributes)
|
17
|
+
template = Viewpoint::EWS::Template::Task.new attributes
|
18
|
+
template.saved_item_folder_id = {id: self.id, change_key: self.change_key}
|
19
|
+
rm = ews.create_item(template.to_ews_create).response_messages.first
|
20
|
+
if rm && rm.success?
|
21
|
+
Task.new ews, rm.items.first[:task][:elems].first
|
22
|
+
else
|
23
|
+
raise EwsCreateItemError, "Could not create item in folder. #{rm.code}: #{rm.message_text}" unless rm
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/ews/types.rb
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
module Viewpoint::EWS
|
2
|
+
module Types
|
3
|
+
include Viewpoint::StringUtils
|
4
|
+
|
5
|
+
KEY_PATHS = {
|
6
|
+
extended_properties: [:extended_property],
|
7
|
+
}
|
8
|
+
KEY_TYPES = {
|
9
|
+
extended_properties: :build_extended_properties,
|
10
|
+
}
|
11
|
+
KEY_ALIAS = {}
|
12
|
+
|
13
|
+
attr_reader :ews_item
|
14
|
+
|
15
|
+
# @param [SOAP::ExchangeWebService] ews the EWS reference
|
16
|
+
# @param [Hash] ews_item the EWS parsed response document
|
17
|
+
def initialize(ews, ews_item)
|
18
|
+
@ews = ews
|
19
|
+
@ews_item = ews_item
|
20
|
+
@shallow = true
|
21
|
+
@frozen = false
|
22
|
+
end
|
23
|
+
|
24
|
+
def method_missing(method_sym, *arguments, &block)
|
25
|
+
if method_keys.include?(method_sym)
|
26
|
+
type_convert( method_sym, resolve_method(method_sym) )
|
27
|
+
else
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_s
|
33
|
+
"#{self.class.name}: EWS METHODS: #{self.ews_methods.sort.join(', ')}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def frozen?
|
37
|
+
@frozen
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param ronly [Boolean] true to freeze
|
41
|
+
def freeze!
|
42
|
+
@frozen = true
|
43
|
+
end
|
44
|
+
|
45
|
+
def unfreeze!
|
46
|
+
@frozen = false
|
47
|
+
end
|
48
|
+
|
49
|
+
def shallow?
|
50
|
+
@shallow
|
51
|
+
end
|
52
|
+
|
53
|
+
def mark_deep!
|
54
|
+
@shallow = false
|
55
|
+
end
|
56
|
+
|
57
|
+
def auto_deepen?
|
58
|
+
ews.auto_deepen
|
59
|
+
end
|
60
|
+
|
61
|
+
def deepen!
|
62
|
+
if shallow?
|
63
|
+
self.get_all_properties!
|
64
|
+
@shallow = false
|
65
|
+
true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
alias_method :enlighten!, :deepen!
|
69
|
+
|
70
|
+
# @see http://www.ruby-doc.org/core/classes/Object.html#M000333
|
71
|
+
def respond_to?(method_sym, include_private = false)
|
72
|
+
if method_keys.include?(method_sym)
|
73
|
+
true
|
74
|
+
else
|
75
|
+
super
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def methods(include_super = true)
|
80
|
+
super + ews_methods
|
81
|
+
end
|
82
|
+
|
83
|
+
def ews_methods
|
84
|
+
key_paths.keys + key_alias.keys
|
85
|
+
end
|
86
|
+
|
87
|
+
protected # things like OutOfOffice need protected level access
|
88
|
+
|
89
|
+
def ews
|
90
|
+
@ews
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def key_paths
|
96
|
+
KEY_PATHS
|
97
|
+
end
|
98
|
+
|
99
|
+
def key_types
|
100
|
+
KEY_TYPES
|
101
|
+
end
|
102
|
+
|
103
|
+
def key_alias
|
104
|
+
KEY_ALIAS
|
105
|
+
end
|
106
|
+
|
107
|
+
def class_by_name(cname)
|
108
|
+
if(cname.instance_of? Symbol)
|
109
|
+
cname = camel_case(cname)
|
110
|
+
end
|
111
|
+
Viewpoint::EWS::Types.const_get(cname)
|
112
|
+
end
|
113
|
+
|
114
|
+
def type_convert(key,str)
|
115
|
+
return nil if str.nil?
|
116
|
+
key = key_alias[key] || key
|
117
|
+
if key_types[key]
|
118
|
+
key_types[key].is_a?(Symbol) ? method(key_types[key]).call(str) : key_types[key].call(str)
|
119
|
+
else
|
120
|
+
str
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def resolve_method(method_sym)
|
125
|
+
begin
|
126
|
+
resolve_key_path(@ews_item, method_path(method_sym))
|
127
|
+
rescue
|
128
|
+
if shallow?
|
129
|
+
if frozen?
|
130
|
+
raise EwsFrozenObjectError, "Could not resolve :#{method_sym} on frozen object."
|
131
|
+
elsif auto_deepen?
|
132
|
+
enlighten!
|
133
|
+
retry
|
134
|
+
else
|
135
|
+
if !auto_deepen?
|
136
|
+
if ews.no_auto_deepen_behavior == :raise
|
137
|
+
raise EwsMinimalObjectError, "Could not resolve :#{method_sym}. #auto_deepen set to false"
|
138
|
+
else
|
139
|
+
nil
|
140
|
+
end
|
141
|
+
else
|
142
|
+
end
|
143
|
+
end
|
144
|
+
else
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def resolve_key_path(hsh, path)
|
151
|
+
k = path.first
|
152
|
+
return hsh[k] if path.length == 1
|
153
|
+
resolve_key_path(hsh[k],path[1..-1])
|
154
|
+
end
|
155
|
+
|
156
|
+
def method_keys
|
157
|
+
key_paths.keys + key_alias.keys
|
158
|
+
end
|
159
|
+
|
160
|
+
# Resolve the method path with or without an alias
|
161
|
+
def method_path(sym)
|
162
|
+
key_paths[key_alias[sym] || sym]
|
163
|
+
end
|
164
|
+
|
165
|
+
def build_extended_properties(eprops)
|
166
|
+
h = {}
|
167
|
+
# todo
|
168
|
+
# the return pattern seems broken in some cases,
|
169
|
+
# probably needs fixing via a dedicated response parser
|
170
|
+
eprops.each do |e|
|
171
|
+
if e.size == 1
|
172
|
+
e[:elems].each_cons(2) do |k,v|
|
173
|
+
key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
|
174
|
+
val = v[:value][:text]
|
175
|
+
h.store(key,val)
|
176
|
+
end
|
177
|
+
elsif e.size == 2
|
178
|
+
e[1].each_cons(2) do |k,v|
|
179
|
+
key = k[:extended_field_u_r_i][:attribs][:property_name].downcase.to_sym
|
180
|
+
val = v[:value][:text]
|
181
|
+
h.store(key,val)
|
182
|
+
end
|
183
|
+
else
|
184
|
+
raise EwsMinimalObjectError, "Not prepared to deal with elements greater than 2"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
h
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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
|
20
|
+
module EWS
|
21
|
+
Logging.logger.root.level = :debug
|
22
|
+
Logging.logger.root.appenders = Logging.appenders.stdout
|
23
|
+
end # EWS
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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
|
20
|
+
module EWS
|
21
|
+
attr_reader :logger
|
22
|
+
|
23
|
+
def self.root_logger
|
24
|
+
Logging.logger.root
|
25
|
+
end
|
26
|
+
end # EWS
|
27
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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
|
20
|
+
# Collection of utility methods for working with Strings
|
21
|
+
module StringUtils
|
22
|
+
|
23
|
+
def self.included(klass)
|
24
|
+
klass.extend StringUtils
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
# Change CamelCased strings to ruby_cased strings
|
30
|
+
# It uses the lookahead assertion ?= In this case it basically says match
|
31
|
+
# anything followed by a capital letter, but not the capital letter itself.
|
32
|
+
# @see http://www.pcre.org/pcre.txt The PCRE guide for more details
|
33
|
+
def ruby_case(input)
|
34
|
+
input.to_s.split(/(?=[A-Z])/).join('_').downcase
|
35
|
+
end
|
36
|
+
|
37
|
+
# Change a ruby_cased string to CamelCased
|
38
|
+
def camel_case(input)
|
39
|
+
input.to_s.split(/_/).map { |i|
|
40
|
+
i.sub(/^./) { |s| s.upcase }
|
41
|
+
}.join
|
42
|
+
end
|
43
|
+
end # StringUtils
|
44
|
+
end # Viewpoint
|
data/lib/viewpoint.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
=begin
|
2
|
+
This file is part of Viewpoint; the Ruby library for Microsoft Exchange Web Services.
|
3
|
+
|
4
|
+
Copyright © 2011 Dan Wanek <dan.wanek@gmail.com>
|
5
|
+
|
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
|
9
|
+
|
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
|
+
require 'kconv' if(RUBY_VERSION.start_with? '1.9') # bug in rubyntlm with ruby 1.9.x
|
20
|
+
require 'date'
|
21
|
+
require 'base64'
|
22
|
+
require 'nokogiri'
|
23
|
+
require 'ostruct'
|
24
|
+
require 'logging'
|
25
|
+
|
26
|
+
# String utilities
|
27
|
+
require 'viewpoint/string_utils'
|
28
|
+
|
29
|
+
# Load the logging setup
|
30
|
+
require 'viewpoint/logging'
|
31
|
+
|
32
|
+
# Load the Exception classes
|
33
|
+
require 'ews/exceptions/exceptions'
|
34
|
+
|
35
|
+
# Load the backend SOAP / EWS infrastructure.
|
36
|
+
require 'ews/soap'
|
37
|
+
require 'ews/soap/response_message'
|
38
|
+
require 'ews/soap/ews_response'
|
39
|
+
require 'ews/soap/ews_soap_response'
|
40
|
+
require 'ews/soap/ews_soap_availability_response'
|
41
|
+
require 'ews/soap/ews_soap_free_busy_response'
|
42
|
+
require 'ews/soap/ews_soap_room_response'
|
43
|
+
require 'ews/soap/ews_soap_roomlist_response'
|
44
|
+
require 'ews/soap/builders/ews_builder'
|
45
|
+
require 'ews/soap/parsers/ews_parser'
|
46
|
+
require 'ews/soap/parsers/ews_sax_document'
|
47
|
+
# Mix-ins for the ExchangeWebService
|
48
|
+
require 'ews/soap/exchange_data_services'
|
49
|
+
require 'ews/soap/exchange_notification'
|
50
|
+
require 'ews/soap/exchange_synchronization'
|
51
|
+
require 'ews/soap/exchange_availability'
|
52
|
+
require 'ews/soap/exchange_user_configuration'
|
53
|
+
require 'ews/soap/exchange_time_zones'
|
54
|
+
require 'ews/soap/exchange_web_service'
|
55
|
+
|
56
|
+
require 'ews/errors'
|
57
|
+
require 'ews/connection_helper'
|
58
|
+
require 'ews/connection'
|
59
|
+
|
60
|
+
require 'ews/impersonation'
|
61
|
+
|
62
|
+
# Base Types
|
63
|
+
require 'ews/types'
|
64
|
+
require 'ews/types/item_field_uri_map'
|
65
|
+
require 'ews/types/generic_folder'
|
66
|
+
require 'ews/types/item'
|
67
|
+
# Folders
|
68
|
+
require 'ews/types/folder'
|
69
|
+
require 'ews/types/calendar_folder'
|
70
|
+
require 'ews/types/contacts_folder'
|
71
|
+
require 'ews/types/tasks_folder'
|
72
|
+
require 'ews/types/search_folder'
|
73
|
+
# Items
|
74
|
+
require 'ews/types/message'
|
75
|
+
require 'ews/types/calendar_item'
|
76
|
+
require 'ews/types/contact'
|
77
|
+
require 'ews/types/distribution_list'
|
78
|
+
require 'ews/types/meeting_message'
|
79
|
+
require 'ews/types/meeting_request'
|
80
|
+
require 'ews/types/meeting_response'
|
81
|
+
require 'ews/types/meeting_cancellation'
|
82
|
+
require 'ews/types/task'
|
83
|
+
require 'ews/types/attachment'
|
84
|
+
require 'ews/types/file_attachment'
|
85
|
+
require 'ews/types/item_attachment'
|
86
|
+
require 'ews/types/mailbox_user'
|
87
|
+
require 'ews/types/out_of_office'
|
88
|
+
require 'ews/types/export_items_response_message'
|
89
|
+
|
90
|
+
# Events
|
91
|
+
require 'ews/types/event'
|
92
|
+
require 'ews/types/copied_event'
|
93
|
+
require 'ews/types/created_event'
|
94
|
+
require 'ews/types/deleted_event'
|
95
|
+
require 'ews/types/free_busy_changed_event'
|
96
|
+
require 'ews/types/modified_event'
|
97
|
+
require 'ews/types/moved_event'
|
98
|
+
require 'ews/types/new_mail_event'
|
99
|
+
require 'ews/types/status_event'
|
100
|
+
|
101
|
+
# Template Objects
|
102
|
+
require 'ews/templates/message'
|
103
|
+
require 'ews/templates/forward_item'
|
104
|
+
require 'ews/templates/reply_to_item'
|
105
|
+
require 'ews/templates/calendar_item'
|
106
|
+
require 'ews/templates/task'
|
107
|
+
|
108
|
+
# The proxy between the models and the web service
|
109
|
+
require 'ews/ews_client'
|