nylas 5.10.0 → 5.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nylas/api.rb +5 -1
- data/lib/nylas/calendar.rb +8 -2
- data/lib/nylas/calendar_collection.rb +28 -22
- 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 +18 -2
- data/lib/nylas/file.rb +7 -1
- data/lib/nylas/folder.rb +2 -0
- data/lib/nylas/http_client.rb +1 -1
- data/lib/nylas/job_status.rb +2 -1
- data/lib/nylas/label.rb +2 -0
- data/lib/nylas/message.rb +8 -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
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1e352b09e650aa0cbc5dff7363b8a0997aab35c94e73a5f4a77b5503de70448
|
4
|
+
data.tar.gz: a7830ea4cc6a9028669ca6c0e502cba4f2dfc70402a2c00f85cd1f6d315d0594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aeed921859461105491d8394f845b79d6419ecc10a17ae0989f2239382cce8e4ad1fb3936bd7a4cebd730e40bac60b28dafe8e145e63a10d424a9e9b46915f0
|
7
|
+
data.tar.gz: 47fdeaa77f5e1037934fc421b7b869edc031f956aad054d2888d29aee0a75ecb537c063e4c89e3c30e4f14f2be2da0860b5ec546e39034590f137773b73ef3cc
|
data/lib/nylas/api.rb
CHANGED
@@ -35,15 +35,19 @@ module Nylas
|
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
|
-
def authentication_url(redirect_uri:, scopes:, response_type: "code", login_hint: nil, state: nil
|
38
|
+
def authentication_url(redirect_uri:, scopes:, response_type: "code", login_hint: nil, state: nil,
|
39
|
+
provider: nil, redirect_on_error: nil)
|
39
40
|
params = {
|
40
41
|
client_id: app_id,
|
41
42
|
redirect_uri: redirect_uri,
|
42
43
|
response_type: response_type,
|
43
44
|
login_hint: login_hint
|
44
45
|
}
|
46
|
+
|
45
47
|
params[:state] = state if state
|
46
48
|
params[:scopes] = scopes.join(",") if scopes
|
49
|
+
params[:provider] = provider if provider
|
50
|
+
params[:redirect_on_error] = redirect_on_error if redirect_on_error
|
47
51
|
|
48
52
|
"#{api_server}/oauth/authorize?#{URI.encode_www_form(params)}"
|
49
53
|
end
|
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
|
@@ -31,18 +31,21 @@ module Nylas
|
|
31
31
|
validate_calendars_or_emails(calendars, emails)
|
32
32
|
validate_open_hours(emails, free_busy, open_hours) unless open_hours.empty?
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
payload = {
|
35
|
+
duration_minutes: duration_minutes,
|
36
|
+
interval_minutes: interval_minutes,
|
37
|
+
start_time: start_time,
|
38
|
+
end_time: end_time,
|
39
|
+
emails: emails,
|
40
|
+
free_busy: free_busy.map(&:to_h),
|
41
|
+
open_hours: open_hours.map(&:to_h),
|
42
|
+
calendars: calendars
|
43
|
+
}
|
44
|
+
payload[:buffer] = buffer if buffer
|
45
|
+
payload[:round_robin] = round_robin if round_robin
|
46
|
+
payload[:event_collection_id] = event_collection_id if event_collection_id
|
47
|
+
|
48
|
+
execute_availability("/calendars/availability", **payload)
|
46
49
|
end
|
47
50
|
|
48
51
|
# Check multiple calendars to find availability for multiple meetings with several participants
|
@@ -68,16 +71,19 @@ module Nylas
|
|
68
71
|
validate_calendars_or_emails(emails, calendars)
|
69
72
|
validate_open_hours(emails, free_busy, open_hours) unless open_hours.empty?
|
70
73
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
payload = {
|
75
|
+
duration_minutes: duration_minutes,
|
76
|
+
interval_minutes: interval_minutes,
|
77
|
+
start_time: start_time,
|
78
|
+
end_time: end_time,
|
79
|
+
emails: emails,
|
80
|
+
free_busy: free_busy.map(&:to_h),
|
81
|
+
open_hours: open_hours.map(&:to_h),
|
82
|
+
calendars: calendars
|
83
|
+
}
|
84
|
+
payload[:buffer] = buffer if buffer
|
85
|
+
|
86
|
+
execute_availability("/calendars/availability/consecutive", **payload)
|
81
87
|
end
|
82
88
|
|
83
89
|
private
|
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
|
@@ -34,6 +40,8 @@ module Nylas
|
|
34
40
|
has_n_of_attribute :notifications, :event_notification
|
35
41
|
has_n_of_attribute :round_robin_order, :string
|
36
42
|
attribute :original_start_time, :unix_timestamp
|
43
|
+
attribute :reminder_minutes, :string
|
44
|
+
attribute :reminder_method, :string
|
37
45
|
attribute :job_status_id, :string, read_only: true
|
38
46
|
|
39
47
|
attr_accessor :notify_participants
|
@@ -48,6 +56,7 @@ module Nylas
|
|
48
56
|
|
49
57
|
def save
|
50
58
|
validate
|
59
|
+
format_reminder_minutes
|
51
60
|
|
52
61
|
super
|
53
62
|
end
|
@@ -111,6 +120,13 @@ module Nylas
|
|
111
120
|
payload
|
112
121
|
end
|
113
122
|
|
123
|
+
# Formats the reminder minute field to match the API format: "[%d]"
|
124
|
+
def format_reminder_minutes
|
125
|
+
return if reminder_minutes.nil? || reminder_minutes.empty? || reminder_minutes.match(/\[\d+\]/)
|
126
|
+
|
127
|
+
self.reminder_minutes = "[#{reminder_minutes}]"
|
128
|
+
end
|
129
|
+
|
114
130
|
def query_params
|
115
131
|
if notify_participants.nil?
|
116
132
|
{}
|
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/http_client.rb
CHANGED
data/lib/nylas/job_status.rb
CHANGED
@@ -6,7 +6,7 @@ module Nylas
|
|
6
6
|
class JobStatus
|
7
7
|
include Model
|
8
8
|
self.resources_path = "/job-statuses"
|
9
|
-
|
9
|
+
self.listable = true
|
10
10
|
|
11
11
|
attribute :id, :string, read_only: true
|
12
12
|
attribute :account_id, :string, read_only: true
|
@@ -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/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
|
@@ -37,6 +43,7 @@ module Nylas
|
|
37
43
|
attribute :folder, :folder
|
38
44
|
attribute :folder_id, :string
|
39
45
|
attribute :metadata, :hash
|
46
|
+
attribute :reply_to_message_id, :string, read_only: true
|
40
47
|
attribute :job_status_id, :string, read_only: true
|
41
48
|
|
42
49
|
has_n_of_attribute :labels, :label, read_only: true
|
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
|
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.12.1
|
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-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -380,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
380
380
|
- !ruby/object:Gem::Version
|
381
381
|
version: '0'
|
382
382
|
requirements: []
|
383
|
-
rubygems_version: 3.3.
|
383
|
+
rubygems_version: 3.3.7
|
384
384
|
signing_key:
|
385
385
|
specification_version: 4
|
386
386
|
summary: Gem for interacting with the Nylas API
|