Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### Unreleased
* Documented `tentative_as_busy` support in the `Calendars#get_free_busy` request body, consistent with other Nylas SDKs

### [6.8.0]
* Added Policies resource for managing application policies
* Added Rules resource for managing inbox rules and listing rule evaluations
Expand Down
9 changes: 7 additions & 2 deletions lib/nylas/resources/calendars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,13 @@ def get_availability(request_body:)

# Get the free/busy schedule for a list of email addresses.
#
# @param identifier [str] The identifier of the grant to act upon.
# @param request_body [Hash] Request body to pass to the request.
# @param identifier [String] The identifier of the grant to act upon.
# @param request_body [Hash] Request body to pass to the request. Supported keys:
# - `:start_time` [Integer] Unix timestamp for the start time to check free/busy for.
# - `:end_time` [Integer] Unix timestamp for the end time to check free/busy for.
# - `:emails` [Array<String>] List of email addresses to check free/busy for.
# - `:tentative_as_busy` [Boolean, nil] When set to `false`, treats tentative calendar events as
# `busy: false`. Only applicable for Microsoft and EWS calendar providers. Defaults to `true`.
# @return [Array(Array(Hash), String)] The free/busy response.
def get_free_busy(identifier:, request_body:)
post(
Expand Down
18 changes: 18 additions & 0 deletions spec/nylas/resources/calendars_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,23 @@

calendars.get_free_busy(identifier: identifier, request_body: request_body)
end

it "forwards the tentative_as_busy field in the request body" do
identifier = "abc-123-grant-id"
request_body = {
start_time: 1614556800,
end_time: 1614643200,
emails: ["test@gmail.com"],
tentative_as_busy: false
}

allow(calendars).to receive(:post)
.with(path: "#{api_uri}/v3/grants/#{identifier}/calendars/free-busy", request_body: request_body)

calendars.get_free_busy(identifier: identifier, request_body: request_body)

expect(calendars).to have_received(:post)
.with(path: "#{api_uri}/v3/grants/#{identifier}/calendars/free-busy", request_body: request_body)
end
end
end
Loading