Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for nil on notification object. #241

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions lib/ews/soap/responses/get_events_response_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ def previous_watermark
end

def new_watermark
ev = notification.last
if ev
type = ev.keys.first
ev[type][:elems][0][:watermark][:text]
if notification
ev = notification.last
if ev
type = ev.keys.first
ev[type][:elems][0][:watermark][:text]
else
nil
end
else
nil
end
Expand All @@ -46,7 +50,9 @@ def more_events?
end

def events
notification[3..-1]
if notification
notification[3..-1]
end
end

end # GetEventsResponseMessage
Expand Down
10 changes: 6 additions & 4 deletions lib/ews/types/generic_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,12 @@ def get_events
rmsg = resp.response_messages[0]
@watermark = rmsg.new_watermark
# @todo if parms[:more_events] # get more events
rmsg.events.collect{|ev|
type = ev.keys.first
class_by_name(type).new(ews, ev[type])
}
if rmsg.events
rmsg.events.collect{|ev|
type = ev.keys.first
class_by_name(type).new(ews, ev[type])
}
end
else
raise EwsSubscriptionError, "Folder <#{self.display_name}> not subscribed to. Issue a Folder#subscribe before checking events."
end
Expand Down