Class: Nylas::Bookings

Inherits:
Resource show all
Includes:
ApiOperations::Delete, ApiOperations::Get, ApiOperations::Patch, ApiOperations::Post, ApiOperations::Put
Defined in:
lib/nylas/resources/bookings.rb

Overview

Nylas Messages API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

#confirm(booking_id:, request_body:, query_params: nil) ⇒ Array(Hash, String)

Confirm a booking.

Parameters:

  • booking_id (String)

    The id of the booking to confirm.

  • request_body (Hash)

    The values to update the booking with

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Hash, String))

    The updated booking and API Request ID.



56
57
58
59
60
61
62
# File 'lib/nylas/resources/bookings.rb', line 56

def confirm(booking_id:, request_body:, query_params: nil)
  put(
    path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
    request_body: request_body,
    query_params: query_params
  )
end

#create(request_body:, query_params: nil) ⇒ Array(Hash, String)

Create a booking.

Parameters:

  • request_body (Hash)

    The values to create the booking with.

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Hash, String))

    The created booking and API Request ID.



30
31
32
33
34
35
36
# File 'lib/nylas/resources/bookings.rb', line 30

def create(request_body:, query_params: nil)
  post(
    path: "#{api_uri}/v3/scheduling/bookings",
    request_body: request_body,
    query_params: query_params
  )
end

#destroy(booking_id:, query_params: nil) ⇒ Array(TrueClass, String)

Delete a booking.

Parameters:

  • booking_id (String)

    The id of the booking to delete.

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



68
69
70
71
72
73
74
75
# File 'lib/nylas/resources/bookings.rb', line 68

def destroy(booking_id:, query_params: nil)
  _, request_id = delete(
    path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
    query_params: query_params
  )

  [true, request_id]
end

#find(booking_id:, query_params: nil) ⇒ Array(Hash, String)

Return a booking.

Parameters:

  • booking_id (String)

    The id of the booking to return.

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Hash, String))

    The booking and API request ID.



19
20
21
22
23
24
# File 'lib/nylas/resources/bookings.rb', line 19

def find(booking_id:, query_params: nil)
  get(
    path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
    query_params: query_params
  )
end

#update(request_body:, booking_id:, query_params: nil) ⇒ Array(Hash, String)

Create a booking.

Parameters:

  • request_body (Hash)

    The values to update the booking with.

  • booking_id (String)

    The id of the booking to update.

  • query_params (Hash, nil) (defaults to: nil)

    Query params to pass to the request.

Returns:

  • (Array(Hash, String))

    The created booking and API Request ID.



43
44
45
46
47
48
49
# File 'lib/nylas/resources/bookings.rb', line 43

def update(request_body:, booking_id:, query_params: nil)
  patch(
    path: "#{api_uri}/v3/scheduling/bookings/#{booking_id}",
    request_body: request_body,
    query_params: query_params
  )
end