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

Free/busy blocks with empty time slots breaks calendars.availability request #392

Open
kwayebopp opened this issue Dec 1, 2022 · 1 comment
Assignees
Labels

Comments

@kwayebopp
Copy link

Describe the bug
When passing the result of calling the free/busy endpoint to calendars.availability, I recieve a Nylas::InvalidRequest error with the message free_busy.0.time_slots: Missing data for required field.

To Reproduce

    # nylas here is just the value returned from Nylas::API.new
    # start_time and end_time should be on a day where the user has no calendar events/busy blocks.

    nylas.calendars.availability(
      **{ duration_minutes: duration_minutes,
          interval_minutes: interval_minutes || duration_minutes,
          start_time: start_time,
          end_time: end_time,
          emails: emails,
          free_busy:  nylas.free_busy(
                                emails: emails,
                                start_time: start_time.to_i,
                                end_time: end_time.to_i
                             ),
          open_hours: open_hours,
          calendars: [
            ...
          ] })
    )

Expected behavior
I expected to receive a list of available times for the user. It isn't quite clear to me why this should break on a day that has no busy blocks. I was able to achieve this by using nylas.free_busy(...).reject { |block| block.time_slots.blank? }.

SDK Version:
5.13.0

Additional context
Using Ruby 3.0.2

@mrashed-dev
Copy link
Collaborator

Thanks for opening this issue, I'll take a look as to why this is breaking on blanks and have a solution soon.

@mrashed-dev mrashed-dev reopened this Dec 16, 2022
@mrashed-dev mrashed-dev self-assigned this Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants