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

Get events for multiple users in a single request #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 21 additions & 1 deletion lib/ews/soap/ews_soap_free_busy_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,30 @@ def body
envelope[1][:body][:elems]
end

# def get_user_availability_response
# body.first[:get_user_availability_response][:elems].first[:free_busy_response_array][:elems].first[:free_busy_response][:elems]
# end

def get_user_availability_response
body.first[:get_user_availability_response][:elems].first[:free_busy_response_array][:elems].first[:free_busy_response][:elems]
# This method handles multiple calender when an array of mulitple users is passed through cli.get_user_availability
events = []
body.first[:get_user_availability_response][:elems].first[:free_busy_response_array][:elems].each_with_index do |e, i|
e[:free_busy_response][:elems][1][:free_busy_view][:elems][1][:calendar_event_array][:elems].each do |c|

if c[:calendar_event][:elems].select { |element| element.is_a?(Hash) && element.has_key?(:user_position)}.length == 0
c[:calendar_event][:elems] << { :user_position => i }
end
events << c
end
end

result = body.first[:get_user_availability_response][:elems].first[:free_busy_response_array][:elems].first[:free_busy_response][:elems]
result[1][:free_busy_view][:elems][1][:calendar_event_array][:elems] = events

result
end


def response
body
end
Expand Down