viewpoint 0.1.27 → 1.0.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +196 -0
- data/lib/ews/calendar_accessors.rb +34 -0
- data/lib/ews/connection.rb +117 -0
- data/lib/ews/connection_helper.rb +35 -0
- data/lib/ews/ews_client.rb +71 -0
- data/lib/ews/exceptions/exceptions.rb +59 -0
- data/lib/ews/folder_accessors.rb +199 -0
- data/lib/ews/item_accessors.rb +157 -0
- data/lib/ews/mailbox_accessors.rb +87 -0
- data/lib/ews/message_accessors.rb +86 -0
- data/lib/ews/push_subscription_accessors.rb +33 -0
- data/lib/ews/soap.rb +63 -0
- data/lib/ews/soap/builders/ews_builder.rb +1011 -0
- data/lib/ews/soap/ews_response.rb +83 -0
- data/lib/ews/soap/ews_soap_availability_response.rb +58 -0
- data/lib/ews/soap/ews_soap_free_busy_response.rb +109 -0
- data/lib/ews/soap/ews_soap_response.rb +103 -0
- data/lib/ews/soap/exchange_availability.rb +61 -0
- data/lib/ews/soap/exchange_data_services.rb +742 -0
- data/lib/ews/soap/exchange_notification.rb +146 -0
- data/lib/ews/soap/exchange_user_configuration.rb +33 -0
- data/lib/ews/soap/exchange_web_service.rb +294 -0
- data/lib/{model/attendee.rb → ews/soap/parsers/ews_parser.rb} +20 -14
- data/lib/ews/soap/parsers/ews_sax_document.rb +66 -0
- data/lib/ews/soap/response_message.rb +78 -0
- data/lib/ews/soap/responses/create_attachment_response_message.rb +46 -0
- data/lib/{model/meeting_message.rb → ews/soap/responses/create_item_response_message.rb} +7 -10
- 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 +58 -0
- data/lib/{model/attachment.rb → ews/soap/responses/subscribe_response_message.rb} +17 -13
- data/lib/ews/templates/forward_item.rb +24 -0
- data/lib/ews/templates/message.rb +66 -0
- data/lib/ews/templates/reply_to_item.rb +25 -0
- data/lib/ews/types.rb +146 -0
- data/lib/ews/types/attachment.rb +77 -0
- data/lib/{model/meeting_cancellation.rb → ews/types/attendee.rb} +9 -8
- data/lib/ews/types/calendar_folder.rb +8 -0
- data/lib/ews/types/calendar_item.rb +37 -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/{soap/handsoap/builder.rb → ews/types/created_event.rb} +5 -2
- data/lib/{model/meeting_response.rb → ews/types/deleted_event.rb} +6 -6
- data/lib/ews/types/distribution_list.rb +7 -0
- data/lib/ews/types/event.rb +62 -0
- data/lib/ews/types/file_attachment.rb +65 -0
- data/lib/ews/types/folder.rb +60 -0
- data/lib/{model/distribution_list.rb → ews/types/free_busy_changed_event.rb} +6 -6
- data/lib/ews/types/generic_folder.rb +352 -0
- data/lib/ews/types/item.rb +381 -0
- data/lib/ews/types/item_attachment.rb +46 -0
- data/lib/{model → ews/types}/item_field_uri_map.rb +2 -2
- 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/{model/item_attachment.rb → ews/types/moved_event.rb} +33 -15
- 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 +7 -0
- data/lib/ews/types/tasks_folder.rb +8 -0
- data/lib/viewpoint.rb +82 -106
- metadata +99 -67
- data/README +0 -114
- data/lib/exceptions/exceptions.rb +0 -46
- data/lib/model/calendar_folder.rb +0 -67
- data/lib/model/calendar_item.rb +0 -267
- data/lib/model/contact.rb +0 -238
- data/lib/model/contacts_folder.rb +0 -46
- data/lib/model/event.rb +0 -116
- data/lib/model/file_attachment.rb +0 -53
- data/lib/model/folder.rb +0 -47
- data/lib/model/generic_folder.rb +0 -471
- data/lib/model/item.rb +0 -313
- data/lib/model/mailbox_user.rb +0 -146
- data/lib/model/meeting_request.rb +0 -39
- data/lib/model/message.rb +0 -142
- data/lib/model/model.rb +0 -269
- data/lib/model/search_folder.rb +0 -48
- data/lib/model/task.rb +0 -121
- data/lib/model/tasks_folder.rb +0 -44
- data/lib/soap/handsoap/builders/ews_build_helpers.rb +0 -383
- data/lib/soap/handsoap/builders/ews_builder.rb +0 -146
- data/lib/soap/handsoap/ews_service.rb +0 -813
- data/lib/soap/handsoap/parser.rb +0 -104
- data/lib/soap/handsoap/parsers/ews_parser.rb +0 -246
- data/lib/soap/soap_provider.rb +0 -64
@@ -16,22 +16,28 @@
|
|
16
16
|
limitations under the License.
|
17
17
|
=end
|
18
18
|
|
19
|
-
module Viewpoint
|
20
|
-
|
19
|
+
module Viewpoint::EWS::SOAP
|
20
|
+
class EwsParser
|
21
|
+
include Viewpoint::EWS
|
21
22
|
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
# @param [String] soap_resp
|
24
|
+
def initialize(soap_resp)
|
25
|
+
@soap_resp = soap_resp
|
26
|
+
@sax_doc = EwsSaxDocument.new
|
27
|
+
end
|
27
28
|
|
28
|
-
|
29
|
+
def parse(opts = {})
|
30
|
+
opts[:response_class] ||= EwsSoapResponse
|
31
|
+
sax_parser.parse(@soap_resp)
|
32
|
+
opts[:response_class].new @sax_doc.struct
|
33
|
+
end
|
29
34
|
|
30
|
-
def initialize(attendee)
|
31
|
-
@response = attendee[:response_type][:text]
|
32
|
-
super(attendee[:mailbox])
|
33
|
-
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
private
|
37
|
+
|
38
|
+
def sax_parser
|
39
|
+
@parser ||= Nokogiri::XML::SAX::Parser.new(@sax_doc)
|
40
|
+
end
|
41
|
+
|
42
|
+
end # EwsParser
|
37
43
|
end # Viewpoint
|
@@ -0,0 +1,66 @@
|
|
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::SOAP
|
20
|
+
# Parse the incoming response document via a SAX parser instead of the
|
21
|
+
# traditional DOM parser. In early benchmarks this was performing about
|
22
|
+
# 132% faster than the DOM-based parser for large documents.
|
23
|
+
class EwsSaxDocument < Nokogiri::XML::SAX::Document
|
24
|
+
include Viewpoint::EWS
|
25
|
+
|
26
|
+
attr_reader :struct
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
@struct = {}
|
30
|
+
@elems = []
|
31
|
+
end
|
32
|
+
|
33
|
+
def characters(string)
|
34
|
+
string.strip!
|
35
|
+
return if string.empty?
|
36
|
+
if @elems.last[:text]
|
37
|
+
@elems.last[:text] += string
|
38
|
+
else
|
39
|
+
@elems.last[:text] = string
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def start_element_namespace(name, attributes = [], prefix = nil, uri = nil, ns = [])
|
44
|
+
name = name.ruby_case.to_sym
|
45
|
+
elem = {}
|
46
|
+
unless attributes.empty?
|
47
|
+
elem[:attribs] = attributes.collect{|a|
|
48
|
+
{a.localname.ruby_case.to_sym => a.value}
|
49
|
+
}.inject(&:merge)
|
50
|
+
end
|
51
|
+
@elems << elem
|
52
|
+
end
|
53
|
+
|
54
|
+
def end_element_namespace name, prefix=nil, uri=nil
|
55
|
+
name = name.ruby_case.to_sym
|
56
|
+
elem = @elems.pop
|
57
|
+
if @elems.empty?
|
58
|
+
@struct[name] = elem
|
59
|
+
else
|
60
|
+
@elems.last[:elems] = [] unless @elems.last[:elems].is_a?(Array)
|
61
|
+
@elems.last[:elems] << {name => elem}
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,78 @@
|
|
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::SOAP
|
20
|
+
class ResponseMessage
|
21
|
+
|
22
|
+
attr_reader :message
|
23
|
+
|
24
|
+
def initialize(message)
|
25
|
+
@type = message.keys.first
|
26
|
+
@message = message[@type]
|
27
|
+
end
|
28
|
+
|
29
|
+
def response_class
|
30
|
+
message[:attribs][:response_class]
|
31
|
+
end
|
32
|
+
alias :status :response_class
|
33
|
+
|
34
|
+
def success?
|
35
|
+
response_class == 'Success'
|
36
|
+
end
|
37
|
+
|
38
|
+
def message_text
|
39
|
+
safe_hash_access message, [:elems, :message_text, :text]
|
40
|
+
end
|
41
|
+
|
42
|
+
def response_code
|
43
|
+
safe_hash_access message, [:elems, :response_code, :text]
|
44
|
+
end
|
45
|
+
alias :code :response_code
|
46
|
+
|
47
|
+
def message_xml
|
48
|
+
safe_hash_access message, [:elems, :message_xml, :text]
|
49
|
+
end
|
50
|
+
|
51
|
+
def items
|
52
|
+
safe_hash_access(message, [:elems, :items, :elems]) || []
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
|
59
|
+
def safe_hash_access(hsh, keys)
|
60
|
+
key = keys.shift
|
61
|
+
return nil unless hsh.is_a?(Hash) && hsh.has_key?(key)
|
62
|
+
|
63
|
+
if keys.empty?
|
64
|
+
hsh[key]
|
65
|
+
else
|
66
|
+
safe_hash_access hsh[key], keys
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end # Viewpoint::EWS::SOAP
|
72
|
+
|
73
|
+
require_relative './responses/create_item_response_message'
|
74
|
+
require_relative './responses/create_attachment_response_message'
|
75
|
+
require_relative './responses/find_item_response_message'
|
76
|
+
require_relative './responses/subscribe_response_message'
|
77
|
+
require_relative './responses/get_events_response_message'
|
78
|
+
require_relative './responses/send_notification_response_message'
|
@@ -0,0 +1,46 @@
|
|
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::SOAP
|
20
|
+
|
21
|
+
class CreateAttachmentResponseMessage < ResponseMessage
|
22
|
+
|
23
|
+
def attachments
|
24
|
+
return @attachments if @attachments
|
25
|
+
|
26
|
+
a = safe_hash_access message, [:elems, :attachments, :elems]
|
27
|
+
@attachments = a.nil? ? nil : parse_attachments(a)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
|
34
|
+
def parse_attachments(att)
|
35
|
+
att.collect do |a|
|
36
|
+
type = a.keys.first
|
37
|
+
klass = Viewpoint::EWS::Types.const_get(type.to_s.camel_case)
|
38
|
+
item = OpenStruct.new
|
39
|
+
item.ews = nil
|
40
|
+
klass.new(item, a[type])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end # CreateAttachmentResponseMessage
|
45
|
+
|
46
|
+
end # Viewpoint::EWS::SOAP
|
@@ -16,13 +16,10 @@
|
|
16
16
|
limitations under the License.
|
17
17
|
=end
|
18
18
|
|
19
|
-
module Viewpoint
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end # MeetingMessage
|
27
|
-
end # EWS
|
28
|
-
end # Viewpoint
|
19
|
+
module Viewpoint::EWS::SOAP
|
20
|
+
|
21
|
+
class CreateItemResponseMessage < ResponseMessage
|
22
|
+
|
23
|
+
end # CreateItemResponseMessage
|
24
|
+
|
25
|
+
end # Viewpoint::EWS::SOAP
|
@@ -0,0 +1,80 @@
|
|
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::SOAP
|
20
|
+
|
21
|
+
class RootFolder
|
22
|
+
|
23
|
+
attr_reader :root
|
24
|
+
|
25
|
+
def initialize(root)
|
26
|
+
@root = root
|
27
|
+
end
|
28
|
+
|
29
|
+
def indexed_paging_offset
|
30
|
+
attrib :index_paging_offset
|
31
|
+
end
|
32
|
+
|
33
|
+
def numerator_offset
|
34
|
+
attrib :numerator_offset
|
35
|
+
end
|
36
|
+
|
37
|
+
def absolute_denominator
|
38
|
+
attrib :absolute_denominator
|
39
|
+
end
|
40
|
+
|
41
|
+
def includes_last_item_in_range
|
42
|
+
attrib :includes_last_item_in_range
|
43
|
+
end
|
44
|
+
|
45
|
+
def total_items_in_view
|
46
|
+
attrib :total_items_in_view
|
47
|
+
end
|
48
|
+
|
49
|
+
def items
|
50
|
+
root[:elems][0][:items][:elems] || []
|
51
|
+
end
|
52
|
+
|
53
|
+
def groups
|
54
|
+
root[:elems][0][:groups][:elems]
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
|
61
|
+
def attrib(key)
|
62
|
+
return nil unless root.has_key?(:attribs)
|
63
|
+
root[:attribs][key]
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
class FindItemResponseMessage < ResponseMessage
|
70
|
+
|
71
|
+
def root_folder
|
72
|
+
return @root_folder if @root_folder
|
73
|
+
|
74
|
+
rf = safe_hash_access message, [:elems, :root_folder]
|
75
|
+
@root_folder = rf.nil? ? nil : RootFolder.new(rf)
|
76
|
+
end
|
77
|
+
|
78
|
+
end # FindItemResponseMessage
|
79
|
+
|
80
|
+
end # Viewpoint::EWS::SOAP
|
@@ -0,0 +1,53 @@
|
|
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::SOAP
|
20
|
+
class GetEventsResponseMessage < ResponseMessage
|
21
|
+
|
22
|
+
def notification
|
23
|
+
safe_hash_access message, [:elems, :notification, :elems]
|
24
|
+
end
|
25
|
+
|
26
|
+
def subscription_id
|
27
|
+
safe_hash_access notification[0], [:subscription_id, :text]
|
28
|
+
end
|
29
|
+
|
30
|
+
def previous_watermark
|
31
|
+
safe_hash_access notification[1], [:previous_watermark, :text]
|
32
|
+
end
|
33
|
+
|
34
|
+
def new_watermark
|
35
|
+
ev = notification.last
|
36
|
+
if ev
|
37
|
+
type = ev.keys.first
|
38
|
+
ev[type][:elems][0][:watermark][:text]
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def more_events?
|
45
|
+
safe_hash_access(notification[2], [:more_events, :text]) == 'true'
|
46
|
+
end
|
47
|
+
|
48
|
+
def events
|
49
|
+
notification[3..-1]
|
50
|
+
end
|
51
|
+
|
52
|
+
end # GetEventsResponseMessage
|
53
|
+
end # Viewpoint::EWS::SOAP
|
@@ -0,0 +1,58 @@
|
|
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::SOAP
|
20
|
+
class SendNotificationResponseMessage < ResponseMessage
|
21
|
+
|
22
|
+
def notification
|
23
|
+
safe_hash_access message, [:elems, :notification, :elems]
|
24
|
+
end
|
25
|
+
|
26
|
+
def subscription_id
|
27
|
+
safe_hash_access notification[0], [:subscription_id, :text]
|
28
|
+
end
|
29
|
+
|
30
|
+
def previous_watermark
|
31
|
+
safe_hash_access notification[1], [:previous_watermark, :text]
|
32
|
+
end
|
33
|
+
|
34
|
+
def new_watermark
|
35
|
+
ev = notification.last
|
36
|
+
if ev
|
37
|
+
type = ev.keys.first
|
38
|
+
ev[type][:elems][0][:watermark][:text]
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def more_events?
|
45
|
+
safe_hash_access(notification[2], [:more_events, :text]) == 'true'
|
46
|
+
end
|
47
|
+
|
48
|
+
def events
|
49
|
+
@events ||=
|
50
|
+
notification[3..-1].collect do |ev|
|
51
|
+
type = ev.keys.first
|
52
|
+
klass = Viewpoint::EWS::Types.const_get(type.to_s.camel_case)
|
53
|
+
klass.new(nil, ev[type])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end # SendNotificationResponseMessage
|
58
|
+
end # Viewpoint::EWS::SOAP
|