Module: Viewpoint::EWS::SOAP::ExchangeNotification
- Includes:
- Viewpoint::EWS::SOAP
- Included in:
- ExchangeWebService
- Defined in:
- lib/ews/soap/exchange_notification.rb
Overview
Exchange Notification operations as listed in the EWS Documentation.
Constant Summary
Constants included from Viewpoint::EWS::SOAP
ActiveDirectory, ActiveDirectoryContacts, Contacts, ContactsActiveDirectory, HARD_DELETE, MOVE_TO_DELETED_ITEMS, NAMESPACES, NS_EWS_MESSAGES, NS_EWS_TYPES, NS_SOAP, SOFT_DELETE, VERSION_2007, VERSION_2007_SP1, VERSION_2010, VERSION_2010_SP1, VERSION_2010_SP2, VERSION_2013, VERSION_2013_SP1, VERSION_NONE
Instance Method Summary collapse
-
#get_events(subscription_id, watermark) ⇒ Object
Used by pull subscription clients to request notifications from the Client Access server.
-
#pull_subscribe_folder(folder, evtypes, timeout = nil, watermark = nil) ⇒ Object
Create a pull subscription to a single folder.
-
#push_subscribe_folder(folder, evtypes, url, status_frequency = nil, watermark = nil) ⇒ Object
Create a push subscription to a single folder.
-
#subscribe(subscriptions) ⇒ Object
Used to subscribe client applications to either push, pull or stream notifications.
-
#unsubscribe(subscription_id) ⇒ Object
End a pull notification subscription.
Methods included from Viewpoint::EWS::SOAP
Instance Method Details
#get_events(subscription_id, watermark) ⇒ Object
Used by pull subscription clients to request notifications from the Client Access server
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/ews/soap/exchange_notification.rb', line 91 def get_events(subscription_id, watermark) req = build_soap! do |type, builder| if(type == :header) else builder.nbuild.GetEvents { builder.nbuild.parent.default_namespace = @default_ns builder.subscription_id!(subscription_id) builder.watermark!(watermark, NS_EWS_MESSAGES) } end end do_soap_request(req, response_class: EwsResponse) end |
#pull_subscribe_folder(folder, evtypes, timeout = nil, watermark = nil) ⇒ Object
Create a pull subscription to a single folder
113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/ews/soap/exchange_notification.rb', line 113 def pull_subscribe_folder(folder, evtypes, timeout = nil, watermark = nil) timeout ||= 240 # 4 hour default timeout psr = { :subscribe_to_all_folders => false, :folder_ids => [ {:id => folder[:id], :change_key => folder[:change_key]} ], :event_types=> evtypes, :timeout => timeout } psr[:watermark] = watermark if watermark subscribe([{pull_subscription_request: psr}]) end |
#push_subscribe_folder(folder, evtypes, url, status_frequency = nil, watermark = nil) ⇒ Object
Create a push subscription to a single folder
131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/ews/soap/exchange_notification.rb', line 131 def push_subscribe_folder(folder, evtypes, url, status_frequency = nil, watermark = nil) status_frequency ||= 30 psr = { :subscribe_to_all_folders => false, :folder_ids => [ {:id => folder[:id], :change_key => folder[:change_key]} ], :event_types=> evtypes, :status_frequency => status_frequency, :uRL => url.to_s } psr[:watermark] = watermark if watermark subscribe([{push_subscription_request: psr}]) end |
#subscribe(subscriptions) ⇒ Object
Used to subscribe client applications to either push, pull or stream notifications.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ews/soap/exchange_notification.rb', line 49 def subscribe(subscriptions) req = build_soap! do |type, builder| if(type == :header) else builder.nbuild.Subscribe { builder.nbuild.parent.default_namespace = @default_ns subscriptions.each do |sub| subtype = sub.keys.first if(builder.respond_to?(subtype)) builder.send subtype, sub[subtype] else raise EwsBadArgumentError, "Bad subscription type. #{subtype}" end end } end end do_soap_request(req, response_class: EwsResponse) end |
#unsubscribe(subscription_id) ⇒ Object
End a pull notification subscription.
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/ews/soap/exchange_notification.rb', line 73 def unsubscribe(subscription_id) req = build_soap! do |type, builder| if(type == :header) else builder.nbuild.Unsubscribe { builder.nbuild.parent.default_namespace = @default_ns builder.subscription_id!(subscription_id) } end end do_soap_request(req, response_class: EwsResponse) end |