Class: Nylas::Events

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

Overview

Nylas Events API

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Nylas::Resource

Instance Method Details

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

Create an event.

Parameters:

  • identifier (String)

    Grant ID or email account in which to create the object.

  • request_body (Hash)

    The values to create the event with.

  • query_params (Hash)

    The query parameters to include in the request.

Returns:

  • (Array(Hash, String))

    The created event and API Request ID.



45
46
47
48
49
50
51
# File 'lib/nylas/resources/events.rb', line 45

def create(identifier:, request_body:, query_params:)
  post(
    path: "#{api_uri}/v3/grants/#{identifier}/events",
    query_params: query_params,
    request_body: request_body
  )
end

#destroy(identifier:, event_id:, query_params:) ⇒ Array(TrueClass, String)

Delete an event.

Parameters:

  • identifier (String)

    Grant ID or email account from which to delete an object.

  • event_id (String)

    The id of the event to delete.

  • query_params (Hash)

    The query parameters to include in the request

Returns:

  • (Array(TrueClass, String))

    True and the API Request ID for the delete operation.



74
75
76
77
78
79
80
81
# File 'lib/nylas/resources/events.rb', line 74

def destroy(identifier:, event_id:, query_params:)
  _, request_id = delete(
    path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
    query_params: query_params
  )

  [true, request_id]
end

#find(identifier:, event_id:, query_params:) ⇒ Array(Hash, String)

Return an event.

Parameters:

  • identifier (String)

    Grant ID or email account to query.

  • event_id (String)

    The id of the event to return.

  • query_params (Hash)

    The query parameters to include in the request

Returns:

  • (Array(Hash, String))

    The event and API request ID.



32
33
34
35
36
37
# File 'lib/nylas/resources/events.rb', line 32

def find(identifier:, event_id:, query_params:)
  get(
    path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
    query_params: query_params
  )
end

#list(identifier:, query_params:) ⇒ Array(Array(Hash), String, String)

Return all events.

Parameters:

  • identifier (String)

    Grant ID or email account to query.

  • query_params (Hash)

    Query params to pass to the request.

Returns:

  • (Array(Array(Hash), String, String))

    The list of events, API Request ID, and next cursor.



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

def list(identifier:, query_params:)
  get_list(
    path: "#{api_uri}/v3/grants/#{identifier}/events",
    query_params: query_params
  )
end

#send_rsvp(identifier:, event_id:, request_body:, query_params:) ⇒ (Hash, String)

Send RSVP. Allows users to respond to events they have been added to as an attendee.

Parameters:

  • identifier (String)

    Grant ID or email account from which to send RSVP with.

  • event_id (String)

    The id of the event to respond to.

  • request_body (Hash)

    The status values to send the RSVP with.

  • query_params (Hash)

    The query parameters to include in the request

Returns:

  • ((Hash, String))

    Response object with the API Request ID.



90
91
92
93
94
95
96
# File 'lib/nylas/resources/events.rb', line 90

def send_rsvp(identifier:, event_id:, request_body:, query_params:)
  post(
    path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}/send-rsvp",
    query_params: query_params,
    request_body: request_body
  )
end

#update(identifier:, event_id:, request_body:, query_params:) ⇒ Array(Hash, String)

Update an event.

Parameters:

  • identifier (String)

    Grant ID or email account in which to update an object.

  • event_id (String)

    The id of the event to update.

  • request_body (Hash)

    The values to update the event with

  • query_params (Hash)

    The query parameters to include in the request

Returns:

  • (Array(Hash, String))

    The updated event and API Request ID.



60
61
62
63
64
65
66
# File 'lib/nylas/resources/events.rb', line 60

def update(identifier:, event_id:, request_body:, query_params:)
  put(
    path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
    query_params: query_params,
    request_body: request_body
  )
end