viewpoint 0.1.25 → 0.1.26
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.
data/README
CHANGED
@@ -97,7 +97,11 @@ DESIGN GOALS/GUIDELINES:
|
|
97
97
|
where they do not and I have deviated somewhat. For example,
|
98
98
|
an instance method named delete_folder doesn't make much sense, but
|
99
99
|
an instance method named delete! is pretty clear what it deletes.
|
100
|
-
|
100
|
+
--------------------------------------------------------------------------
|
101
|
+
!!!SHOUTS OUT!!!
|
102
|
+
--------------------------------------------------------------------------
|
103
|
+
* Thanks to Harold Lee (https://github.com/haroldl) for working on the
|
104
|
+
get_user_availability code.
|
101
105
|
--------------------------------------------------------------------------
|
102
106
|
DISCLAIMER: If you see something that could be done better or would like
|
103
107
|
to help out in the development of this code please feel free to clone the
|
data/lib/model/mailbox_user.rb
CHANGED
@@ -47,6 +47,20 @@ module Viewpoint
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
# Get information about when the user with the given email address is available.
|
51
|
+
# @param [String] email_address The email address of the person to find availability for.
|
52
|
+
# @param [String] start_time The start of the time range to check as an xs:dateTime.
|
53
|
+
# @param [String] end_time The end of the time range to check as an xs:dateTime.
|
54
|
+
# @see http://msdn.microsoft.com/en-us/library/aa494212.aspx
|
55
|
+
def self.get_user_availability(email_address, start_time, end_time)
|
56
|
+
resp = (Viewpoint::EWS::EWS.instance).ews.get_user_availability(email_address, start_time, end_time)
|
57
|
+
if(resp.status == 'Success')
|
58
|
+
return resp.items
|
59
|
+
else
|
60
|
+
raise EwsError, "GetUserAvailability produced an error: #{resp.code}: #{resp.message}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
50
64
|
def initialize(mbox_user)
|
51
65
|
super() # Calls initialize in Model (creates @ews_methods Array)
|
52
66
|
@ews_item = mbox_user
|
@@ -66,6 +80,14 @@ module Viewpoint
|
|
66
80
|
true
|
67
81
|
end
|
68
82
|
|
83
|
+
# Get information about when this user is available.
|
84
|
+
# @param [String] start_time The start of the time range to check as an xs:dateTime.
|
85
|
+
# @param [String] end_time The end of the time range to check as an xs:dateTime.
|
86
|
+
# @see http://msdn.microsoft.com/en-us/library/aa494212.aspx
|
87
|
+
def get_user_availability(start_time, end_time)
|
88
|
+
return MailboxUser.get_user_availability(self.email_address, start_time, end_time)
|
89
|
+
end
|
90
|
+
|
69
91
|
# Adds one or more delegates to a principal's mailbox and sets specific access permissions
|
70
92
|
# @see http://msdn.microsoft.com/en-us/library/bb856527.aspx
|
71
93
|
#
|
@@ -80,6 +80,29 @@ module Viewpoint
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
# Build the request XML for GetUserAvailability.
|
84
|
+
# @see http://msdn.microsoft.com/en-us/library/aa494212.aspx
|
85
|
+
def get_user_availability!(email_address, start_time, end_time)
|
86
|
+
add_time_zone_info
|
87
|
+
@node.add("#{NS_EWS_MESSAGES}:MailboxDataArray") do |mda|
|
88
|
+
mda.add("#{NS_EWS_TYPES}:MailboxData") do |mbdata|
|
89
|
+
mbdata.add("#{NS_EWS_TYPES}:Email") do |email|
|
90
|
+
email.add("#{NS_EWS_TYPES}:Name")
|
91
|
+
email.add("#{NS_EWS_TYPES}:Address", email_address)
|
92
|
+
end
|
93
|
+
mbdata.add("#{NS_EWS_TYPES}:AttendeeType", 'Required')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
@node.add("#{NS_EWS_TYPES}:FreeBusyViewOptions") do |fbvo|
|
97
|
+
fbvo.add("#{NS_EWS_TYPES}:TimeWindow") do |tw|
|
98
|
+
tw.add("#{NS_EWS_TYPES}:StartTime", start_time)
|
99
|
+
tw.add("#{NS_EWS_TYPES}:EndTime", end_time)
|
100
|
+
end
|
101
|
+
fbvo.add("#{NS_EWS_TYPES}:MergedFreeBusyIntervalInMinutes", 10)
|
102
|
+
fbvo.add("#{NS_EWS_TYPES}:RequestedView", 'MergedOnly')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
83
106
|
# This is forthcoming in Exchange 2010. It will replace much of the Restriction
|
84
107
|
# based code.
|
85
108
|
# @param [Array] An array of query strings
|
@@ -90,6 +113,33 @@ module Viewpoint
|
|
90
113
|
end
|
91
114
|
end
|
92
115
|
|
116
|
+
private
|
117
|
+
|
118
|
+
# Add a description of the time zone to the request XML.
|
119
|
+
# The timezone information defaults to US/Pacific time.
|
120
|
+
def add_time_zone_info(offset_hours_std = -8, offset_hours_dst = -7)
|
121
|
+
base_bias = (-1 * offset_hours_std * 60).to_s
|
122
|
+
standard_bias = '0'
|
123
|
+
savings_bias = (offset_hours_std - offset_hours_dst).to_s
|
124
|
+
@node.add("#{NS_EWS_TYPES}:TimeZone") do |tz|
|
125
|
+
tz.add("#{NS_EWS_TYPES}:Bias", base_bias) # e.g. '480'
|
126
|
+
tz.add("#{NS_EWS_TYPES}:StandardTime") do |stime|
|
127
|
+
stime.add("#{NS_EWS_TYPES}:Bias", standard_bias) # e.g. '0'
|
128
|
+
stime.add("#{NS_EWS_TYPES}:Time", '02:00:00')
|
129
|
+
stime.add("#{NS_EWS_TYPES}:DayOrder", '1')
|
130
|
+
stime.add("#{NS_EWS_TYPES}:Month", '11')
|
131
|
+
stime.add("#{NS_EWS_TYPES}:DayOfWeek", 'Sunday')
|
132
|
+
end
|
133
|
+
tz.add("#{NS_EWS_TYPES}:DaylightTime") do |dtime|
|
134
|
+
dtime.add("#{NS_EWS_TYPES}:Bias", savings_bias) # e.g. '-60'
|
135
|
+
dtime.add("#{NS_EWS_TYPES}:Time", '02:00:00')
|
136
|
+
dtime.add("#{NS_EWS_TYPES}:DayOrder", '2')
|
137
|
+
dtime.add("#{NS_EWS_TYPES}:Month", '3')
|
138
|
+
dtime.add("#{NS_EWS_TYPES}:DayOfWeek", 'Sunday')
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
93
143
|
end # EwsBuilder
|
94
144
|
end # SOAP
|
95
145
|
end # EWS
|
@@ -728,12 +728,14 @@ module Viewpoint
|
|
728
728
|
# Provides detailed information about the availability of a set of users, rooms, and resources
|
729
729
|
# within a specified time window.
|
730
730
|
# @see http://msdn.microsoft.com/en-us/library/aa564001.aspx
|
731
|
-
def get_user_availability
|
731
|
+
def get_user_availability(email_address, start_time, end_time)
|
732
732
|
action = "#{SOAP_ACTION_PREFIX}/GetUserAvailability"
|
733
|
-
resp = invoke("#{NS_EWS_MESSAGES}:
|
734
|
-
|
733
|
+
resp = invoke("#{NS_EWS_MESSAGES}:GetUserAvailabilityRequest", action) do |root|
|
734
|
+
build!(root) do
|
735
|
+
get_user_availability!(email_address, start_time, end_time)
|
736
|
+
end
|
735
737
|
end
|
736
|
-
|
738
|
+
parse!(resp)
|
737
739
|
end
|
738
740
|
|
739
741
|
# Gets a mailbox user's Out of Office (OOF) settings and messages.
|
@@ -202,6 +202,12 @@ module Viewpoint
|
|
202
202
|
@response_message.items = xml_to_hash!((@response/"//#{NS_EWS_TYPES}:OofSettings").first.native_element)
|
203
203
|
end
|
204
204
|
|
205
|
+
# Parse out the free/busy time.
|
206
|
+
# @see http://msdn.microsoft.com/en-us/library/aa494212.aspx
|
207
|
+
def get_user_availability_response(opts)
|
208
|
+
@response_message.items = xml_to_hash!((@response/"//#{NS_EWS_MESSAGES}:FreeBusyView").first.native_element)
|
209
|
+
end
|
210
|
+
|
205
211
|
# Parse out a Mailbox element
|
206
212
|
# @param [XML] mbox The <t:Mailbox> element
|
207
213
|
# @return [Hash] Values of EWS Mailbox type :name, :email_address, :routing_type, :mailbox_type, :item_id
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: viewpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.26
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dan Wanek
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-21 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: handsoap
|