nylas 5.9.1 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/nylas/account.rb +1 -0
- data/lib/nylas/calendar_collection.rb +30 -4
- data/lib/nylas/event.rb +26 -6
- data/lib/nylas/http_client.rb +1 -1
- data/lib/nylas/job_status.rb +1 -0
- data/lib/nylas/time_slot.rb +2 -0
- data/lib/nylas/time_slot_capacity.rb +13 -0
- data/lib/nylas/version.rb +1 -1
- data/lib/nylas.rb +2 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f59eea98b61cf99f73b87277cf360310f9fa8584a4164297d58faa2ef2575cd
|
4
|
+
data.tar.gz: 1afd54d9481f76af4330d8e12a2f90b8fe667628247e455453211425b198f470
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebf09713be0037d694e9d43c3aa5b3c3c4a5557296593773bbd792f21f281662ef96fb2079ca34d1325a0c43b4810f0805a80e963de29eef0b0762b805a74581
|
7
|
+
data.tar.gz: cb2c8c558dd67b36aa446d7b92a91902978b0e41af1f1a24e3629c833817ad3038fa71f2c1c42f0e79f3ab32c8bb02f836fc10f1481eaf0fb9f78ed021fbb44e
|
data/lib/nylas/account.rb
CHANGED
@@ -4,6 +4,19 @@ module Nylas
|
|
4
4
|
# Additional methods for some of Calendar's other functionality
|
5
5
|
# @see https://developer.nylas.com/docs/connectivity/calendar
|
6
6
|
class CalendarCollection < Collection
|
7
|
+
# Check multiple calendars to find available time slots for a single meeting
|
8
|
+
# @param duration_minutes [Integer] The total number of minutes the event should last
|
9
|
+
# @param interval_minutes [Integer] How many minutes it should check for availability
|
10
|
+
# @param start_time [Integer] The timestamp for the beginning of the event
|
11
|
+
# @param end_time [Integer] The timestamp for the end of the event
|
12
|
+
# @param emails [Array<String>] Emails on the same domain to check
|
13
|
+
# @param buffer [Integer] The amount of buffer time in minutes that you want around existing meetings
|
14
|
+
# @param round_robin [String] Finds available meeting times in a round-robin style
|
15
|
+
# @param event_collection_id [String] Unique identifier for a collection of events that are created
|
16
|
+
# @param free_busy [Array<Nylas::FreeBusy>] A list of free-busy data for users not in your organization
|
17
|
+
# @param open_hours [Array<Nylas::OpenHours>] Additional times email accounts are available
|
18
|
+
# @param calendars [Array] Check account and calendar IDs for free/busy status
|
19
|
+
# @return [Hash] The availability information; a list of time slots where all participants are available
|
7
20
|
def availability(duration_minutes:,
|
8
21
|
interval_minutes:,
|
9
22
|
start_time:,
|
@@ -11,6 +24,7 @@ module Nylas
|
|
11
24
|
emails: [],
|
12
25
|
buffer: nil,
|
13
26
|
round_robin: nil,
|
27
|
+
event_collection_id: nil,
|
14
28
|
free_busy: [],
|
15
29
|
open_hours: [],
|
16
30
|
calendars: [])
|
@@ -25,11 +39,23 @@ module Nylas
|
|
25
39
|
emails: emails,
|
26
40
|
buffer: buffer,
|
27
41
|
round_robin: round_robin,
|
28
|
-
|
29
|
-
|
42
|
+
event_collection_id: event_collection_id,
|
43
|
+
free_busy: free_busy.map(&:to_h),
|
44
|
+
open_hours: open_hours.map(&:to_h),
|
30
45
|
calendars: calendars)
|
31
46
|
end
|
32
47
|
|
48
|
+
# Check multiple calendars to find availability for multiple meetings with several participants
|
49
|
+
# @param duration_minutes [Integer] The total number of minutes the event should last
|
50
|
+
# @param interval_minutes [Integer] How many minutes it should check for availability
|
51
|
+
# @param start_time [Integer] The timestamp for the beginning of the event
|
52
|
+
# @param end_time [Integer] The timestamp for the end of the event
|
53
|
+
# @param emails [Array<Array<String>>] Emails on the same domain to check
|
54
|
+
# @param buffer [Integer] The amount of buffer time in minutes that you want around existing meetings
|
55
|
+
# @param free_busy [Array<Nylas::FreeBusy>] A list of free-busy data for users not in your organization
|
56
|
+
# @param open_hours [Array<Nylas::OpenHours>] Additional times email accounts are available
|
57
|
+
# @param calendars [Array] Check account and calendar IDs for free/busy status
|
58
|
+
# @return [Hash] The availability information; a list of all possible groupings that share time slots
|
33
59
|
def consecutive_availability(duration_minutes:,
|
34
60
|
interval_minutes:,
|
35
61
|
start_time:,
|
@@ -49,8 +75,8 @@ module Nylas
|
|
49
75
|
end_time: end_time,
|
50
76
|
emails: emails,
|
51
77
|
buffer: buffer,
|
52
|
-
free_busy: free_busy,
|
53
|
-
open_hours: open_hours,
|
78
|
+
free_busy: free_busy.map(&:to_h),
|
79
|
+
open_hours: open_hours.map(&:to_h),
|
54
80
|
calendars: calendars)
|
55
81
|
end
|
56
82
|
|
data/lib/nylas/event.rb
CHANGED
@@ -16,7 +16,9 @@ module Nylas
|
|
16
16
|
attribute :master_event_id, :string
|
17
17
|
attribute :message_id, :string
|
18
18
|
attribute :ical_uid, :string
|
19
|
+
attribute :event_collection_id, :string
|
19
20
|
|
21
|
+
attribute :capacity, :integer
|
20
22
|
attribute :busy, :boolean
|
21
23
|
attribute :description, :string
|
22
24
|
attribute :location, :string
|
@@ -30,7 +32,10 @@ module Nylas
|
|
30
32
|
attribute :metadata, :hash
|
31
33
|
attribute :conferencing, :event_conferencing
|
32
34
|
has_n_of_attribute :notifications, :event_notification
|
35
|
+
has_n_of_attribute :round_robin_order, :string
|
33
36
|
attribute :original_start_time, :unix_timestamp
|
37
|
+
attribute :reminder_minutes, :string
|
38
|
+
attribute :reminder_method, :string
|
34
39
|
attribute :job_status_id, :string, read_only: true
|
35
40
|
|
36
41
|
attr_accessor :notify_participants
|
@@ -44,12 +49,8 @@ module Nylas
|
|
44
49
|
end
|
45
50
|
|
46
51
|
def save
|
47
|
-
|
48
|
-
|
49
|
-
if body.dig(:conferencing, :details) && body.dig(:conferencing, :autocreate)
|
50
|
-
raise ArgumentError, "Cannot set both 'details' and 'autocreate' in conferencing object."
|
51
|
-
end
|
52
|
-
end
|
52
|
+
validate
|
53
|
+
format_reminder_minutes
|
53
54
|
|
54
55
|
super
|
55
56
|
end
|
@@ -81,6 +82,18 @@ module Nylas
|
|
81
82
|
|
82
83
|
private
|
83
84
|
|
85
|
+
def validate
|
86
|
+
if conferencing
|
87
|
+
body = to_h
|
88
|
+
if body.dig(:conferencing, :details) && body.dig(:conferencing, :autocreate)
|
89
|
+
raise ArgumentError, "Cannot set both 'details' and 'autocreate' in conferencing object."
|
90
|
+
end
|
91
|
+
end
|
92
|
+
return unless capacity && capacity != -1 && participants && participants.length > capacity
|
93
|
+
|
94
|
+
raise ArgumentError, "The number of participants in the event exceeds the set capacity."
|
95
|
+
end
|
96
|
+
|
84
97
|
def build_ics_event_payload(ical_uid, method, prodid)
|
85
98
|
payload = {}
|
86
99
|
if id
|
@@ -101,6 +114,13 @@ module Nylas
|
|
101
114
|
payload
|
102
115
|
end
|
103
116
|
|
117
|
+
# Formats the reminder minute field to match the API format: "[%d]"
|
118
|
+
def format_reminder_minutes
|
119
|
+
return if reminder_minutes.nil? || reminder_minutes.empty? || reminder_minutes.match(/\[\d+\]/)
|
120
|
+
|
121
|
+
self.reminder_minutes = "[#{reminder_minutes}]"
|
122
|
+
end
|
123
|
+
|
104
124
|
def query_params
|
105
125
|
if notify_participants.nil?
|
106
126
|
{}
|
data/lib/nylas/http_client.rb
CHANGED
data/lib/nylas/job_status.rb
CHANGED
@@ -16,6 +16,7 @@ module Nylas
|
|
16
16
|
attribute :status, :string, read_only: true
|
17
17
|
attribute :created_at, :unix_timestamp, read_only: true
|
18
18
|
attribute :reason, :string, read_only: true
|
19
|
+
attribute :metadata, :hash, read_only: true
|
19
20
|
|
20
21
|
# Returns the status of a job as a boolean
|
21
22
|
# @return [Boolean] If the job was successful
|
data/lib/nylas/time_slot.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Nylas
|
4
|
+
# Capacity values for a timeslot
|
5
|
+
# @see https://docs.nylas.com/reference#calendars-free-busy
|
6
|
+
class TimeSlotCapacity
|
7
|
+
include Model::Attributable
|
8
|
+
|
9
|
+
attribute :event_id, :string
|
10
|
+
attribute :current_capacity, :integer
|
11
|
+
attribute :max_capacity, :integer
|
12
|
+
end
|
13
|
+
end
|
data/lib/nylas/version.rb
CHANGED
data/lib/nylas.rb
CHANGED
@@ -54,6 +54,7 @@ require_relative "nylas/nylas_date"
|
|
54
54
|
require_relative "nylas/when"
|
55
55
|
require_relative "nylas/free_busy"
|
56
56
|
require_relative "nylas/time_slot"
|
57
|
+
require_relative "nylas/time_slot_capacity"
|
57
58
|
require_relative "nylas/open_hours"
|
58
59
|
require_relative "nylas/event_conferencing"
|
59
60
|
require_relative "nylas/event_conferencing_details"
|
@@ -144,6 +145,7 @@ module Nylas
|
|
144
145
|
Types.registry[:contact_group] = Types::ModelType.new(model: ContactGroup)
|
145
146
|
Types.registry[:when] = Types::ModelType.new(model: When)
|
146
147
|
Types.registry[:time_slot] = Types::ModelType.new(model: TimeSlot)
|
148
|
+
Types.registry[:time_slot_capacity] = Types::ModelType.new(model: TimeSlotCapacity)
|
147
149
|
Types.registry[:event_conferencing] = Types::ModelType.new(model: EventConferencing)
|
148
150
|
Types.registry[:event_conferencing_details] = Types::ModelType.new(model: EventConferencingDetails)
|
149
151
|
Types.registry[:event_conferencing_autocreate] = Types::ModelType.new(model: EventConferencingAutocreate)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nylas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nylas, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -347,6 +347,7 @@ files:
|
|
347
347
|
- lib/nylas/send_grid_verified_status.rb
|
348
348
|
- lib/nylas/thread.rb
|
349
349
|
- lib/nylas/time_slot.rb
|
350
|
+
- lib/nylas/time_slot_capacity.rb
|
350
351
|
- lib/nylas/timespan.rb
|
351
352
|
- lib/nylas/token_info.rb
|
352
353
|
- lib/nylas/types.rb
|
@@ -379,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
379
380
|
- !ruby/object:Gem::Version
|
380
381
|
version: '0'
|
381
382
|
requirements: []
|
382
|
-
rubygems_version: 3.3.
|
383
|
+
rubygems_version: 3.3.11
|
383
384
|
signing_key:
|
384
385
|
specification_version: 4
|
385
386
|
summary: Gem for interacting with the Nylas API
|