nylas 6.0.0 → 6.0.2

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: a84dfeb084c667f7b3e8f41e03ae5ef51be7c04fefd1e36ac357fd701a5a7a82
4
- data.tar.gz: 14bd5db7be83cac30aadc723089dac7502198de4b7ed7a23cb58b6dc6984c870
3
+ metadata.gz: 4210ab41b7981d0dee78c6c08cad413063e621f0142909ef9e156e477092c572
4
+ data.tar.gz: 8845808ca7a7a993676b02373ab89d9db702742f2f3ad89678b529392e9596b0
5
5
  SHA512:
6
- metadata.gz: ef1dd4c3a6351f885a6f7f22af3848f2e0bfdc68ac62c2d933aa0a1336e08eca0975daf9b304543ac493ea87b32636bb4d8b9139f00ca865e44486dc5cdcbb11
7
- data.tar.gz: bb3e97a16d619377c62b9c28fbaf3b4f9e93b3d2ee80d50ad9d6687cec0821c5a5a57f36b090838a500e82a0a2705649adb50fdad5a9be821a302fb0ab800c8e
6
+ metadata.gz: 47e3479b8c975bd0bb4d5d25dd336abb1f8fa469e06d2eeda5b039ae4d09d7a3f5cab3efb7f2d9ec4b9124a991ccdd531766a32b6a89b70c6a26b878f6f03792
7
+ data.tar.gz: c69da1ded4c8f953009b747b999e743e6bc6ef1418d88544f3d33991a655ad40a9c95a94db6ed2f13a0bf2bda133858f35f738e4e2cdfa0c9130061e5a35098b
@@ -11,13 +11,37 @@ module Nylas
11
11
  protected
12
12
 
13
13
  include HttpClient
14
- # Performs a GET call to the Nylas API.
14
+ # Performs a GET call to the Nylas API for a single item response.
15
15
  #
16
16
  # @param path [String] Destination path for the call.
17
17
  # @param query_params [Hash, {}] Query params to pass to the call.
18
- # @return Nylas data object and API Request ID.
18
+ # @return [Array([Hash, Array], String)] Nylas data object and API Request ID.
19
19
  def get(path:, query_params: {})
