nylas 6.3.0 → 6.4.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/client.rb +7 -0
- data/lib/nylas/errors.rb +6 -4
- data/lib/nylas/handler/http_client.rb +10 -5
- data/lib/nylas/resources/calendars.rb +3 -1
- data/lib/nylas/resources/events.rb +3 -1
- data/lib/nylas/resources/notetakers.rb +142 -0
- data/lib/nylas/resources/webhooks.rb +1 -0
- data/lib/nylas/version.rb +1 -1
- data/lib/nylas.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 275a09b48ad361ba1f441efa8b32a026fa547c0296ea3b681da440e6c7652516
|
4
|
+
data.tar.gz: 813293f38fabeb6cbfae1a9974a6e27622c68352442982a49890c176c354a2d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3453ab99f8e2ab3bec6abd2f2cad0c8ea0d43e26a328eb3ff318b2c250f3cc4d699396c7638648118f4b2af47d37aca767f4106ad04dc5a0858b2c99f6814d5e
|
7
|
+
data.tar.gz: 236711014f51f24b29c64fbe578cf0eea851cb44bb486dec3ec39c73a9311cb84a42d1f78d5c29e5eeae8025aef154e9e2ae74789fc50c9b5ebfe39eb9226a93
|
data/lib/nylas/client.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative "resources/auth"
|
|
8
8
|
require_relative "resources/webhooks"
|
9
9
|
require_relative "resources/applications"
|
10
10
|
require_relative "resources/folders"
|
11
|
+
require_relative "resources/notetakers"
|
11
12
|
require_relative "resources/scheduler"
|
12
13
|
|
13
14
|
module Nylas
|
@@ -124,5 +125,11 @@ module Nylas
|
|
124
125
|
def scheduler
|
125
126
|
Scheduler.new(self)
|
126
127
|
end
|
128
|
+
|
129
|
+
# The Notetaker resources for your Nylas application.
|
130
|
+
# @return [Nylas::Notetakers] Notetaker resources for your Nylas application.
|
131
|
+
def notetakers
|
132
|
+
Notetakers.new(self)
|
133
|
+
end
|
127
134
|
end
|
128
135
|
end
|
data/lib/nylas/errors.rb
CHANGED
@@ -14,7 +14,7 @@ module Nylas
|
|
14
14
|
|
15
15
|
# Error class representing a failed response from the Nylas API.
|
16
16
|
class NylasApiError < AbstractNylasApiError
|
17
|
-
attr_accessor :type, :request_id, :provider_error, :status_code
|
17
|
+
attr_accessor :type, :request_id, :provider_error, :status_code, :headers
|
18
18
|
|
19
19
|
# Initializes an error and assigns the given attributes to it.
|
20
20
|
#
|
@@ -23,24 +23,26 @@ module Nylas
|
|
23
23
|
# @param status_code [Integer] Error status code.
|
24
24
|
# @param provider_error [Hash, nil] The error from the provider.
|
25
25
|
# @param request_id [Hash, nil] The ID of the request.
|
26
|
-
def initialize(type, message, status_code, provider_error = nil, request_id = nil)
|
26
|
+
def initialize(type, message, status_code, provider_error = nil, request_id = nil, headers = nil)
|
27
27
|
super(message)
|
28
28
|
self.type = type
|
29
29
|
self.status_code = status_code
|
30
30
|
self.provider_error = provider_error
|
31
31
|
self.request_id = request_id
|
32
|
+
self.headers = headers
|
32
33
|
end
|
33
34
|
|
34
35
|
# Parses the error response.
|
35
36
|
#
|
36
37
|
# @param response [Hash] Response from the Nylas API.
|
37
38
|
# @param status_code [Integer] Error status code.
|
38
|
-
def self.parse_error_response(response, status_code)
|
39
|
+
def self.parse_error_response(response, status_code, headers = nil)
|
39
40
|
new(
|
40
41
|
response["type"],
|
41
42
|
response["message"],
|
42
43
|
status_code,
|
43
|
-
response["provider_error"]
|
44
|
+
response["provider_error"],
|
45
|
+
headers
|
44
46
|
)
|
45
47
|
end
|
46
48
|
end
|
@@ -119,7 +119,7 @@ module Nylas
|
|
119
119
|
def parse_response(response)
|
120
120
|
return response if response.is_a?(Enumerable)
|
121
121
|
|
122
|
-
Yajl::Parser.new(symbolize_names: true).parse(response)
|
122
|
+
Yajl::Parser.new(symbolize_names: true).parse(response) || raise(Nylas::JsonParseError)
|
123
123
|
rescue Yajl::ParseError
|
124
124
|
raise Nylas::JsonParseError
|
125
125
|
end
|
@@ -191,22 +191,26 @@ module Nylas
|
|
191
191
|
def error_hash_to_exception(response, status_code, path)
|
192
192
|
return if !response || !response.key?(:error)
|
193
193
|
|
194
|
+
# Safely get headers without risking KeyError
|
195
|
+
headers = response.key?(:headers) ? response[:headers] : nil
|
196
|
+
|
194
197
|
if %W[#{api_uri}/v3/connect/token #{api_uri}/v3/connect/revoke].include?(path)
|
195
198
|
NylasOAuthError.new(response[:error], response[:error_description], response[:error_uri],
|
196
199
|
response[:error_code], status_code)
|
197
200
|
else
|
198
|
-
throw_error(response, status_code)
|
201
|
+
throw_error(response, status_code, headers)
|
199
202
|
end
|
200
203
|
end
|
201
204
|
|
202
|
-
def throw_error(response, status_code)
|
205
|
+
def throw_error(response, status_code, headers = nil)
|
203
206
|
error_obj = response[:error]
|
204
207
|
|
205
208
|
# If `error_obj` is just a string, turn it into a hash with default keys.
|
206
209
|
if error_obj.is_a?(String)
|
207
210
|
error_obj = {
|
208
211
|
type: "NylasApiError",
|
209
|
-
message: error_obj
|
212
|
+
message: error_obj,
|
213
|
+
headers: headers
|
210
214
|
}
|
211
215
|
end
|
212
216
|
|
@@ -217,7 +221,8 @@ module Nylas
|
|
217
221
|
error_obj[:message],
|
218
222
|
status_code,
|
219
223
|
provider_error,
|
220
|
-
response[:request_id]
|
224
|
+
response[:request_id],
|
225
|
+
headers
|
221
226
|
)
|
222
227
|
end
|
223
228
|
|
@@ -39,6 +39,7 @@ module Nylas
|
|
39
39
|
#
|
40
40
|
# @param identifier [String] Grant ID or email account in which to create the object.
|
41
41
|
# @param request_body [Hash] The values to create the calendar with.
|
42
|
+
# This can include a `notetaker` object with settings and calendar sync rules for the Notetaker bot.
|
42
43
|
# @return [Array(Hash, String)] The created calendar and API Request ID.
|
43
44
|
def create(identifier:, request_body:)
|
44
45
|
post(
|
@@ -52,7 +53,8 @@ module Nylas
|
|
52
53
|
# @param identifier [String] Grant ID or email account in which to update an object.
|
53
54
|
# @param calendar_id [String] The id of the calendar to update.
|
54
55
|
# Use "primary" to refer to the primary calendar associated with grant.
|
55
|
-
# @param request_body [Hash] The values to update the calendar with
|
56
|
+
# @param request_body [Hash] The values to update the calendar with.
|
57
|
+
# This can include a `notetaker` object with settings and calendar sync rules for the Notetaker bot.
|
56
58
|
# @return [Array(Hash, String)] The updated calendar and API Request ID.
|
57
59
|
def update(identifier:, calendar_id:, request_body:)
|
58
60
|
put(
|
@@ -40,6 +40,7 @@ module Nylas
|
|
40
40
|
#
|
41
41
|
# @param identifier [String] Grant ID or email account in which to create the object.
|
42
42
|
# @param request_body [Hash] The values to create the event with.
|
43
|
+
# This can include a `notetaker` object with settings for the Notetaker bot.
|
43
44
|
# @param query_params [Hash] The query parameters to include in the request.
|
44
45
|
# @return [Array(Hash, String)] The created event and API Request ID.
|
45
46
|
def create(identifier:, request_body:, query_params:)
|
@@ -54,7 +55,8 @@ module Nylas
|
|
54
55
|
#
|
55
56
|
# @param identifier [String] Grant ID or email account in which to update an object.
|
56
57
|
# @param event_id [String] The id of the event to update.
|
57
|
-
# @param request_body [Hash] The values to update the event with
|
58
|
+
# @param request_body [Hash] The values to update the event with.
|
59
|
+
# This can include a `notetaker` object with settings for the Notetaker bot.
|
58
60
|
# @param query_params [Hash] The query parameters to include in the request
|
59
61
|
# @return [Array(Hash, String)] The updated event and API Request ID.
|
60
62
|
def update(identifier:, event_id:, request_body:, query_params:)
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
|
6
|
+
module Nylas
|
7
|
+
# Nylas Notetaker API
|
8
|
+
class Notetakers < Resource
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
include ApiOperations::Patch
|
14
|
+
|
15
|
+
# Return all notetakers.
|
16
|
+
#
|
17
|
+
# @param identifier [String, nil] Grant ID or email account to query.
|
18
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
19
|
+
# @return [Array(Array(Hash), String, String)] The list of notetakers, API Request ID, and next cursor.
|
20
|
+
def list(identifier: nil, query_params: nil)
|
21
|
+
path = identifier ? "#{api_uri}/v3/grants/#{identifier}/notetakers" : "#{api_uri}/v3/notetakers"
|
22
|
+
|
23
|
+
get_list(
|
24
|
+
path: path,
|
25
|
+
query_params: query_params
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Return a notetaker.
|
30
|
+
#
|
31
|
+
# @param notetaker_id [String] The id of the notetaker to return.
|
32
|
+
# @param identifier [String, nil] Grant ID or email account to query.
|
33
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
34
|
+
# @return [Array(Hash, String)] The notetaker and API request ID.
|
35
|
+
def find(notetaker_id:, identifier: nil, query_params: nil)
|
36
|
+
base_path = "#{api_uri}/v3"
|
37
|
+
path = if identifier
|
38
|
+
"#{base_path}/grants/#{identifier}/notetakers/#{notetaker_id}"
|
39
|
+
else
|
40
|
+
"#{base_path}/notetakers/#{notetaker_id}"
|
41
|
+
end
|
42
|
+
|
43
|
+
get(
|
44
|
+
path: path,
|
45
|
+
query_params: query_params
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Invite a notetaker to a meeting.
|
50
|
+
#
|
51
|
+
# @param request_body [Hash] The values to create the notetaker with.
|
52
|
+
# @param identifier [String, nil] Grant ID or email account in which to create the object.
|
53
|
+
# @return [Array(Hash, String)] The created notetaker and API Request ID.
|
54
|
+
def create(request_body:, identifier: nil)
|
55
|
+
path = identifier ? "#{api_uri}/v3/grants/#{identifier}/notetakers" : "#{api_uri}/v3/notetakers"
|
56
|
+
|
57
|
+
post(
|
58
|
+
path: path,
|
59
|
+
request_body: request_body
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Update a scheduled notetaker.
|
64
|
+
#
|
65
|
+
# @param notetaker_id [String] The id of the notetaker to update.
|
66
|
+
# @param request_body [Hash] The values to update the notetaker with
|
67
|
+
# @param identifier [String, nil] Grant ID or email account in which to update an object.
|
68
|
+
# @return [Array(Hash, String)] The updated notetaker and API Request ID.
|
69
|
+
def update(notetaker_id:, request_body:, identifier: nil)
|
70
|
+
base_path = "#{api_uri}/v3"
|
71
|
+
path = if identifier
|
72
|
+
"#{base_path}/grants/#{identifier}/notetakers/#{notetaker_id}"
|
73
|
+
else
|
74
|
+
"#{base_path}/notetakers/#{notetaker_id}"
|
75
|
+
end
|
76
|
+
|
77
|
+
patch(
|
78
|
+
path: path,
|
79
|
+
request_body: request_body
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Download notetaker media.
|
84
|
+
#
|
85
|
+
# @param notetaker_id [String] The id of the notetaker to download media from.
|
86
|
+
# @param identifier [String, nil] Grant ID or email account to query.
|
87
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
88
|
+
# @return [Array(Hash, String)] The media data and API request ID.
|
89
|
+
def download_media(notetaker_id:, identifier: nil, query_params: nil)
|
90
|
+
base_path = "#{api_uri}/v3"
|
91
|
+
path = if identifier
|
92
|
+
"#{base_path}/grants/#{identifier}/notetakers/#{notetaker_id}/media"
|
93
|
+
else
|
94
|
+
"#{base_path}/notetakers/#{notetaker_id}/media"
|
95
|
+
end
|
96
|
+
|
97
|
+
get(
|
98
|
+
path: path,
|
99
|
+
query_params: query_params
|
100
|
+
)
|
101
|
+
end
|
102
|
+
|
103
|
+
# Remove a notetaker from a meeting.
|
104
|
+
#
|
105
|
+
# @param notetaker_id [String] The id of the notetaker to remove.
|
106
|
+
# @param identifier [String, nil] Grant ID or email account to query.
|
107
|
+
# @return [Array(Hash, String)] The response data and API request ID.
|
108
|
+
def leave(notetaker_id:, identifier: nil)
|
109
|
+
base_path = "#{api_uri}/v3"
|
110
|
+
path = if identifier
|
111
|
+
"#{base_path}/grants/#{identifier}/notetakers/#{notetaker_id}/leave"
|
112
|
+
else
|
113
|
+
"#{base_path}/notetakers/#{notetaker_id}/leave"
|
114
|
+
end
|
115
|
+
|
116
|
+
post(
|
117
|
+
path: path,
|
118
|
+
request_body: {}
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Cancel a scheduled notetaker.
|
123
|
+
#
|
124
|
+
# @param notetaker_id [String] The id of the notetaker to cancel.
|
125
|
+
# @param identifier [String, nil] Grant ID or email account from which to delete an object.
|
126
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the cancel operation.
|
127
|
+
def cancel(notetaker_id:, identifier: nil)
|
128
|
+
base_path = "#{api_uri}/v3"
|
129
|
+
path = if identifier
|
130
|
+
"#{base_path}/grants/#{identifier}/notetakers/#{notetaker_id}/cancel"
|
131
|
+
else
|
132
|
+
"#{base_path}/notetakers/#{notetaker_id}/cancel"
|
133
|
+
end
|
134
|
+
|
135
|
+
_, request_id = delete(
|
136
|
+
path: path
|
137
|
+
)
|
138
|
+
|
139
|
+
[true, request_id]
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -22,6 +22,7 @@ module Nylas
|
|
22
22
|
MESSAGE_CREATED = "message.created"
|
23
23
|
MESSAGE_UPDATED = "message.updated"
|
24
24
|
MESSAGE_OPENED = "message.opened"
|
25
|
+
MESSAGE_BOUNCE_DETECTED = "message.bounce_detected"
|
25
26
|
MESSAGE_LINK_CLICKED = "message.link_clicked"
|
26
27
|
THREAD_REPLIED = "thread.replied"
|
27
28
|
FOLDER_CREATED = "folder.created"
|
data/lib/nylas/version.rb
CHANGED
data/lib/nylas.rb
CHANGED
@@ -39,6 +39,7 @@ require_relative "nylas/resources/events"
|
|
39
39
|
require_relative "nylas/resources/folders"
|
40
40
|
require_relative "nylas/resources/grants"
|
41
41
|
require_relative "nylas/resources/messages"
|
42
|
+
require_relative "nylas/resources/notetakers"
|
42
43
|
require_relative "nylas/resources/smart_compose"
|
43
44
|
require_relative "nylas/resources/threads"
|
44
45
|
require_relative "nylas/resources/redirect_uris"
|
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: 6.
|
4
|
+
version: 6.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: 2025-
|
11
|
+
date: 2025-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -154,6 +154,20 @@ dependencies:
|
|
154
154
|
- - "~>"
|
155
155
|
- !ruby/object:Gem::Version
|
156
156
|
version: '2.22'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: rubocop-capybara
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - "~>"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '2.20'
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '2.20'
|
157
171
|
- !ruby/object:Gem::Dependency
|
158
172
|
name: rspec
|
159
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,6 +291,7 @@ files:
|
|
277
291
|
- lib/nylas/resources/folders.rb
|
278
292
|
- lib/nylas/resources/grants.rb
|
279
293
|
- lib/nylas/resources/messages.rb
|
294
|
+
- lib/nylas/resources/notetakers.rb
|
280
295
|
- lib/nylas/resources/redirect_uris.rb
|
281
296
|
- lib/nylas/resources/resource.rb
|
282
297
|
- lib/nylas/resources/scheduler.rb
|