Class: Viewpoint::EWS::SOAP::EwsBuilder
Overview
This class includes the element builders. The idea is that each element should know how to build themselves so each parent element can delegate creation of subelements to a method of the same name with a ‘!’ after it.
Constant Summary
Constants included
from StringUtils
StringUtils::DURATION_RE
ConnectingSID
Instance Attribute Summary collapse
#logger
Instance Method Summary
collapse
-
#additional_properties!(addprops) ⇒ Object
Build the AdditionalProperties element.
-
#address!(email) ⇒ Object
-
#and_or(type, expr) ⇒ Object
-
#and_r(expr) ⇒ Object
-
#append_to_item_field!(upd) ⇒ Object
-
#attachment_id!(aid) ⇒ Object
Build the AttachmentId element.
-
#attachment_ids!(aids) ⇒ Object
Build the AttachmentIds element.
-
#attendee!(a) ⇒ Object
-
#base_shape!(base_shape) ⇒ Object
Build the BaseShape element.
-
#bcc_recipients!(r) ⇒ Object
-
#bitmask(expr) ⇒ Object
-
#body!(b) ⇒ Object
-
#body_type!(body_type) ⇒ Object
-
#build!(opts = {}, &block) ⇒ Object
Build the SOAP envelope and yield this object so subelements can be built.
-
#build_xml!(elems) ⇒ Object
Build XML from a passed in Hash or Array in a specified format.
-
#calendar_folder!(folder) ⇒ Object
-
#calendar_item!(item) ⇒ Object
-
#calendar_item_type!(type) ⇒ Object
-
#calendar_view!(cal_view) ⇒ Object
Build the CalendarView element.
-
#cc_recipients!(r) ⇒ Object
-
#constant(expr) ⇒ Object
-
#contacts_folder!(folder) ⇒ Object
-
#contacts_view!(con_view) ⇒ Object
Build the ContactsView element.
-
#contains(expr) ⇒ Object
-
#daily_recurrence!(item) ⇒ Object
-
#delete_item_field!(upd) ⇒ Object
-
#dispatch_field_item!(item, ns_prefix = nil) ⇒ Object
Insert item, enforce xmlns attribute if prefix is present.
-
#dispatch_field_uri!(uri, ns = NS_EWS_MESSAGES) ⇒ Object
A helper to dispatch to a FieldURI, IndexedFieldURI, or an ExtendedFieldURI.
-
#dispatch_folder_id!(fid) ⇒ Object
A helper method to dispatch to a FolderId or DistinguishedFolderId correctly.
-
#dispatch_item_id!(iid) ⇒ Object
A helper method to dispatch to an ItemId, OccurrenceItemId, or a RecurringMasterItemId.
-
#dispatch_update_type!(update) ⇒ Object
A helper method to dispatch to a AppendToItemField, SetItemField, or DeleteItemField.
-
#display_name!(name) ⇒ Object
-
#distinguished_folder_id!(dfid, change_key = nil, act_as = nil) ⇒ Object
Build the DistinguishedFolderId element.
-
#due_date!(dd) ⇒ Object
-
#duration!(opts) ⇒ Object
-
#email_address!(email) ⇒ Object
-
#end!(et) ⇒ Object
-
#end_time_zone!(zone) ⇒ Object
Specifies an optional time zone for the end time.
-
#event_types!(evtypes) ⇒ Object
-
#ews_types_builder ⇒ Object
-
#excludes(expr) ⇒ Object
-
#exists(expr) ⇒ Object
-
#export_item_ids!(item_ids) ⇒ Object
-
#extended_field_uRI(expr) ⇒ Object
(also: #extended_field_uri)
-
#extended_properties!(eprops) ⇒ Object
-
#extended_property!(eprop) ⇒ Object
-
#field_uRI(expr) ⇒ Object
(also: #field_uri)
-
#field_uRI_or_constant(expr) ⇒ Object
(also: #field_uri_or_constant)
-
#file_attachment!(fa) ⇒ Object
-
#folder!(folder, type = :Folder) ⇒ Object
-
#folder_id!(fid, change_key = nil) ⇒ Object
Build the FolderId element.
-
#folder_ids!(fids, act_as = nil) ⇒ Object
Build the FolderIds element.
-
#folder_shape!(folder_shape) ⇒ Object
Build the FolderShape element.
-
#folders!(folders) ⇒ Object
-
#forward_item!(item) ⇒ Object
-
#free_busy_view_options!(opts) ⇒ Object
-
#from!(f) ⇒ Object
-
#get_server_time_zones!(get_time_zone_options) ⇒ Object
Request all known time_zones from server.
-
#ignore!(item_ids) ⇒ Object
-
#importance!(sub) ⇒ Object
-
#indexed_field_uRI(expr) ⇒ Object
(also: #indexed_field_uri)
-
#indexed_page_item_view!(indexed_page_item_view) ⇒ Object
Build the IndexedPageItemView element.
-
#initialize ⇒ EwsBuilder
constructor
A new instance of EwsBuilder.
-
#inline_attachment!(fa) ⇒ Object
-
#interval!(num) ⇒ Object
-
#is_all_day_event!(all_day) ⇒ Object
-
#is_equal_to(expr) ⇒ Object
-
#is_greater_than(expr) ⇒ Object
-
#is_greater_than_or_equal_to(expr) ⇒ Object
-
#is_less_than(expr) ⇒ Object
-
#is_less_than_or_equal_to(expr) ⇒ Object
-
#is_not_equal_to(expr) ⇒ Object
-
#is_read!(read) ⇒ Object
-
#item!(item) ⇒ Object
-
#item_attachment!(ia) ⇒ Object
-
#item_change!(change) ⇒ Object
-
#item_changes!(changes) ⇒ Object
-
#item_class!(sub) ⇒ Object
-
#item_id!(id) ⇒ Object
-
#item_ids!(item_ids) ⇒ Object
-
#item_shape!(item_shape) ⇒ Object
Build the ItemShape element.
-
#last_response_time!(time) ⇒ Object
-
#legacy_free_busy_status!(state) ⇒ Object
possible values Exchange Server 2010 = [Free, Tentative, Busy, OOF, NoData] Exchange Server 2013 = [Free, Tentative, Busy, OOF, WorkingElsewhere, NoData].
-
#location!(loc) ⇒ Object
-
#mailbox!(mbox) ⇒ Object
Build the Mailbox element.
-
#mailbox_data!(md) ⇒ Object
-
#mailbox_type!(type) ⇒ Object
-
#max_changes_returned!(cnum) ⇒ Object
-
#message!(item) ⇒ Object
-
#mime_content!(include_mime_content) ⇒ Object
-
#name!(name) ⇒ Object
-
#new_body_content!(b) ⇒ Object
-
#no_end_recurrence!(item) ⇒ Object
-
#not_r(expr) ⇒ Object
-
#number_of_occurrences!(count) ⇒ Object
-
#numbered_recurrence!(item) ⇒ Object
-
#occurrence_item_id!(id) ⇒ Object
-
#optional_attendees!(attendees) ⇒ Object
-
#or_r(expr) ⇒ Object
-
#parent_folder_id!(pfid) ⇒ Object
Build the ParentFolderId element.
-
#parent_folder_ids!(pfids) ⇒ Object
Build the ParentFolderIds element.
-
#parent_item_id!(id) ⇒ Object
-
#pull_subscription_request(subopts) ⇒ Object
-
#push_subscription_request(subopts) ⇒ Object
-
#recurrence!(item) ⇒ Object
-
#recurring_master_item_id!(id) ⇒ Object
-
#reference_item_id!(id) ⇒ Object
-
#reminder_due_by!(date) ⇒ Object
-
#reminder_is_set!(reminder) ⇒ Object
-
#reminder_minutes_before_start!(minutes) ⇒ Object
-
#reply_all_to_item!(item) ⇒ Object
-
#reply_to_item!(item) ⇒ Object
-
#required_attendees!(attendees) ⇒ Object
-
#resources!(attendees) ⇒ Object
-
#response_type!(type) ⇒ Object
-
#restriction!(restriction) ⇒ Object
Build the Restriction element.
-
#restriction_compare(type, expr) ⇒ Object
-
#return_new_item_ids!(retval) ⇒ Object
-
#room_list!(cfg_prop) ⇒ Object
-
#room_lists! ⇒ Object
-
#routing_type!(type) ⇒ Object
-
#saved_item_folder_id!(fid) ⇒ Object
-
#search_folder!(folder) ⇒ Object
-
#set_item_field!(upd) ⇒ Object
-
#start!(st) ⇒ Object
-
#start_date!(sd) ⇒ Object
-
#start_time_zone!(zone) ⇒ Object
Specifies an optional time zone for the start time.
-
#status_frequency!(freq) ⇒ Object
-
#streaming_subscription_request(subopts) ⇒ Object
-
#subject!(sub) ⇒ Object
-
#subscription_id!(subid) ⇒ Object
-
#suggestions_view_options!(opts) ⇒ Object
-
#sync_folder_id!(fid) ⇒ Object
Build the SyncFolderId element.
-
#sync_scope!(scope) ⇒ Object
-
#sync_state!(syncstate) ⇒ Object
-
#task!(item) ⇒ Object
-
#tasks_folder!(folder) ⇒ Object
-
#time_zone!(zone) ⇒ Object
-
#time_zone_definition!(zone) ⇒ Object
-
#timeout!(tout) ⇒ Object
-
#to_folder_id!(to_fid) ⇒ Object
-
#to_recipients!(r) ⇒ Object
-
#updates!(updates) ⇒ Object
-
#uRL!(url) ⇒ Object
-
#user_configuration_name!(cfg_name) ⇒ Object
-
#user_configuration_properties!(cfg_prop) ⇒ Object
-
#user_oof_settings!(opts) ⇒ Object
-
#value!(val) ⇒ Object
-
#watermark!(wmark, ns = NS_EWS_TYPES) ⇒ Object
-
#weekly_recurrence!(item) ⇒ Object
included
#remove_impersonation, root_logger, #set_impersonation
Constructor Details
Returns a new instance of EwsBuilder.
28
29
30
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 28
def initialize
@nbuild = Nokogiri::XML::Builder.new
end
|
Instance Attribute Details
#nbuild ⇒ Object
Returns the value of attribute nbuild.
27
28
29
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 27
def nbuild
@nbuild
end
|
Instance Method Details
#additional_properties!(addprops) ⇒ Object
Build the AdditionalProperties element
351
352
353
354
355
356
357
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 351
def additional_properties!(addprops)
@nbuild[NS_EWS_TYPES].AdditionalProperties {
addprops.each_pair {|k,v|
dispatch_field_uri!({k => v}, NS_EWS_TYPES)
}
}
end
|
#address!(email) ⇒ Object
383
384
385
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 383
def address!(email)
nbuild[NS_EWS_TYPES].Address(email)
end
|
#and_or(type, expr) ⇒ Object
549
550
551
552
553
554
555
556
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 549
def and_or(type, expr)
@nbuild[NS_EWS_TYPES].send(type) {
expr.each do |e|
type = e.keys.first
self.send normalize_type(type), e[type]
end
}
end
|
#and_r(expr) ⇒ Object
541
542
543
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 541
def and_r(expr)
and_or('And', expr)
end
|
#append_to_item_field!(upd) ⇒ Object
1104
1105
1106
1107
1108
1109
1110
1111
1112
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1104
def append_to_item_field!(upd)
uri = upd.select {|k,v| k =~ /_uri/i}
raise EwsBadArgumentError, "Bad argument given for AppendToItemField." if uri.keys.length != 1
upd.delete(uri.keys.first)
@nbuild.AppendToItemField {
dispatch_field_uri!(uri)
dispatch_field_item!(upd)
}
end
|
#attachment_id!(aid) ⇒ Object
Build the AttachmentId element
1177
1178
1179
1180
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1177
def attachment_id!(aid)
attribs = {'Id' => aid}
@nbuild[NS_EWS_TYPES].AttachmentId(attribs)
end
|
#attachment_ids!(aids) ⇒ Object
Build the AttachmentIds element
1166
1167
1168
1169
1170
1171
1172
1173
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1166
def attachment_ids!(aids)
@nbuild.AttachmentIds {
@nbuild.parent.default_namespace = @default_ns
aids.each do |aid|
attachment_id!(aid)
end
}
end
|
#attendee!(a) ⇒ Object
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1010
def attendee!(a)
wrap = Array.wrap(a)
nbuild[NS_EWS_TYPES].Attendee {
wrap.each do |item|
if item[:mailbox]
mailbox!(item[:mailbox])
elsif item[:response_type]
response_type!(item[:response_type])
elsif item[:last_response_time]
last_response_time!(item[:last_response_time])
end
end
}
end
|
#base_shape!(base_shape) ⇒ Object
Build the BaseShape element
158
159
160
161
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 158
def base_shape!(base_shape)
@nbuild[NS_EWS_TYPES].BaseShape(camel_case(base_shape))
end
|
#bcc_recipients!(r) ⇒ Object
980
981
982
983
984
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 980
def bcc_recipients!(r)
nbuild[NS_EWS_TYPES].BccRecipients {
r.each {|mbox| mailbox!(mbox[:mailbox]) }
}
end
|
#bitmask(expr) ⇒ Object
592
593
594
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 592
def bitmask(expr)
@nbuild[NS_EWS_TYPES].Bitmask('Value' => expr[:value])
end
|
#body!(b) ⇒ Object
954
955
956
957
958
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 954
def body!(b)
nbuild[NS_EWS_TYPES].Body(b[:text]) {|x|
x.parent['BodyType'] = b[:body_type] if b[:body_type]
}
end
|
#body_type!(body_type) ⇒ Object
167
168
169
170
171
172
173
174
175
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 167
def body_type!(body_type)
body_type = body_type.to_s
if body_type =~ /html/i
body_type = body_type.upcase
else
body_type = body_type.downcase.capitalize
end
nbuild[NS_EWS_TYPES].BodyType(body_type)
end
|
#build!(opts = {}, &block) ⇒ Object
Build the SOAP envelope and yield this object so subelements can be built. Once you have the EwsBuilder object you can use the nbuild object like shown in the example for the Header section. The nbuild object is the underlying Nokogiri::XML::Builder object.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 49
def build!(opts = {}, &block)
@nbuild.Envelope(NAMESPACES) do |node|
node.parent.namespace = parent_namespace(node)
node.Header {
opts[:server_version]
set_impersonation! opts[:impersonation_type], opts[:impersonation_mail]
opts[:time_zone_context]
yield(:header, self) if block_given?
}
node.Body {
yield(:body, self) if block_given?
}
end
@nbuild.doc
end
|
#build_xml!(elems) ⇒ Object
Build XML from a passed in Hash or Array in a specified format.
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 85
def build_xml!(elems)
case elems.class.name
when 'Hash'
if attendees = elems[:required_attendees]
required_attendees!(attendees)
else
keys = elems.keys
vals = elems.values
if(keys.length > 1 && !vals.is_a?(Hash))
raise "invalid input: #{elems}"
end
vals = vals.first.clone
se = vals.delete(:sub_elements)
txt = vals.delete(:text)
xmlns_attribute = vals.delete(:xmlns_attribute)
node = @nbuild.send(camel_case(keys.first), txt, vals) {|x|
build_xml!(se) if se
}
node.xmlns = NAMESPACES["xmlns:#{xmlns_attribute}"] if xmlns_attribute
end
when 'Array'
elems.each do |e|
build_xml!(e)
end
else
raise "Unsupported type: #{elems.class.name}"
end
end
|
#calendar_folder!(folder) ⇒ Object
329
330
331
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 329
def calendar_folder!(folder)
folder! folder, :CalendarFolder
end
|
#calendar_item!(item) ⇒ Object
841
842
843
844
845
846
847
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 841
def calendar_item!(item)
nbuild[NS_EWS_TYPES].CalendarItem {
item.each_pair {|k,v|
self.send("#{k}!", v)
}
}
end
|
#calendar_item_type!(type) ⇒ Object
849
850
851
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 849
def calendar_item_type!(type)
nbuild[NS_EWS_TYPES].CalendarItemType(type)
end
|
#calendar_view!(cal_view) ⇒ Object
Build the CalendarView element
701
702
703
704
705
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 701
def calendar_view!(cal_view)
attribs = {}
cal_view.each_pair {|k,v| attribs[camel_case(k)] = v.to_s}
@nbuild[NS_EWS_MESSAGES].CalendarView(attribs)
end
|
#cc_recipients!(r) ⇒ Object
974
975
976
977
978
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 974
def cc_recipients!(r)
nbuild[NS_EWS_TYPES].CcRecipients {
r.each {|mbox| mailbox!(mbox[:mailbox]) }
}
end
|
#constant(expr) ⇒ Object
696
697
698
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 696
def constant(expr)
nbuild[NS_EWS_TYPES].Constant('Value' => expr[:value])
end
|
333
334
335
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 333
def contacts_folder!(folder)
folder! folder, :ContactsFolder
end
|
Build the ContactsView element
708
709
710
711
712
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 708
def contacts_view!(con_view)
attribs = {}
con_view.each_pair {|k,v| attribs[camel_case(k)] = v.to_s}
@nbuild[NS_EWS_MESSAGES].ContactsView(attribs)
end
|
#contains(expr) ⇒ Object
565
566
567
568
569
570
571
572
573
574
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 565
def contains(expr)
@nbuild[NS_EWS_TYPES].Contains(
'ContainmentMode' => expr.delete(:containment_mode),
'ContainmentComparison' => expr.delete(:containment_comparison)) {
c = expr.delete(:constant) type = expr.keys.first
self.send(type, expr[type])
constant(c)
}
end
|
#daily_recurrence!(item) ⇒ Object
861
862
863
864
865
866
867
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 861
def daily_recurrence!(item)
nbuild[NS_EWS_TYPES].DailyRecurrence {
item.each_pair { |k, v|
self.send("#{k}!", v)
}
}
end
|
#delete_item_field!(upd) ⇒ Object
1126
1127
1128
1129
1130
1131
1132
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1126
def delete_item_field!(upd)
uri = upd.select {|k,v| k =~ /_uri/i}
raise EwsBadArgumentError, "Bad argument given for SetItemField." if uri.keys.length != 1
@nbuild[NS_EWS_TYPES].DeleteItemField {
dispatch_field_uri!(uri, NS_EWS_TYPES)
}
end
|
#dispatch_field_item!(item, ns_prefix = nil) ⇒ Object
Insert item, enforce xmlns attribute if prefix is present
1280
1281
1282
1283
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1280
def dispatch_field_item!(item, ns_prefix = nil)
item.values.first[:xmlns_attribute] = ns_prefix if ns_prefix
build_xml!(item)
end
|
#dispatch_field_uri!(uri, ns = NS_EWS_MESSAGES) ⇒ Object
TODO:
Implement ExtendedFieldURI
A helper to dispatch to a FieldURI, IndexedFieldURI, or an ExtendedFieldURI
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1247
def dispatch_field_uri!(uri, ns=NS_EWS_MESSAGES)
type = uri.keys.first
vals = uri[type].is_a?(Array) ? uri[type] : [uri[type]]
case type
when :field_uRI, :field_uri
vals.each do |val|
value = val.is_a?(Hash) ? val[type] : val
nbuild[ns].FieldURI('FieldURI' => value)
end
when :indexed_field_uRI, :indexed_field_uri
vals.each do |val|
nbuild[ns].IndexedFieldURI(
'FieldURI' => (val[:field_uRI] || val[:field_uri]),
'FieldIndex' => val[:field_index]
)
end
when :extended_field_uRI, :extended_field_uri
vals.each do |val|
nbuild[ns].ExtendedFieldURI {
nbuild.parent['DistinguishedPropertySetId'] = val[:distinguished_property_set_id] if val[:distinguished_property_set_id]
nbuild.parent['PropertySetId'] = val[:property_set_id] if val[:property_set_id]
nbuild.parent['PropertyTag'] = val[:property_tag] if val[:property_tag]
nbuild.parent['PropertyName'] = val[:property_name] if val[:property_name]
nbuild.parent['PropertyId'] = val[:property_id] if val[:property_id]
nbuild.parent['PropertyType'] = val[:property_type] if val[:property_type]
}
end
else
raise EwsBadArgumentError, "Bad URI type. #{type}"
end
end
|
#dispatch_folder_id!(fid) ⇒ Object
A helper method to dispatch to a FolderId or DistinguishedFolderId correctly
1199
1200
1201
1202
1203
1204
1205
1206
1207
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1199
def dispatch_folder_id!(fid)
if(fid[:id].is_a?(String))
folder_id!(fid[:id], fid[:change_key])
elsif(fid[:id].is_a?(Symbol))
distinguished_folder_id!(fid[:id], fid[:change_key], fid[:act_as])
else
raise EwsBadArgumentError, "Bad argument given for a FolderId. #{fid[:id].class}"
end
end
|
#dispatch_item_id!(iid) ⇒ Object
A helper method to dispatch to an ItemId, OccurrenceItemId, or a RecurringMasterItemId
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1211
def dispatch_item_id!(iid)
type = iid.keys.first
item = iid[type]
case type
when :item_id
item_id!(item)
when :occurrence_item_id
occurrence_item_id!(
item[:recurring_master_id], item[:change_key], item[:instance_index])
when :recurring_master_item_id
recurring_master_item_id!(item[:occurrence_id], item[:change_key])
else
raise EwsBadArgumentError, "Bad ItemId type. #{type}"
end
end
|
#dispatch_update_type!(update) ⇒ Object
A helper method to dispatch to a AppendToItemField, SetItemField, or
DeleteItemField
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1230
def dispatch_update_type!(update)
type = update.keys.first
upd = update[type]
case type
when :append_to_item_field
append_to_item_field!(upd)
when :set_item_field
set_item_field!(upd)
when :delete_item_field
delete_item_field!(upd)
else
raise EwsBadArgumentError, "Bad Update type. #{type}"
end
end
|
#display_name!(name) ⇒ Object
345
346
347
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 345
def display_name!(name)
nbuild[NS_EWS_TYPES].DisplayName(name)
end
|
#distinguished_folder_id!(dfid, change_key = nil, act_as = nil) ⇒ Object
TODO:
add support for the Mailbox child object
Build the DistinguishedFolderId element
218
219
220
221
222
223
224
225
226
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 218
def distinguished_folder_id!(dfid, change_key = nil, act_as = nil)
attribs = {'Id' => dfid.to_s}
attribs['ChangeKey'] = change_key if change_key
@nbuild[NS_EWS_TYPES].DistinguishedFolderId(attribs) {
if ! act_as.nil?
mailbox!({:email_address => act_as})
end
}
end
|
#due_date!(dd) ⇒ Object
1045
1046
1047
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1045
def due_date!(dd)
nbuild[NS_EWS_TYPES].DueDate format_time(dd[:text])
end
|
#duration!(opts) ⇒ Object
411
412
413
414
415
416
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 411
def duration!(opts)
nbuild.Duration {
nbuild.StartTime(format_time opts[:start_time])
nbuild.EndTime(format_time opts[:end_time])
}
end
|
#email_address!(email) ⇒ Object
379
380
381
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 379
def email_address!(email)
nbuild[NS_EWS_TYPES].EmailAddress(email)
end
|
#end!(et) ⇒ Object
1037
1038
1039
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1037
def end!(et)
nbuild[NS_EWS_TYPES].End(et[:text])
end
|
#end_time_zone!(zone) ⇒ Object
TODO:
Implement sub elements Periods, TransitionsGroups and Transitions to override zone
Specifies an optional time zone for the end time
514
515
516
517
518
519
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 514
def end_time_zone!(zone)
attributes = {}
attributes['Id'] = zone[:id] if zone[:id]
attributes['Name'] = zone[:name] if zone[:name]
nbuild[NS_EWS_TYPES].EndTimeZone(attributes)
end
|
#event_types!(evtypes) ⇒ Object
715
716
717
718
719
720
721
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 715
def event_types!(evtypes)
@nbuild[NS_EWS_TYPES].EventTypes {
evtypes.each do |et|
@nbuild[NS_EWS_TYPES].EventType(camel_case(et))
end
}
end
|
#ews_types_builder ⇒ Object
630
631
632
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 630
def ews_types_builder
nbuild[NS_EWS_TYPES]
end
|
#excludes(expr) ⇒ Object
576
577
578
579
580
581
582
583
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 576
def excludes(expr)
@nbuild[NS_EWS_TYPES].Excludes {
b = expr.delete(:bitmask) type = expr.keys.first
self.send(type, expr[type])
bitmask(b)
}
end
|
#exists(expr) ⇒ Object
585
586
587
588
589
590
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 585
def exists(expr)
@nbuild[NS_EWS_TYPES].Exists {
type = expr.keys.first
self.send(type, expr[type])
}
end
|
#export_item_ids!(item_ids) ⇒ Object
261
262
263
264
265
266
267
268
269
270
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 261
def export_item_ids!(item_ids)
ns = @nbuild.parent.name.match(/subscription/i) ? NS_EWS_TYPES : NS_EWS_MESSAGES
@nbuild[ns].ExportItems{
@nbuild.ItemIds {
item_ids.each do |iid|
dispatch_item_id!(iid)
end
}
}
end
|
#extended_field_uRI(expr) ⇒ Object
Also known as:
extended_field_uri
650
651
652
653
654
655
656
657
658
659
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 650
def extended_field_uRI(expr)
nbuild[NS_EWS_TYPES].ExtendedFieldURI {
nbuild.parent['DistinguishedPropertySetId'] = expr[:distinguished_property_set_id] if expr[:distinguished_property_set_id]
nbuild.parent['PropertySetId'] = expr[:property_set_id] if expr[:property_set_id]
nbuild.parent['PropertyTag'] = expr[:property_tag] if expr[:property_tag]
nbuild.parent['PropertyName'] = expr[:property_name] if expr[:property_name]
nbuild.parent['PropertyId'] = expr[:property_id] if expr[:property_id]
nbuild.parent['PropertyType'] = expr[:property_type] if expr[:property_type]
}
end
|
#extended_properties!(eprops) ⇒ Object
663
664
665
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 663
def extended_properties!(eprops)
eprops.each {|ep| extended_property!(ep)}
end
|
#extended_property!(eprop) ⇒ Object
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 667
def extended_property!(eprop)
nbuild[NS_EWS_TYPES].ExtendedProperty {
key = eprop.keys.grep(/extended/i).first
dispatch_field_uri!({key => eprop[key]}, NS_EWS_TYPES)
if eprop[:values]
nbuild.Values {
eprop[:values].each do |v|
value! v
end
}
elsif eprop[:value]
value! eprop[:value]
end
}
end
|
#field_uRI(expr) ⇒ Object
Also known as:
field_uri
634
635
636
637
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 634
def field_uRI(expr)
value = expr.is_a?(Hash) ? (expr[:field_uRI] || expr[:field_uri]) : expr
ews_types_builder.FieldURI('FieldURI' => value)
end
|
#field_uRI_or_constant(expr) ⇒ Object
Also known as:
field_uri_or_constant
687
688
689
690
691
692
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 687
def field_uRI_or_constant(expr)
nbuild[NS_EWS_TYPES].FieldURIOrConstant {
type = expr.keys.first
self.send(type, expr[type])
}
end
|
#file_attachment!(fa) ⇒ Object
1148
1149
1150
1151
1152
1153
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1148
def file_attachment!(fa)
@nbuild[NS_EWS_TYPES].FileAttachment {
@nbuild[NS_EWS_TYPES].Name(fa.name)
@nbuild[NS_EWS_TYPES].Content(fa.content)
}
end
|
#folder!(folder, type = :Folder) ⇒ Object
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 313
def folder!(folder, type = :Folder)
nbuild[NS_EWS_TYPES].send(type) {|x|
folder.each_pair do |e,v|
ftype = "#{e}!".to_sym
if e == :folder_id
dispatch_folder_id!(v)
elsif self.respond_to?(ftype)
self.send ftype, v
else
raise Viewpoint::EWS::EwsNotImplemented,
"#{ftype} not implemented as a builder."
end
end
}
end
|
#folder_id!(fid, change_key = nil) ⇒ Object
Build the FolderId element
230
231
232
233
234
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 230
def folder_id!(fid, change_key = nil)
attribs = {'Id' => fid}
attribs['ChangeKey'] = change_key if change_key
@nbuild[NS_EWS_TYPES].FolderId(attribs)
end
|
#folder_ids!(fids, act_as = nil) ⇒ Object
Build the FolderIds element
197
198
199
200
201
202
203
204
205
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 197
def folder_ids!(fids, act_as=nil)
ns = @nbuild.parent.name.match(/subscription/i) ? NS_EWS_TYPES : NS_EWS_MESSAGES
@nbuild[ns].FolderIds {
fids.each do |fid|
fid[:act_as] = act_as if act_as != nil
dispatch_folder_id!(fid)
end
}
end
|
#folder_shape!(folder_shape) ⇒ Object
TODO:
need fully support all options
Build the FolderShape element
121
122
123
124
125
126
127
128
129
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 121
def folder_shape!(folder_shape)
@nbuild.FolderShape {
@nbuild.parent.default_namespace = @default_ns
base_shape!(folder_shape[:base_shape])
if(folder_shape[:additional_properties])
additional_properties!(folder_shape[:additional_properties])
end
}
end
|
#folders!(folders) ⇒ Object
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 297
def folders!(folders)
@nbuild.Folders {|x|
folders.each do |fold|
fold.each_pair do |ftype, vars| ftype = "#{ftype}!".to_sym
if self.respond_to? ftype
self.send ftype, vars
else
raise Viewpoint::EWS::EwsNotImplemented,
"#{ftype} not implemented as a builder."
end
end
end
}
end
|
#forward_item!(item) ⇒ Object
910
911
912
913
914
915
916
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 910
def forward_item!(item)
nbuild[NS_EWS_TYPES].ForwardItem {
item.each_pair {|k,v|
self.send("#{k}!", v)
}
}
end
|
#free_busy_view_options!(opts) ⇒ Object
430
431
432
433
434
435
436
437
438
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 430
def free_busy_view_options!(opts)
nbuild[NS_EWS_TYPES].FreeBusyViewOptions {
nbuild[NS_EWS_TYPES].TimeWindow {
nbuild[NS_EWS_TYPES].StartTime(format_time opts[:time_window][:start_time])
nbuild[NS_EWS_TYPES].EndTime(format_time opts[:time_window][:end_time])
}
nbuild[NS_EWS_TYPES].RequestedView(camel_case(opts[:requested_view][:requested_free_busy_view]))
}
end
|
#from!(f) ⇒ Object
986
987
988
989
990
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 986
def from!(f)
nbuild[NS_EWS_TYPES].From {
mailbox! f
}
end
|
#get_server_time_zones!(get_time_zone_options) ⇒ Object
Request all known time_zones from server
483
484
485
486
487
488
489
490
491
492
493
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 483
def get_server_time_zones!(get_time_zone_options)
nbuild[NS_EWS_MESSAGES].GetServerTimeZones('ReturnFullTimeZoneData' => get_time_zone_options[:full]) do
if get_time_zone_options[:ids] && get_time_zone_options[:ids].any?
nbuild[NS_EWS_MESSAGES].Ids do
get_time_zone_options[:ids].each do |id|
nbuild[NS_EWS_TYPES].Id id
end
end
end
end
end
|
#ignore!(item_ids) ⇒ Object
786
787
788
789
790
791
792
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 786
def ignore!(item_ids)
@nbuild.Ignore {
item_ids.each do |iid|
item_id!(iid)
end
}
end
|
#importance!(sub) ⇒ Object
950
951
952
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 950
def importance!(sub)
nbuild[NS_EWS_TYPES].Importance(sub)
end
|
#indexed_field_uRI(expr) ⇒ Object
Also known as:
indexed_field_uri
641
642
643
644
645
646
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 641
def indexed_field_uRI(expr)
nbuild[NS_EWS_TYPES].IndexedFieldURI(
'FieldURI' => (expr[:field_uRI] || expr[:field_uri]),
'FieldIndex' => expr[:field_index]
)
end
|
#indexed_page_item_view!(indexed_page_item_view) ⇒ Object
Build the IndexedPageItemView element
150
151
152
153
154
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 150
def indexed_page_item_view!(indexed_page_item_view)
attribs = {}
indexed_page_item_view.each_pair {|k,v| attribs[camel_case(k)] = v.to_s}
@nbuild[NS_EWS_MESSAGES].IndexedPageItemView(attribs)
end
|
#inline_attachment!(fa) ⇒ Object
1139
1140
1141
1142
1143
1144
1145
1146
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1139
def inline_attachment!(fa)
@nbuild[NS_EWS_TYPES].FileAttachment {
@nbuild[NS_EWS_TYPES].Name(fa.name)
@nbuild[NS_EWS_TYPES].ContentId(fa.name)
@nbuild[NS_EWS_TYPES].IsInline(true)
@nbuild[NS_EWS_TYPES].Content(fa.content)
}
end
|
#interval!(num) ⇒ Object
877
878
879
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 877
def interval!(num)
nbuild[NS_EWS_TYPES].Interval(num)
end
|
#is_all_day_event!(all_day) ⇒ Object
1053
1054
1055
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1053
def is_all_day_event!(all_day)
nbuild[NS_EWS_TYPES].IsAllDayEvent(all_day)
end
|
#is_equal_to(expr) ⇒ Object
596
597
598
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 596
def is_equal_to(expr)
restriction_compare('IsEqualTo',expr)
end
|
#is_greater_than(expr) ⇒ Object
600
601
602
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 600
def is_greater_than(expr)
restriction_compare('IsGreaterThan',expr)
end
|
#is_greater_than_or_equal_to(expr) ⇒ Object
604
605
606
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 604
def is_greater_than_or_equal_to(expr)
restriction_compare('IsGreaterThanOrEqualTo',expr)
end
|
#is_less_than(expr) ⇒ Object
608
609
610
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 608
def is_less_than(expr)
restriction_compare('IsLessThan',expr)
end
|
#is_less_than_or_equal_to(expr) ⇒ Object
612
613
614
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 612
def is_less_than_or_equal_to(expr)
restriction_compare('IsLessThanOrEqualTo',expr)
end
|
#is_not_equal_to(expr) ⇒ Object
616
617
618
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 616
def is_not_equal_to(expr)
restriction_compare('IsNotEqualTo',expr)
end
|
#is_read!(read) ⇒ Object
837
838
839
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 837
def is_read!(read)
nbuild[NS_EWS_TYPES].IsRead(read)
end
|
#item!(item) ⇒ Object
812
813
814
815
816
817
818
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 812
def item!(item)
nbuild.Item {
item.each_pair {|k,v|
self.send("#{k}!", v)
}
}
end
|
#item_attachment!(ia) ⇒ Object
1155
1156
1157
1158
1159
1160
1161
1162
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1155
def item_attachment!(ia)
@nbuild[NS_EWS_TYPES].ItemAttachment {
@nbuild[NS_EWS_TYPES].Name(ia.name)
@nbuild[NS_EWS_TYPES].Item {
item_id!(ia.item)
}
}
end
|
#item_change!(change) ⇒ Object
1086
1087
1088
1089
1090
1091
1092
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1086
def item_change!(change)
@nbuild[NS_EWS_TYPES].ItemChange {
updates = change.delete(:updates) dispatch_item_id!(change)
updates!(updates)
}
end
|
#item_changes!(changes) ⇒ Object
1077
1078
1079
1080
1081
1082
1083
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1077
def item_changes!(changes)
nbuild.ItemChanges {
changes.each do |chg|
item_change!(chg)
end
}
end
|
#item_class!(sub) ⇒ Object
946
947
948
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 946
def item_class!(sub)
nbuild[NS_EWS_TYPES].ItemClass(sub)
end
|
#item_id!(id) ⇒ Object
253
254
255
256
257
258
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 253
def item_id!(id)
nbuild[NS_EWS_TYPES].ItemId {|x|
x.parent['Id'] = id[:id]
x.parent['ChangeKey'] = id[:change_key] if id[:change_key]
}
end
|
#item_ids!(item_ids) ⇒ Object
237
238
239
240
241
242
243
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 237
def item_ids!(item_ids)
@nbuild.ItemIds {
item_ids.each do |iid|
dispatch_item_id!(iid)
end
}
end
|
#item_shape!(item_shape) ⇒ Object
TODO:
need fully support all options
Build the ItemShape element
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 135
def item_shape!(item_shape)
@nbuild[NS_EWS_MESSAGES].ItemShape {
@nbuild.parent.default_namespace = @default_ns
base_shape!(item_shape[:base_shape])
mime_content!(item_shape[:include_mime_content]) if item_shape.has_key?(:include_mime_content)
body_type!(item_shape[:body_type]) if item_shape[:body_type]
if(item_shape[:additional_properties])
additional_properties!(item_shape[:additional_properties])
end
}
end
|
#last_response_time!(time) ⇒ Object
1029
1030
1031
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1029
def last_response_time!(time)
nbuild[NS_EWS_TYPES].LastResponseTime(format_time time)
end
|
#legacy_free_busy_status!(state) ⇒ Object
possible values Exchange Server 2010 = [Free, Tentative, Busy, OOF, NoData]
Exchange Server 2013 = [Free, Tentative, Busy, OOF, WorkingElsewhere, NoData]
1072
1073
1074
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1072
def legacy_free_busy_status!(state)
nbuild[NS_EWS_TYPES].LegacyFreeBusyStatus(state)
end
|
#location!(loc) ⇒ Object
1049
1050
1051
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1049
def location!(loc)
nbuild[NS_EWS_TYPES].Location(loc)
end
|
#mailbox!(mbox) ⇒ Object
Build the Mailbox element. This element is commonly used for delegation. Typically passing an
email_address is sufficient
364
365
366
367
368
369
370
371
372
373
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 364
def mailbox!(mbox)
nbuild[NS_EWS_TYPES].Mailbox {
name!(mbox[:name]) if mbox[:name]
email_address!(mbox[:email_address]) if mbox[:email_address]
address!(mbox[:address]) if mbox[:address] routing_type!(mbox[:routing_type]) if mbox[:routing_type]
mailbox_type!(mbox[:mailbox_type]) if mbox[:mailbox_type]
item_id!(mbox[:item_id]) if mbox[:item_id]
}
end
|
#mailbox_data!(md) ⇒ Object
418
419
420
421
422
423
424
425
426
427
428
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 418
def mailbox_data!(md)
nbuild[NS_EWS_TYPES].MailboxData {
nbuild[NS_EWS_TYPES].Email {
mbox = md[:email]
name!(mbox[:name]) if mbox[:name]
address!(mbox[:address]) if mbox[:address] routing_type!(mbox[:routing_type]) if mbox[:routing_type]
}
nbuild[NS_EWS_TYPES].AttendeeType 'Required'
}
end
|
#mailbox_type!(type) ⇒ Object
392
393
394
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 392
def mailbox_type!(type)Standard
nbuild[NS_EWS_TYPES].MailboxType(type)
end
|
#max_changes_returned!(cnum) ⇒ Object
795
796
797
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 795
def max_changes_returned!(cnum)
@nbuild[NS_EWS_MESSAGES].MaxChangesReturned(cnum)
end
|
#message!(item) ⇒ Object
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 820
def message!(item)
nbuild[NS_EWS_TYPES].Message {
last_k = nil
item.each_pair {|k,v|
if k != :extended_properties
if last_k == :importance
if item[:extended_properties]
extended_properties! item.delete(:extended_properties)
end
end
self.send("#{k}!", v)
end
last_k = k
}
}
end
|
#mime_content!(include_mime_content) ⇒ Object
163
164
165
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 163
def mime_content!(include_mime_content)
@nbuild[NS_EWS_TYPES].IncludeMimeContent(include_mime_content.to_s.downcase)
end
|
#name!(name) ⇒ Object
375
376
377
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 375
def name!(name)
nbuild[NS_EWS_TYPES].Name(name)
end
|
#new_body_content!(b) ⇒ Object
960
961
962
963
964
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 960
def new_body_content!(b)
nbuild[NS_EWS_TYPES].NewBodyContent(b[:text]) {|x|
x.parent['BodyType'] = b[:body_type] if b[:body_type]
}
end
|
#no_end_recurrence!(item) ⇒ Object
881
882
883
884
885
886
887
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 881
def no_end_recurrence!(item)
nbuild[NS_EWS_TYPES].NoEndRecurrence {
item.each_pair { |k, v|
self.send("#{k}!", v)
}
}
end
|
#not_r(expr) ⇒ Object
558
559
560
561
562
563
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 558
def not_r(expr)
@nbuild[NS_EWS_TYPES].Not {
type = expr.keys.first
self.send(type, expr[type])
}
end
|
#number_of_occurrences!(count) ⇒ Object
897
898
899
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 897
def number_of_occurrences!(count)
nbuild[NS_EWS_TYPES].NumberOfOccurrences(count)
end
|
#numbered_recurrence!(item) ⇒ Object
889
890
891
892
893
894
895
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 889
def numbered_recurrence!(item)
nbuild[NS_EWS_TYPES].NumberedRecurrence {
item.each_pair { |k, v|
self.send("#{k}!", v)
}
}
end
|
#occurrence_item_id!(id) ⇒ Object
273
274
275
276
277
278
279
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 273
def occurrence_item_id!(id)
@nbuild[NS_EWS_TYPES].OccurrenceItemId {|x|
x.parent['RecurringMasterId'] = id[:recurring_master_id]
x.parent['ChangeKey'] = id[:change_key] if id[:change_key]
x.parent['InstanceIndex'] = id[:instance_index]
}
end
|
#optional_attendees!(attendees) ⇒ Object
998
999
1000
1001
1002
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 998
def optional_attendees!(attendees)
nbuild[NS_EWS_TYPES].OptionalAttendees {
attendees.each {|a| attendee!(a[:attendee])}
}
end
|
#or_r(expr) ⇒ Object
545
546
547
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 545
def or_r(expr)
and_or('Or', expr)
end
|
#parent_folder_id!(pfid) ⇒ Object
Build the ParentFolderId element
189
190
191
192
193
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 189
def parent_folder_id!(pfid)
@nbuild.ParentFolderId {
dispatch_folder_id!(pfid)
}
end
|
#parent_folder_ids!(pfids) ⇒ Object
Build the ParentFolderIds element
179
180
181
182
183
184
185
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 179
def parent_folder_ids!(pfids)
@nbuild[NS_EWS_MESSAGES].ParentFolderIds {
pfids.each do |pfid|
dispatch_folder_id!(pfid)
end
}
end
|
#parent_item_id!(id) ⇒ Object
245
246
247
248
249
250
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 245
def parent_item_id!(id)
nbuild.ParentItemId {|x|
x.parent['Id'] = id[:id]
x.parent['ChangeKey'] = id[:change_key] if id[:change_key]
}
end
|
#pull_subscription_request(subopts) ⇒ Object
749
750
751
752
753
754
755
756
757
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 749
def pull_subscription_request(subopts)
subscribe_all = subopts[:subscribe_to_all_folders] ? 'true' : 'false'
@nbuild.PullSubscriptionRequest('SubscribeToAllFolders' => subscribe_all) {
folder_ids!(subopts[:folder_ids]) if subopts[:folder_ids]
event_types!(subopts[:event_types]) if subopts[:event_types]
watermark!(subopts[:watermark]) if subopts[:watermark]
timeout!(subopts[:timeout]) if subopts[:timeout]
}
end
|
#push_subscription_request(subopts) ⇒ Object
760
761
762
763
764
765
766
767
768
769
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 760
def push_subscription_request(subopts)
subscribe_all = subopts[:subscribe_to_all_folders] ? 'true' : 'false'
@nbuild.PushSubscriptionRequest('SubscribeToAllFolders' => subscribe_all) {
folder_ids!(subopts[:folder_ids]) if subopts[:folder_ids]
event_types!(subopts[:event_types]) if subopts[:event_types]
watermark!(subopts[:watermark]) if subopts[:watermark]
status_frequency!(subopts[:status_frequency]) if subopts[:status_frequency]
uRL!(subopts[:uRL]) if subopts[:uRL]
}
end
|
#recurrence!(item) ⇒ Object
853
854
855
856
857
858
859
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 853
def recurrence!(item)
nbuild[NS_EWS_TYPES].Recurrence {
item.each_pair { |k, v|
self.send("#{k}!", v)
}
}
end
|
#recurring_master_item_id!(id) ⇒ Object
282
283
284
285
286
287
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 282
def recurring_master_item_id!(id)
@nbuild[NS_EWS_TYPES].RecurringMasterItemId {|x|
x.parent['OccurrenceId'] = id[:occurrence_id]
x.parent['ChangeKey'] = id[:change_key] if id[:change_key]
}
end
|
#reference_item_id!(id) ⇒ Object
934
935
936
937
938
939
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 934
def reference_item_id!(id)
nbuild[NS_EWS_TYPES].ReferenceItemId {|x|
x.parent['Id'] = id[:id]
x.parent['ChangeKey'] = id[:change_key] if id[:change_key]
}
end
|
#reminder_due_by!(date) ⇒ Object
1061
1062
1063
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1061
def reminder_due_by!(date)
nbuild[NS_EWS_TYPES].ReminderDueBy format_time(date)
end
|
#reminder_is_set!(reminder) ⇒ Object
1057
1058
1059
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1057
def reminder_is_set!(reminder)
nbuild[NS_EWS_TYPES].ReminderIsSet reminder
end
|
#reminder_minutes_before_start!(minutes) ⇒ Object
1065
1066
1067
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1065
def reminder_minutes_before_start!(minutes)
nbuild[NS_EWS_TYPES].ReminderMinutesBeforeStart minutes
end
|
#reply_all_to_item!(item) ⇒ Object
926
927
928
929
930
931
932
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 926
def reply_all_to_item!(item)
nbuild[NS_EWS_TYPES].ReplyAllToItem {
item.each_pair {|k,v|
self.send("#{k}!", v)
}
}
end
|
#reply_to_item!(item) ⇒ Object
918
919
920
921
922
923
924
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 918
def reply_to_item!(item)
nbuild[NS_EWS_TYPES].ReplyToItem {
item.each_pair {|k,v|
self.send("#{k}!", v)
}
}
end
|
#required_attendees!(attendees) ⇒ Object
992
993
994
995
996
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 992
def required_attendees!(attendees)
nbuild[NS_EWS_TYPES].RequiredAttendees {
attendees.each {|a| attendee!(a[:attendee])}
}
end
|
#resources!(attendees) ⇒ Object
1004
1005
1006
1007
1008
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1004
def resources!(attendees)
nbuild[NS_EWS_TYPES].Resources {
attendees.each {|a| attendee!(a[:attendee])}
}
end
|
#response_type!(type) ⇒ Object
1025
1026
1027
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1025
def response_type!(type)
nbuild[NS_EWS_TYPES].ResponseType(type)
end
|
#restriction!(restriction) ⇒ Object
Build the Restriction element
533
534
535
536
537
538
539
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 533
def restriction!(restriction)
@nbuild[NS_EWS_MESSAGES].Restriction {
restriction.each_pair do |k,v|
self.send normalize_type(k), v
end
}
end
|
#restriction_compare(type, expr) ⇒ Object
620
621
622
623
624
625
626
627
628
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 620
def restriction_compare(type,expr)
nbuild[NS_EWS_TYPES].send(type) {
expr.each do |e|
e.each_pair do |k,v|
self.send(k, v)
end
end
}
end
|
#return_new_item_ids!(retval) ⇒ Object
1135
1136
1137
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1135
def return_new_item_ids!(retval)
@nbuild.ReturnNewItemIds(retval)
end
|
#room_list!(cfg_prop) ⇒ Object
1285
1286
1287
1288
1289
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1285
def room_list!(cfg_prop)
@nbuild[NS_EWS_MESSAGES].RoomList {
email_address!(cfg_prop)
}
end
|
#room_lists! ⇒ Object
1291
1292
1293
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1291
def room_lists!
@nbuild[NS_EWS_MESSAGES].GetRoomLists
end
|
#routing_type!(type) ⇒ Object
This is stupid. The only valid value is “SMTP”
388
389
390
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 388
def routing_type!(type)
nbuild[NS_EWS_TYPES].RoutingType(type)
end
|
#saved_item_folder_id!(fid) ⇒ Object
805
806
807
808
809
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 805
def saved_item_folder_id!(fid)
@nbuild.SavedItemFolderId {
dispatch_folder_id!(fid)
}
end
|
#search_folder!(folder) ⇒ Object
337
338
339
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 337
def search_folder!(folder)
folder! folder, :SearchFolder
end
|
#set_item_field!(upd) ⇒ Object
1115
1116
1117
1118
1119
1120
1121
1122
1123
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1115
def set_item_field!(upd)
uri = upd.select {|k,v| k =~ /_uri/i}
raise EwsBadArgumentError, "Bad argument given for SetItemField." if uri.keys.length != 1
upd.delete(uri.keys.first)
@nbuild[NS_EWS_TYPES].SetItemField {
dispatch_field_uri!(uri, NS_EWS_TYPES)
dispatch_field_item!(upd, NS_EWS_TYPES)
}
end
|
#start!(st) ⇒ Object
1033
1034
1035
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1033
def start!(st)
nbuild[NS_EWS_TYPES].Start(st[:text])
end
|
#start_date!(sd) ⇒ Object
1041
1042
1043
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1041
def start_date!(sd)
nbuild[NS_EWS_TYPES].StartDate sd[:text]
end
|
#start_time_zone!(zone) ⇒ Object
TODO:
Implement sub elements Periods, TransitionsGroups and Transitions to override zone
Specifies an optional time zone for the start time
501
502
503
504
505
506
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 501
def start_time_zone!(zone)
attributes = {}
attributes['Id'] = zone[:id] if zone[:id]
attributes['Name'] = zone[:name] if zone[:name]
nbuild[NS_EWS_TYPES].StartTimeZone(attributes)
end
|
#status_frequency!(freq) ⇒ Object
734
735
736
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 734
def status_frequency!(freq)
@nbuild[NS_EWS_TYPES].StatusFrequency(freq)
end
|
#streaming_subscription_request(subopts) ⇒ Object
772
773
774
775
776
777
778
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 772
def streaming_subscription_request(subopts)
subscribe_all = subopts[:subscribe_to_all_folders] ? 'true' : 'false'
@nbuild.StreamingSubscriptionRequest('SubscribeToAllFolders' => subscribe_all) {
folder_ids!(subopts[:folder_ids]) if subopts[:folder_ids]
event_types!(subopts[:event_types]) if subopts[:event_types]
}
end
|
#subject!(sub) ⇒ Object
941
942
943
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 941
def subject!(sub)
nbuild[NS_EWS_TYPES].Subject(sub)
end
|
#subscription_id!(subid) ⇒ Object
744
745
746
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 744
def subscription_id!(subid)
@nbuild.SubscriptionId(subid)
end
|
#suggestions_view_options!(opts) ⇒ Object
440
441
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 440
def suggestions_view_options!(opts)
end
|
#sync_folder_id!(fid) ⇒ Object
Build the SyncFolderId element
209
210
211
212
213
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 209
def sync_folder_id!(fid)
@nbuild.SyncFolderId {
dispatch_folder_id!(fid)
}
end
|
#sync_scope!(scope) ⇒ Object
800
801
802
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 800
def sync_scope!(scope)
@nbuild.SyncScope(scope)
end
|
#sync_state!(syncstate) ⇒ Object
781
782
783
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 781
def sync_state!(syncstate)
@nbuild.SyncState(syncstate)
end
|
#task!(item) ⇒ Object
902
903
904
905
906
907
908
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 902
def task!(item)
nbuild[NS_EWS_TYPES].Task {
item.each_pair {|k, v|
self.send("#{k}!", v)
}
}
end
|
#tasks_folder!(folder) ⇒ Object
341
342
343
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 341
def tasks_folder!(folder)
folder! folder, :TasksFolder
end
|
#time_zone!(zone) ⇒ Object
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 443
def time_zone!(zone)
zone ||= {}
zone = {
bias: zone[:bias] || 480,
standard_time: {
bias: 0,
time: "02:00:00",
day_order: 5,
month: 10,
day_of_week: 'Sunday'
}.merge(zone[:standard_time] || {}),
daylight_time: {
bias: -60,
time: "02:00:00",
day_order: 1,
month: 4,
day_of_week: 'Sunday'
}.merge(zone[:daylight_time] || {})
}
nbuild[NS_EWS_TYPES].TimeZone {
nbuild[NS_EWS_TYPES].Bias(zone[:bias])
nbuild[NS_EWS_TYPES].StandardTime {
nbuild[NS_EWS_TYPES].Bias(zone[:standard_time][:bias])
nbuild[NS_EWS_TYPES].Time(zone[:standard_time][:time])
nbuild[NS_EWS_TYPES].DayOrder(zone[:standard_time][:day_order])
nbuild[NS_EWS_TYPES].Month(zone[:standard_time][:month])
nbuild[NS_EWS_TYPES].DayOfWeek(zone[:standard_time][:day_of_week])
}
nbuild[NS_EWS_TYPES].DaylightTime {
nbuild[NS_EWS_TYPES].Bias(zone[:daylight_time][:bias])
nbuild[NS_EWS_TYPES].Time(zone[:daylight_time][:time])
nbuild[NS_EWS_TYPES].DayOrder(zone[:daylight_time][:day_order])
nbuild[NS_EWS_TYPES].Month(zone[:daylight_time][:month])
nbuild[NS_EWS_TYPES].DayOfWeek(zone[:daylight_time][:day_of_week])
}
}
end
|
#time_zone_definition!(zone) ⇒ Object
TODO:
Implement subelements Periods, TransitionsGroups and Transitions to override zone
Specify a time zone
524
525
526
527
528
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 524
def time_zone_definition!(zone)
attributes = {'Id' => zone[:id]}
attributes['Name'] = zone[:name] if zone[:name]
nbuild[NS_EWS_TYPES].TimeZoneDefinition(attributes)
end
|
#timeout!(tout) ⇒ Object
729
730
731
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 729
def timeout!(tout)
@nbuild[NS_EWS_TYPES].Timeout(tout)
end
|
#to_folder_id!(to_fid) ⇒ Object
290
291
292
293
294
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 290
def to_folder_id!(to_fid)
@nbuild[NS_EWS_MESSAGES].ToFolderId {
dispatch_folder_id!(to_fid)
}
end
|
#to_recipients!(r) ⇒ Object
968
969
970
971
972
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 968
def to_recipients!(r)
nbuild[NS_EWS_TYPES].ToRecipients {
r.each {|mbox| mailbox!(mbox[:mailbox]) }
}
end
|
#updates!(updates) ⇒ Object
1095
1096
1097
1098
1099
1100
1101
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1095
def updates!(updates)
@nbuild[NS_EWS_TYPES].Updates {
updates.each do |update|
dispatch_update_type!(update)
end
}
end
|
#uRL!(url) ⇒ Object
739
740
741
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 739
def uRL!(url)
@nbuild[NS_EWS_TYPES].URL(url)
end
|
#user_configuration_name!(cfg_name) ⇒ Object
1182
1183
1184
1185
1186
1187
1188
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1182
def user_configuration_name!(cfg_name)
attribs = {'Name' => cfg_name.delete(:name)}
@nbuild[NS_EWS_MESSAGES].UserConfigurationName(attribs) {
fid = cfg_name.keys.first
self.send "#{fid}!", cfg_name[fid][:id], cfg_name[fid][:change_key]
}
end
|
#user_configuration_properties!(cfg_prop) ⇒ Object
1190
1191
1192
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 1190
def user_configuration_properties!(cfg_prop)
@nbuild[NS_EWS_MESSAGES].UserConfigurationProperties(cfg_prop)
end
|
#user_oof_settings!(opts) ⇒ Object
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 396
def user_oof_settings!(opts)
nbuild.UserOofSettings { |node|
node.parent[:xmlns] = NAMESPACES["xmlns:#{NS_EWS_TYPES}"]
nbuild.OofState(camel_case(opts[:oof_state]))
nbuild.ExternalAudience(camel_case(opts[:external_audience])) if opts[:external_audience]
duration!(opts[:duration]) if opts[:duration]
nbuild.InternalReply {
nbuild.Message(opts[:internal_reply])
} if opts[:internal_reply]
nbuild.ExternalReply {
nbuild.Message(opts[:external_reply])
} if opts[:external_reply]
}
end
|
#value!(val) ⇒ Object
683
684
685
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 683
def value!(val)
nbuild[NS_EWS_TYPES].Value(val)
end
|
#watermark!(wmark, ns = NS_EWS_TYPES) ⇒ Object
724
725
726
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 724
def watermark!(wmark, ns = NS_EWS_TYPES)
@nbuild[ns].Watermark(wmark)
end
|
#weekly_recurrence!(item) ⇒ Object
869
870
871
872
873
874
875
|
# File 'lib/ews/soap/builders/ews_builder.rb', line 869
def weekly_recurrence!(item)
nbuild[NS_EWS_TYPES].WeeklyRecurrence {
item.each_pair { |k, v|
self.send("#{k}!", v)
}
}
end
|