Class: Nylas::Events
- Includes:
- ApiOperations::Delete, ApiOperations::Get, ApiOperations::Post, ApiOperations::Put
- Defined in:
- lib/nylas/resources/events.rb
Overview
Nylas Events API
Instance Method Summary collapse
-
#batch(identifier:, request_body:, query_params:) ⇒ Array(Array<Hash>, String, Hash)
Create, update, or delete events in one request (Google and Microsoft).
-
#create(identifier:, request_body:, query_params:) ⇒ Array(Hash, String)
Create an event.
-
#destroy(identifier:, event_id:, query_params:) ⇒ Array(TrueClass, String)
Delete an event.
-
#find(identifier:, event_id:, query_params:) ⇒ Array(Hash, String)
Return an event.
-
#list(identifier:, query_params:) ⇒ Array(Array(Hash), String, String)
Return all events.
-
#list_import_events(identifier:, query_params:) ⇒ (Array(Hash), String, String)
Returns a list of recurring events, recurring event exceptions, and single events from the specified calendar within a given time frame.
-
#send_rsvp(identifier:, event_id:, request_body:, query_params:) ⇒ (Hash, String)
Send RSVP.
-
#update(identifier:, event_id:, request_body:, query_params:) ⇒ Array(Hash, String)
Update an event.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Nylas::Resource
Instance Method Details
#batch(identifier:, request_body:, query_params:) ⇒ Array(Array<Hash>, String, Hash)
Create, update, or delete events in one request (Google and Microsoft).
Results follow the operation order. Both 200 and 207 responses return normally; inspect each result's status and error, even when every operation failed. The API validates the operations and batch size. No operations are retried automatically.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/nylas/resources/events.rb', line 81 def batch(identifier:, request_body:, query_params:) unless identifier.is_a?(String) && !identifier.strip.empty? && !%w[. ..].include?(identifier.strip) raise ArgumentError, "Invalid grant identifier." end encoded_identifier = URI.encode_www_form_component(identifier).gsub("+", "%20") post( path: "#{api_uri}/v3/grants/#{encoded_identifier}/events/batch", query_params: query_params, request_body: request_body ) end |
#create(identifier:, request_body:, query_params:) ⇒ Array(Hash, String)
Create an event.
47 48 49 50 51 52 53 |
# File 'lib/nylas/resources/events.rb', line 47 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.
116 117 118 119 120 121 122 123 |
# File 'lib/nylas/resources/events.rb', line 116 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.
33 34 35 36 37 38 |
# File 'lib/nylas/resources/events.rb', line 33 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.
20 21 22 23 24 25 |
# File 'lib/nylas/resources/events.rb', line 20 def list(identifier:, query_params:) get_list( path: "#{api_uri}/v3/grants/#{identifier}/events", query_params: query_params ) end |
#list_import_events(identifier:, query_params:) ⇒ (Array(Hash), String, String)
Returns a list of recurring events, recurring event exceptions, and single events from the specified calendar within a given time frame. This is useful when you want to import, store, and synchronize events from the time frame to your application
147 148 149 150 151 152 |
# File 'lib/nylas/resources/events.rb', line 147 def list_import_events(identifier:, query_params:) get_list( path: "#{api_uri}/v3/grants/#{identifier}/events/import", 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.
132 133 134 135 136 137 138 |
# File 'lib/nylas/resources/events.rb', line 132 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.
102 103 104 105 106 107 108 |
# File 'lib/nylas/resources/events.rb', line 102 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 |