nylas 5.9.0 → 5.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b390b7c22a3dfcc7a4eed1db3966295d71a5f8928efd4b81bedbabd0c7bac0dc
4
- data.tar.gz: d27e92177ddf12626917c2b20334bc74bcc703f04d5d68721375429aa4ce06fe
3
+ metadata.gz: 8dfc25b74725b0ba024320c432c69a1318f4b5524f550323d493b59aeb70e181
4
+ data.tar.gz: 0a50c968682d1b718aecdf7aaacfd32ea324e8d89c8db2c1f9369142189cf350
5
5
  SHA512:
6
- metadata.gz: c0d5c385aa98002eceed26178f6d63e60950344fd48cd229c2c32fd4b3998c837db894ca2fd883da8886f4dd91ee8fef01b07885f7e3941ef5b17d8bb4c2afe6
7
- data.tar.gz: 86d6663b12da809962c28d6284ee5a22c90951ac9055bbadce90a347a55061ac1c67ff1feeb7e22b711d2311f24df2d0928e858be3ca03074e9e109022199b62
6
+ metadata.gz: 439de1cc121378d1438047d4e2399faa5cd3ec3efcf5647a1dbefa4b858191c83bc0d4bcfb58d3795be30cf9627feaa17828b33ed916bb2a310778cbd64c6e91
7
+ data.tar.gz: 0a5a619c18eadad1a5a81fa85e528303e172bef906746cbde9bd2baba5647213e2ff0e7f5cab634bdfc9adf9dc8489b18e159618348973df452d2a50aa6295f2
data/lib/nylas/account.rb CHANGED
@@ -9,6 +9,7 @@ module Nylas
9
9
  self.showable = true
10
10
  self.updatable = true
11
11
  self.destroyable = true
12
+ self.filterable = true
12
13
  self.auth_method = HttpClient::AuthMethod::BASIC
13
14
 
14
15
  attribute :id, :string, read_only: true
@@ -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
- free_busy: free_busy,
29
- open_hours: open_hours,
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,6 +32,7 @@ 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
34
37
  attribute :job_status_id, :string, read_only: true
35
38
 
@@ -44,12 +47,7 @@ module Nylas
44
47
  end
45
48
 
46
49
  def save
47
- if conferencing
48
- body = to_h
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
50
+ validate
53
51
 
54
52
  super
55
53
  end
@@ -81,6 +79,18 @@ module Nylas
81
79
 
82
80
  private
83
81
 
82
+ def validate
83
+ if conferencing
84
+ body = to_h
85
+ if body.dig(:conferencing, :details) && body.dig(:conferencing, :autocreate)
86
+ raise ArgumentError, "Cannot set both 'details' and 'autocreate' in conferencing object."
87
+ end
88
+ end
89
+ return unless capacity && capacity != -1 && participants && participants.length > capacity
90
+
91
+ raise ArgumentError, "The number of participants in the event exceeds the set capacity."
92
+ end
93
+
84
94
  def build_ics_event_payload(ical_uid, method, prodid)
85
95
  payload = {}
86
96
  if id
@@ -26,8 +26,14 @@ module Nylas
26
26
 
27
27
  attribute :tracking, :message_tracking
28
28
 
29
+ # Sends the new message
30
+ # @return [Message] The sent message
31
+ # @raise [RuntimeError] if the API response data was not a hash
29
32
  def send!
30
- Message.new(**api.execute(method: :post, path: "/send", payload: to_json).merge(api: api))
33
+ message_data = api.execute(method: :post, path: "/send", payload: to_json)
34
+ raise "Unexpected response from the server, data received not a Message" unless message_data.is_a?(Hash)
35
+
36
+ Message.from_hash(message_data, api: api)
31
37
  end
32
38
  end
33
39
  end
@@ -6,6 +6,7 @@ module Nylas
6
6
  include Model::Attributable
7
7
  attribute :name, :string
8
8
  attribute :email, :string
9
+ attribute :phone_number, :string
9
10
  attribute :comment, :string
10
11
  attribute :status, :string, read_only: true
11
12
  end
@@ -10,5 +10,7 @@ module Nylas
10
10
  attribute :status, :string
11
11
  attribute :start_time, :unix_timestamp
12
12
  attribute :end_time, :unix_timestamp
13
+ attribute :capacity, :time_slot_capacity
14
+ has_n_of_attribute :emails, :string
13
15
  end
14
16
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nylas
4
- VERSION = "5.9.0"
4
+ VERSION = "5.10.0"
5
5
  end
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.9.0
4
+ version: 5.10.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-04-07 00:00:00.000000000 Z
11
+ date: 2022-05-10 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