nylas 6.0.0 → 6.0.1

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: 3bc9d352821f8cde06dbc037ea67f17ed9a74f8dea1f9af98ebd4d03bc931e05
4
+ data.tar.gz: 8a172bc12ea5c467442079dc27f557034ef33924de9222275cde90eb6fafd49a
5
5
  SHA512:
6
- metadata.gz: ef1dd4c3a6351f885a6f7f22af3848f2e0bfdc68ac62c2d933aa0a1336e08eca0975daf9b304543ac493ea87b32636bb4d8b9139f00ca865e44486dc5cdcbb11
7
- data.tar.gz: bb3e97a16d619377c62b9c28fbaf3b4f9e93b3d2ee80d50ad9d6687cec0821c5a5a57f36b090838a500e82a0a2705649adb50fdad5a9be821a302fb0ab800c8e
6
+ metadata.gz: e18c1c89f5bacace76a182d5a2f33215625855d64ba2d5ec406c6529c1d9eee41d54921accf73879dc89db8374ef9d08d85c9ea0939d9fe1efb7e1c92eb5c770
7
+ data.tar.gz: 2a0faa22fdc201dfc556cb65acd0305dbc83c601d649771dad6b7dd5ce15c94b8dc060cfdb2d49ee2a8bb6ba3a86a61fd86d72cbd74a5323793035312f8d38f0
@@ -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
@@ -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
  )
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.1"
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.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: 2024-02-05 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types