lib/ews/soap/exchange_notification.rb
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
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
Used to subscribe client applications to either push, pull or stream notifications.
 @see http://msdn.microsoft.com/en-us/library/aa566188(v=EXCHG.140).aspx
 @param [Array<Hash>] subscriptions An array of Hash objects that describe each
   subscription.
   Ex: [ {:pull_subscription_request => {
         :subscribe_to_all_folders => false,
         :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
         :event_types=> %w{CopiedEvent CreatedEvent},
         :watermark  => 'watermark id',
         :timeout    => intval
       }},
       {:push_subscription_request => {
         :subscribe_to_all_folders => true,
         :event_types=> %w{CopiedEvent CreatedEvent},
         :status_frequency => 15,
         :uRL => 'http://my.endpoint.for.updates/',
       }},
       {:streaming_subscription_request => {
         :subscribe_to_all_folders => false,
         :folder_ids => [ {:id => 'id', :change_key => 'ck'} ],
         :event_types=> %w{NewMailEvent DeletedEvent},
       }},
       ]