20
- response = execute(
20
+ response = get_raw(path: path, query_params: query_params)
21
+
22
+ [response[:data], response[:request_id]]
23
+ end
24
+
25
+ # Performs a GET call to the Nylas API for a list response.
26
+ #
27
+ # @param path [String] Destination path for the call.
28
+ # @param query_params [Hash, {}] Query params to pass to the call.
29
+ # @return [Array(Array(Hash), String, String)] Nylas data array, API Request ID, and next cursor.
30
+ def get_list(path:, query_params: {})
31
+ response = get_raw(path: path, query_params: query_params)
32
+
33
+ [response[:data], response[:request_id], response[:next_cursor]]
34
+ end
35
+
36
+ private
37
+
38
+ # Performs a GET call to the Nylas API.
39
+ #
40
+ # @param path [String] Destination path for the call.
41
+ # @param query_params [Hash, {}] Query params to pass to the call.
42
+ # @return [Hash] The JSON response from the Nylas API.
43
+ def get_raw(path:, query_params: {})
44
+ execute(
21
45
  method: :get,
22
46
  path: path,
23
47
  query: query_params,
@@ -25,8 +49,6 @@ module Nylas
25
49
  api_key: api_key,
26
50
  timeout: timeout
27
51
  )
28
-
29
- [response[:data], response[:request_id]]
30
52
  end
31
53
  end
32
54
 
@@ -39,7 +61,7 @@ module Nylas
39
61
  #
40
62
  # @param path [String] Destination path for the call.
41
63
  # @param query_params [Hash, {}] Query params to pass to the call.
42
- # @param request_body [String, Hash, nil] Request body to pass to the call.
64
+ # @param request_body [Hash, nil] Request body to pass to the call.
43
65
  # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
44
66
  # @return Nylas data object and API Request ID.
45
67
  def post(path:, query_params: {}, request_body: nil, headers: {})
@@ -66,7 +88,7 @@ module Nylas
66
88
  #
67
89
  # @param path [String] Destination path for the call.
68
90
  # @param query_params [Hash, {}] Query params to pass to the call.
69
- # @param request_body [String, Hash, nil] Request body to pass to the call.
91
+ # @param request_body [Hash, nil] Request body to pass to the call.
70
92
  # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
71
93
  # @return Nylas data object and API Request ID.
72
94
  def put(path:, query_params: {}, request_body: nil, headers: {})
@@ -93,7 +115,7 @@ module Nylas
93
115
  #
94
116
  # @param path [String] Destination path for the call.
95
117
  # @param query_params [Hash, {}] Query params to pass to the call.
96
- # @param request_body [String, Hash, nil] Request body to pass to the call.
118
+ # @param request_body [Hash, nil] Request body to pass to the call.
97
119
  # @param headers [Hash, {}] Additional HTTP headers to include in the payload.
98
120
  # @return Nylas data object and API Request ID.
99
121
  def patch(path:, query_params: {}, request_body: nil, headers: {})
@@ -151,7 +151,7 @@ module Nylas
151
151
  def url_auth_builder(config)
152
152
  builder = URI.parse(api_uri)
153
153
  builder.path = "/v3/connect/auth"
154
- builder.query = URI.encode_www_form(build_query(config)).gsub!("+", "%20")
154
+ builder.query = URI.encode_www_form(build_query(config)).gsub(/\+/, "%20")
155
155
 
156
156
  builder
157
157
  end
@@ -15,9 +15,9 @@ module Nylas
15
15
  #
16
16
  # @param identifier [String] Grant ID or email account to query.
17
17
  # @param query_params [Hash, nil] Query params to pass to the request.
18
- # @return [Array(Array(Hash), String)] The list of calendars and API Request ID.
18
+ # @return [Array(Array(Hash), String, String)] The list of calendars, API Request ID, and next cursor.
19
19
  def list(identifier:, query_params: nil)
20
- get(
20
+ get_list(
21
21
  path: "#{api_uri}/v3/grants/#{identifier}/calendars",
22
22
  query_params: query_params
23
23
  )
@@ -15,9 +15,9 @@ module Nylas
15
15
  #
16
16
  # @param identifier [String] Grant ID or email account to query.
17
17
  # @param query_params [Hash, nil] Query params to pass to the request.
18
- # @return [Array(Array(Hash), String)] The list of contacts and API Request ID.
18
+ # @return [Array(Array(Hash), String, String)] The list of contacts, API Request ID, and next cursor.
19
19
  def list(identifier:, query_params: nil)
20
- get(
20
+ get_list(
21
21
  path: "#{api_uri}/v3/grants/#{identifier}/contacts",
22
22
  query_params: query_params
23
23
  )
@@ -78,9 +78,9 @@ module Nylas
78
78
  #
79
79
  # @param identifier [String] Grant ID or email account to query.
80
80
  # @param query_params [Hash, nil] Query params to pass to the request.
81
- # @return [Array(Array(Hash), String)] The list of contact groups and API Request ID.
81
+ # @return [Array(Array(Hash), String, String)] The list of contact groups and API Request ID.
82
82
  def list_groups(identifier:, query_params: nil)
83
- get(
83
+ get_list(
84
84
  path: "#{api_uri}/v3/grants/#{identifier}/contacts/groups",
85
85
  query_params: query_params
86
86
  )
@@ -16,9 +16,9 @@ module Nylas
16
16
  #
17
17
  # @param identifier [String] Grant ID or email account to query.
18
18
  # @param query_params [Hash, nil] Query params to pass to the request.
19
- # @return [Array(Array(Hash), String)] The list of drafts and API Request ID.
19
+ # @return [Array(Array(Hash), String, String)] The list of drafts, API Request ID, and next cursor.
20
20
  def list(identifier:, query_params: nil)
21
- get(
21
+ get_list(
22
22
  path: "#{api_uri}/v3/grants/#{identifier}/drafts",
23
23
  query_params: query_params
24
24
  )
@@ -15,9 +15,9 @@ module Nylas
15
15
  #
16
16
  # @param identifier [String] Grant ID or email account to query.
17
17
  # @param query_params [Hash] Query params to pass to the request.
18
- # @return [Array(Array(Hash), String)] The list of events and API Request ID.
18
+ # @return [Array(Array(Hash), String, String)] The list of events, API Request ID, and next cursor.
19
19
  def list(identifier:, query_params:)
20
- get(
20
+ get_list(
21
21
  path: "#{api_uri}/v3/grants/#{identifier}/events",
22
22
  query_params: query_params
23
23
  )
@@ -14,9 +14,9 @@ module Nylas
14
14
  # Return all folders.
15
15
  #
16
16
  # @param identifier [String] Grant ID or email account to query.
17
- # @return [Array(Array(Hash), String)] The list of folders and API Request ID.
17
+ # @return [Array(Array(Hash), String, String)] The list of folders, API Request ID, and next cursor.
18
18
  def list(identifier:)
19
- get(
19
+ get_list(
20
20
  path: "#{api_uri}/v3/grants/#{identifier}/folders"
21
21
  )
22
22
  end
@@ -9,6 +9,7 @@ module Nylas
9
9
  include ApiOperations::Get
10
10
  include ApiOperations::Put
11
11
  include ApiOperations::Delete
12
+ include ApiOperations::Patch
12
13
 
13
14
  # Return all grants.
14
15
  #
@@ -37,7 +38,7 @@ module Nylas
37
38
  # @param request_body [Hash] The values to update the grant with
38
39
  # @return [Array(Hash, String)] The updated grant and API Request ID.
39
40
  def update(grant_id:, request_body:)
40
- put(
41
+ patch(
41
42
  path: "#{api_uri}/v3/grants/#{grant_id}",
42
43
  request_body: request_body
43
44
  )
@@ -26,9 +26,9 @@ module Nylas
26
26
  #
27
27
  # @param identifier [String] Grant ID or email account to query.
28
28
  # @param query_params [Hash, nil] Query params to pass to the request.
29
- # @return [Array(Array(Hash), String)] The list of messages and API Request ID.
29
+ # @return [Array(Array(Hash), String, String)] The list of messages, API Request ID, and next cursor.
30
30
  def list(identifier:, query_params: nil)
31
- get(
31
+ get_list(
32
32
  path: "#{api_uri}/v3/grants/#{identifier}/messages",
33
33
  query_params: query_params
34
34
  )
@@ -94,7 +94,7 @@ module Nylas
94
94
  # Retrieve your scheduled messages.
95
95
  #
96
96
  # @param identifier [String] Grant ID or email account from which to find the scheduled message from.
97
- # @return [Array(Hash, String)] The list of scheduled messages and the API Request ID.
97
+ # @return [Array(Array(Hash), String)] The list of scheduled messages and the API Request ID.
98
98
  def list_scheduled_messages(identifier:)
99
99
  get(
100
100
  path: "#{api_uri}/v3/grants/#{identifier}/messages/schedules"
@@ -14,9 +14,9 @@ module Nylas
14
14
  #
15
15
  # @param identifier [String] Grant ID or email account to query.
16
16
  # @param query_params [Hash] Query params to pass to the request.
17
- # @return [Array(Array(Hash), String)] The list of threads and API Request ID.
17
+ # @return [Array(Array(Hash), String, String)] The list of threads, API Request ID, and next cursor.
18
18
  def list(identifier:, query_params: nil)
19
- get(
19
+ get_list(
20
20
  path: "#{api_uri}/v3/grants/#{identifier}/threads",
21
21
  query_params: query_params
22
22
  )
@@ -89,8 +89,8 @@ module Nylas
89
89
  # @param webhook_id [String] The ID of the webhook destination to update.
90
90
  # @return [Array(Hash, String)] The updated webhook destination and API Request ID.
91
91
  def rotate_secret(webhook_id:)
92
- put(
93
- path: "#{api_uri}/v3/webhooks/#{webhook_id}/rotate-secret",
92
+ post(
93
+ path: "#{api_uri}/v3/webhooks/rotate-secret/#{webhook_id}",
94
94
  request_body: {}
95
95
  )
96
96
  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 = "6.0.0"
4
+ VERSION = "6.0.2"
5
5
  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: 6.0.0
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nylas, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types