nylas 5.3.0 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ab5c418509c447497fbd6106eb6e01fb7c23af451bf8150584b9bcf4e1ce736
4
- data.tar.gz: 6827492459317c848f6f89c748a1cf5f5858506b83a578f53dbb4169010779ad
3
+ metadata.gz: 9e585c607f124440a448e29f36d010eff7ac9b2023000b82256874830338f327
4
+ data.tar.gz: 0c0d882e1831a5367f4eaa69701482c6b452cf129e205a136def8f64310b695e
5
5
  SHA512:
6
- metadata.gz: 593d58ed82147ee51b00f90ed0e619eb4a6680b07cc8bae04eeba0809026e2e24ecce2565292c026bd2d164fba8a6a76f67768bf362c35c8e50bc0efbbe61da1
7
- data.tar.gz: 10ed94be5d4e2c785ef92d32495301857f6c193e85e5087e96e8c2826b379219833f6db07c669c38fb7be573f77376748a6b323c1af46952c10853bf50e04233
6
+ metadata.gz: 2cf81593d36344ca0f18e734688fa6276acc86be3ffa0436bc0e02aa126414f920e7295ab0de1ce8f90538505073ae180ce1e94bcb1255c37aa471c06aad63cd
7
+ data.tar.gz: 47d5ebabda297aeca2d455536ce12eb7292c895a4865b815173f4852f24d131583709127c5549b15ca1d3a1999582090198be23ea72a9fdd41fe5bac9d675509
data/lib/nylas/draft.rb CHANGED
@@ -39,9 +39,12 @@ module Nylas
39
39
  transfer :api, to: %i[events files folder labels]
40
40
 
41
41
  def update(**data)
42
+ # If files are provided, replace files with file IDs
42
43
  self.files = data[:files] if data[:files]
43
44
  extract_file_ids!
44
45
  data[:file_ids] = file_ids
46
+ # If version is not provided, add version or request will fail
47
+ data[:version] = version unless data[:version]
45
48
 
46
49
  super
47
50
  end
@@ -53,9 +56,8 @@ module Nylas
53
56
  end
54
57
 
55
58
  def send!
56
- return execute(method: :post, path: "/send", payload: to_json) if tracking
59
+ return execute(method: :post, path: "/send", payload: to_json) if tracking || !id
57
60
 
58
- save
59
61
  execute(method: :post, path: "/send", payload: JSON.dump(draft_id: id, version: version))
60
62
  end
61
63
 
data/lib/nylas/event.rb CHANGED
@@ -28,6 +28,7 @@ module Nylas
28
28
  attribute :title, :string
29
29
  attribute :when, :when
30
30
  attribute :metadata, :hash
31
+ attribute :conferencing, :event_conferencing
31
32
  attribute :original_start_time, :unix_timestamp
32
33
 
33
34
  attr_accessor :notify_participants
@@ -40,6 +41,17 @@ module Nylas
40
41
  read_only
41
42
  end
42
43
 
44
+ def save
45
+ if conferencing
46
+ body = to_h
47
+ if body.dig(:conferencing, :details) && body.dig(:conferencing, :autocreate)
48
+ raise ArgumentError, "Cannot set both 'details' and 'autocreate' in conferencing object."
49
+ end
50
+ end
51
+
52
+ super
53
+ end
54
+
43
55
  def rsvp(status, notify_participants:)
44
56
  rsvp = Rsvp.new(api: api, status: status, notify_participants: notify_participants,
45
57
  event_id: id, account_id: account_id)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nylas
