nylas 5.12.0 → 5.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nylas/calendar.rb +9 -2
- data/lib/nylas/collection.rb +17 -3
- data/lib/nylas/component.rb +6 -2
- data/lib/nylas/deltas.rb +1 -1
- data/lib/nylas/draft.rb +7 -1
- data/lib/nylas/event.rb +9 -2
- data/lib/nylas/file.rb +7 -1
- data/lib/nylas/folder.rb +2 -0
- data/lib/nylas/job_status.rb +1 -1
- data/lib/nylas/label.rb +2 -0
- data/lib/nylas/message.rb +7 -1
- data/lib/nylas/model.rb +21 -13
- data/lib/nylas/neural_categorizer.rb +1 -1
- data/lib/nylas/neural_clean_conversation.rb +1 -1
- data/lib/nylas/neural_ocr.rb +1 -1
- data/lib/nylas/neural_sentiment_analysis.rb +1 -1
- data/lib/nylas/room_resource.rb +1 -1
- data/lib/nylas/rsvp.rb +1 -1
- data/lib/nylas/scheduler.rb +6 -2
- data/lib/nylas/thread.rb +6 -1
- data/lib/nylas/version.rb +1 -1
- data/lib/nylas/webhook.rb +5 -2
- data/lib/nylas/when.rb +27 -0
- metadata +33 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c270504996973ab93d5c1cac213a194f776fb27302010be6eee1a41570204ff
|
4
|
+
data.tar.gz: 01a2bcc7473080a9fad5c39bd1851487ed1d20f81fab68277a37c6fd5e31c195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0485d5539c28e6626cef26ee3b34a3f61eab8c0436f6abddb017ead7034b644efac6502f32fc40236446d04fa7562d615c1fcfc732afbeeee852118874281492'
|
7
|
+
data.tar.gz: 63229ee0942e29703d6a4a2fd6feafd3f7ce639f13e5fd7387c01c195cd549e6b6cd6a6d931fa2ccf98871c1929b4c3c7cacfe46e1fa3d22ed454c8978f8810f
|
data/lib/nylas/calendar.rb
CHANGED
@@ -6,8 +6,14 @@ module Nylas
|
|
6
6
|
class Calendar
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/calendars"
|
9
|
-
|
10
|
-
|
9
|
+
self.creatable = true
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.filterable = true
|
13
|
+
self.updatable = true
|
14
|
+
self.destroyable = true
|
15
|
+
self.id_listable = true
|
16
|
+
self.countable = true
|
11
17
|
|
12
18
|
attribute :id, :string
|
13
19
|
attribute :account_id, :string
|
@@ -23,6 +29,7 @@ module Nylas
|
|
23
29
|
attribute :read_only, :boolean
|
24
30
|
attribute :metadata, :hash
|
25
31
|
attribute :job_status_id, :string, read_only: true
|
32
|
+
attribute :hex_color, :string, read_only: true
|
26
33
|
|
27
34
|
def read_only?
|
28
35
|
read_only == true
|
data/lib/nylas/collection.rb
CHANGED
@@ -17,7 +17,7 @@ module Nylas
|
|
17
17
|
|
18
18
|
# Instantiates a new model
|
19
19
|
def new(**attributes)
|
20
|
-
model.new(attributes.merge(api: api))
|
20
|
+
model.new(**attributes.merge(api: api))
|
21
21
|
end
|
22
22
|
|
23
23
|
def create(**attributes)
|
@@ -51,7 +51,14 @@ module Nylas
|
|
51
51
|
|
52
52
|
# @return [Integer]
|
53
53
|
def count
|
54
|
-
self.class.new(model: model, api: api, constraints: constraints
|
54
|
+
collection = self.class.new(model: model, api: api, constraints: constraints)
|
55
|
+
|
56
|
+
if model.countable
|
57
|
+
collection.constraints = collection.constraints.merge(view: "count")
|
58
|
+
collection.execute[:count]
|
59
|
+
else
|
60
|
+
collection.find_each.map.count
|
61
|
+
end
|
55
62
|
end
|
56
63
|
|
57
64
|
# @return [Collection<Model>]
|
@@ -61,7 +68,14 @@ module Nylas
|
|
61
68
|
|
62
69
|
# @return [Array<String>]
|
63
70
|
def ids
|
64
|
-
self.class.new(model: model, api: api, constraints: constraints
|
71
|
+
collection = self.class.new(model: model, api: api, constraints: constraints)
|
72
|
+
|
73
|
+
if model.id_listable
|
74
|
+
collection.constraints = collection.constraints.merge(view: "ids")
|
75
|
+
collection.execute
|
76
|
+
else
|
77
|
+
collection.find_each.map(&:id)
|
78
|
+
end
|
65
79
|
end
|
66
80
|
|
67
81
|
# Iterates over a single page of results based upon current pagination settings
|
data/lib/nylas/component.rb
CHANGED
@@ -4,8 +4,12 @@ module Nylas
|
|
4
4
|
# Structure to represent a the Component Schema.
|
5
5
|
class Component
|
6
6
|
include Model
|
7
|
-
|
8
|
-
|
7
|
+
self.creatable = true
|
8
|
+
self.listable = true
|
9
|
+
self.showable = true
|
10
|
+
self.filterable = true
|
11
|
+
self.updatable = true
|
12
|
+
self.destroyable = true
|
9
13
|
self.auth_method = HttpClient::AuthMethod::BASIC
|
10
14
|
|
11
15
|
attribute :id, :string, read_only: true
|
data/lib/nylas/deltas.rb
CHANGED
data/lib/nylas/draft.rb
CHANGED
@@ -6,7 +6,13 @@ module Nylas
|
|
6
6
|
class Draft
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/drafts"
|
9
|
-
|
9
|
+
self.creatable = true
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.updatable = true
|
13
|
+
self.destroyable = true
|
14
|
+
self.id_listable = true
|
15
|
+
self.countable = true
|
10
16
|
|
11
17
|
attribute :id, :string
|
12
18
|
attribute :object, :string
|
data/lib/nylas/event.rb
CHANGED
@@ -6,8 +6,14 @@ module Nylas
|
|
6
6
|
class Event
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/events"
|
9
|
-
|
10
|
-
|
9
|
+
self.creatable = true
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.filterable = true
|
13
|
+
self.updatable = true
|
14
|
+
self.destroyable = true
|
15
|
+
self.id_listable = true
|
16
|
+
self.countable = true
|
11
17
|
|
12
18
|
attribute :id, :string, read_only: true
|
13
19
|
attribute :object, :string, read_only: true
|
@@ -37,6 +43,7 @@ module Nylas
|
|
37
43
|
attribute :reminder_minutes, :string
|
38
44
|
attribute :reminder_method, :string
|
39
45
|
attribute :job_status_id, :string, read_only: true
|
46
|
+
attribute :visibility, :string
|
40
47
|
|
41
48
|
attr_accessor :notify_participants
|
42
49
|
|
data/lib/nylas/file.rb
CHANGED
@@ -6,7 +6,13 @@ module Nylas
|
|
6
6
|
class File
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/files"
|
9
|
-
|
9
|
+
self.creatable = true
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.filterable = true
|
13
|
+
self.destroyable = true
|
14
|
+
self.id_listable = true
|
15
|
+
self.countable = true
|
10
16
|
|
11
17
|
attribute :id, :string
|
12
18
|
attribute :account_id, :string
|
data/lib/nylas/folder.rb
CHANGED
data/lib/nylas/job_status.rb
CHANGED
data/lib/nylas/label.rb
CHANGED
data/lib/nylas/message.rb
CHANGED
@@ -7,7 +7,13 @@ module Nylas
|
|
7
7
|
include Model
|
8
8
|
self.raw_mime_type = "message/rfc822"
|
9
9
|
self.resources_path = "/messages"
|
10
|
-
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.filterable = true
|
13
|
+
self.updatable = true
|
14
|
+
self.searchable = true
|
15
|
+
self.id_listable = true
|
16
|
+
self.countable = true
|
11
17
|
UPDATABLE_ATTRIBUTES = %i[label_ids folder_id starred unread metadata].freeze
|
12
18
|
|
13
19
|
attribute :id, :string
|
data/lib/nylas/model.rb
CHANGED
@@ -20,8 +20,8 @@ module Nylas
|
|
20
20
|
model.extend(ClassMethods)
|
21
21
|
model.extend(Forwardable)
|
22
22
|
model.def_delegators :model_class, :creatable?, :filterable?, :listable?, :searchable?, :showable?,
|
23
|
-
:updatable?, :destroyable?
|
24
|
-
model.
|
23
|
+
:updatable?, :destroyable?, :id_listable?, :countable?
|
24
|
+
model.init_operations
|
25
25
|
end
|
26
26
|
|
27
27
|
def save
|
@@ -141,19 +141,19 @@ module Nylas
|
|
141
141
|
# Allows you to narrow in exactly what kind of model you're working with
|
142
142
|
module ClassMethods
|
143
143
|
attr_accessor :raw_mime_type, :creatable, :showable, :filterable, :searchable, :listable, :updatable,
|
144
|
-
:destroyable
|
144
|
+
:destroyable, :id_listable, :countable
|
145
145
|
attr_writer :resources_path, :auth_method
|
146
146
|
|
147
|
-
def
|
148
|
-
|
149
|
-
|
150
|
-
self.
|
151
|
-
self.
|
152
|
-
self.
|
153
|
-
self.
|
154
|
-
self.
|
155
|
-
self.
|
156
|
-
self.
|
147
|
+
def init_operations
|
148
|
+
self.creatable = false
|
149
|
+
self.showable = false
|
150
|
+
self.listable = false
|
151
|
+
self.filterable = false
|
152
|
+
self.searchable = false
|
153
|
+
self.updatable = false
|
154
|
+
self.destroyable = false
|
155
|
+
self.id_listable = false
|
156
|
+
self.countable = false
|
157
157
|
end
|
158
158
|
|
159
159
|
def creatable?
|
@@ -184,6 +184,14 @@ module Nylas
|
|
184
184
|
destroyable
|
185
185
|
end
|
186
186
|
|
187
|
+
def id_listable?
|
188
|
+
id_listable
|
189
|
+
end
|
190
|
+
|
191
|
+
def countable?
|
192
|
+
countable
|
193
|
+
end
|
194
|
+
|
187
195
|
def resources_path(*)
|
188
196
|
@resources_path
|
189
197
|
end
|
@@ -6,7 +6,7 @@ module Nylas
|
|
6
6
|
class NeuralCategorizer < Message
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/neural/categorize"
|
9
|
-
|
9
|
+
self.listable = true
|
10
10
|
|
11
11
|
attribute :categorizer, :categorize
|
12
12
|
# Overrides Message's label attribute as currently categorize returns
|
data/lib/nylas/neural_ocr.rb
CHANGED
data/lib/nylas/room_resource.rb
CHANGED
data/lib/nylas/rsvp.rb
CHANGED
data/lib/nylas/scheduler.rb
CHANGED
@@ -6,8 +6,12 @@ module Nylas
|
|
6
6
|
class Scheduler
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/manage/pages"
|
9
|
-
|
10
|
-
|
9
|
+
self.creatable = true
|
10
|
+
self.listable = true
|
11
|
+
self.showable = true
|
12
|
+
self.filterable = true
|
13
|
+
self.updatable = true
|
14
|
+
self.destroyable = true
|
11
15
|
|
12
16
|
attribute :id, :integer, read_only: true
|
13
17
|
attribute :app_client_id, :string
|
data/lib/nylas/thread.rb
CHANGED
@@ -5,7 +5,12 @@ module Nylas
|
|
5
5
|
# @see https://docs.nylas.com/reference#threads
|
6
6
|
class Thread
|
7
7
|
include Model
|
8
|
-
|
8
|
+
self.searchable = true
|
9
|
+
self.listable = true
|
10
|
+
self.filterable = true
|
11
|
+
self.updatable = true
|
12
|
+
self.id_listable = true
|
13
|
+
self.countable = true
|
9
14
|
|
10
15
|
self.resources_path = "/threads"
|
11
16
|
|
data/lib/nylas/version.rb
CHANGED
data/lib/nylas/webhook.rb
CHANGED
@@ -41,8 +41,11 @@ module Nylas
|
|
41
41
|
# @see https://docs.nylas.com/reference#webhooks
|
42
42
|
class Webhook
|
43
43
|
include Model
|
44
|
-
|
45
|
-
|
44
|
+
self.creatable = true
|
45
|
+
self.listable = true
|
46
|
+
self.showable = true
|
47
|
+
self.updatable = true
|
48
|
+
self.destroyable = true
|
46
49
|
self.auth_method = HttpClient::AuthMethod::BASIC
|
47
50
|
attribute :id, :string, read_only: true
|
48
51
|
attribute :application_id, :string, read_only: true
|
data/lib/nylas/when.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Nylas
|
4
|
+
require "tzinfo"
|
5
|
+
|
4
6
|
# Structure to represent all the Nylas time types.
|
5
7
|
# @see https://docs.nylas.com/reference#section-time
|
6
8
|
class When
|
@@ -19,10 +21,15 @@ module Nylas
|
|
19
21
|
|
20
22
|
# when object == 'time'
|
21
23
|
attribute :time, :unix_timestamp
|
24
|
+
# Timezone must be set to a valid IANA database timezone name
|
25
|
+
attribute :timezone, :string
|
22
26
|
|
23
27
|
# when object == 'timespan'
|
24
28
|
attribute :start_time, :unix_timestamp
|
25
29
|
attribute :end_time, :unix_timestamp
|
30
|
+
# Both timezone fields must be set to a valid IANA database timezone name
|
31
|
+
attribute :start_timezone, :string
|
32
|
+
attribute :end_timezone, :string
|
26
33
|
|
27
34
|
def_delegators :range, :cover?
|
28
35
|
|
@@ -44,5 +51,25 @@ module Nylas
|
|
44
51
|
Range.new(time, time)
|
45
52
|
end
|
46
53
|
end
|
54
|
+
|
55
|
+
# Validates the When object
|
56
|
+
# @return [Boolean] True if the When is valid
|
57
|
+
# @raise [ArgumentError] If any of the timezone fields are not valid IANA database names
|
58
|
+
def valid?
|
59
|
+
validate_timezone(timezone) if timezone
|
60
|
+
validate_timezone(start_timezone) if start_timezone
|
61
|
+
validate_timezone(end_timezone) if end_timezone
|
62
|
+
|
63
|
+
true
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def validate_timezone(timezone_var)
|
69
|
+
return if TZInfo::Timezone.all_identifiers.include?(timezone_var)
|
70
|
+
|
71
|
+
raise ArgumentError,
|
72
|
+
format("The timezone provided (%s) is not a valid IANA timezone database name", timezone_var)
|
73
|
+
end
|
47
74
|
end
|
48
75
|
end
|
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.13.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-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.7.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tzinfo
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.0.5
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.0.5
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: overcommit
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +226,28 @@ dependencies:
|
|
212
226
|
requirements:
|
213
227
|
- - "~>"
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version:
|
229
|
+
version: 0.21.2
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 0.21.2
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: simplecov-cobertura
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 2.1.0
|
216
244
|
type: :development
|
217
245
|
prerelease: false
|
218
246
|
version_requirements: !ruby/object:Gem::Requirement
|
219
247
|
requirements:
|
220
248
|
- - "~>"
|
221
249
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
250
|
+
version: 2.1.0
|
223
251
|
- !ruby/object:Gem::Dependency
|
224
252
|
name: rest-client
|
225
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -380,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
408
|
- !ruby/object:Gem::Version
|
381
409
|
version: '0'
|
382
410
|
requirements: []
|
383
|
-
rubygems_version: 3.
|
411
|
+
rubygems_version: 3.0.9
|
384
412
|
signing_key:
|
385
413
|
specification_version: 4
|
386
414
|
summary: Gem for interacting with the Nylas API
|