4
+ # Structure to represent the Event Conferencing object
5
+ # @see https://developer.nylas.com/docs/connectivity/calendar/conference-sync-beta
6
+ class EventConferencing
7
+ include Model::Attributable
8
+ attribute :provider, :string
9
+ attribute :details, :event_conferencing_details
10
+ attribute :autocreate, :event_conferencing_autocreate
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nylas
4
+ # Structure to represent the autocreate object within the Event Conferencing object
5
+ # @see https://developer.nylas.com/docs/connectivity/calendar/conference-sync-beta
6
+ class EventConferencingAutocreate
7
+ include Model::Attributable
8
+ attribute :settings, :hash, default: {}
9
+ end
10
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nylas
4
+ # Structure to represent the details object within the Event Conferencing object
5
+ # @see https://developer.nylas.com/docs/connectivity/calendar/conference-sync-beta
6
+ class EventConferencingDetails
7
+ include Model::Attributable
8
+ attribute :meeting_code, :string
9
+ attribute :password, :string
10
+ attribute :pin, :string
11
+ attribute :url, :string
12
+ has_n_of_attribute :phone, :string
13
+ end
14
+ end
@@ -25,6 +25,8 @@ module Nylas
25
25
 
26
26
  def assign(**data)
27
27
  data.each do |attribute_name, value|
28
+ next if value.nil?
29
+
28
30
  if respond_to?(:"#{attribute_name}=")
29
31
  send(:"#{attribute_name}=", value)
30
32
  end
@@ -31,7 +31,9 @@ module Nylas
31
31
  def to_h(keys: attribute_definitions.keys)
32
32
  keys.each_with_object({}) do |key, casted_data|
33
33
  value = attribute_definitions[key].serialize(self[key])
34
- casted_data[key] = value unless value.nil? || (value.respond_to?(:empty?) && value.empty?)
34
+ # If the value is an empty hash but we specify that it is valid (via default value), serialize it
35
+ casted_data[key] = value unless value.nil? || (value.respond_to?(:empty?) && value.empty? &&
36
+ !(attribute_definitions[key].default == value && value.is_a?(Hash)))
35
37
  end
36
38
  end
37
39
 
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.3.0"
4
+ VERSION = "5.4.0"
5
5
  end
data/lib/nylas.rb CHANGED
@@ -53,6 +53,9 @@ require_relative "nylas/nylas_date"
53
53
  require_relative "nylas/when"
54
54
  require_relative "nylas/free_busy"
55
55
  require_relative "nylas/time_slot"
56
+ require_relative "nylas/event_conferencing"
57
+ require_relative "nylas/event_conferencing_details"
58
+ require_relative "nylas/event_conferencing_autocreate"
56
59
 
57
60
  # Custom collection types
58
61
  require_relative "nylas/search_collection"
@@ -123,6 +126,9 @@ module Nylas
123
126
  Types.registry[:contact_group] = Types::ModelType.new(model: ContactGroup)
124
127
  Types.registry[:when] = Types::ModelType.new(model: When)
125
128
  Types.registry[:time_slot] = Types::ModelType.new(model: TimeSlot)
129
+ Types.registry[:event_conferencing] = Types::ModelType.new(model: EventConferencing)
130
+ Types.registry[:event_conferencing_details] = Types::ModelType.new(model: EventConferencingDetails)
131
+ Types.registry[:event_conferencing_autocreate] = Types::ModelType.new(model: EventConferencingAutocreate)
126
132
  Types.registry[:neural] = Types::ModelType.new(model: Neural)
127
133
  Types.registry[:categorize] = Types::ModelType.new(model: Categorize)
128
134
  Types.registry[:neural_signature_contact] = Types::ModelType.new(model: NeuralSignatureContact)
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.3.0
4
+ version: 5.4.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: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2021-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -284,6 +284,9 @@ files:
284
284
  - lib/nylas/errors.rb
285
285
  - lib/nylas/event.rb
286
286
  - lib/nylas/event_collection.rb
287
+ - lib/nylas/event_conferencing.rb
288
+ - lib/nylas/event_conferencing_autocreate.rb
289
+ - lib/nylas/event_conferencing_details.rb
287
290
  - lib/nylas/file.rb
288
291
  - lib/nylas/filter_attributes.rb
289
292
  - lib/nylas/folder.rb