nylas 6.0.0.beta.1 → 6.0.0.beta.3
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 +68 -9
- data/lib/nylas/errors.rb +33 -11
- data/lib/nylas/handler/api_operations.rb +7 -5
- data/lib/nylas/handler/http_client.rb +98 -34
- data/lib/nylas/resources/applications.rb +1 -1
- data/lib/nylas/resources/attachments.rb +65 -0
- data/lib/nylas/resources/auth.rb +15 -14
- data/lib/nylas/resources/calendars.rb +83 -13
- data/lib/nylas/resources/connectors.rb +80 -0
- data/lib/nylas/resources/contacts.rb +89 -0
- data/lib/nylas/resources/credentials.rb +75 -0
- data/lib/nylas/resources/drafts.rb +102 -0
- data/lib/nylas/resources/events.rb +89 -11
- data/lib/nylas/resources/folders.rb +73 -0
- data/lib/nylas/resources/grants.rb +47 -9
- data/lib/nylas/resources/messages.rb +126 -0
- data/lib/nylas/resources/redirect_uris.rb +59 -11
- data/lib/nylas/resources/resource.rb +2 -2
- data/lib/nylas/resources/smart_compose.rb +36 -0
- data/lib/nylas/resources/threads.rb +62 -0
- data/lib/nylas/resources/webhooks.rb +62 -11
- data/lib/nylas/utils/file_utils.rb +54 -0
- data/lib/nylas/version.rb +1 -1
- data/lib/nylas.rb +12 -1
- metadata +32 -4
- data/lib/nylas/handler/admin_api_operations.rb +0 -95
- data/lib/nylas/handler/grants_api_operations.rb +0 -99
@@ -1,95 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "http_client"
|
4
|
-
require_relative "api_operations"
|
5
|
-
|
6
|
-
module Nylas
|
7
|
-
# Allows resources to perform CRUD operations on the Admin API endpoints without exposing the
|
8
|
-
# HTTP client to the end user.
|
9
|
-
module AdminApiOperations
|
10
|
-
include HttpClient
|
11
|
-
# Creates a Nylas object.
|
12
|
-
module Create
|
13
|
-
include ApiOperations::Post
|
14
|
-
# Creates a Nylas object.
|
15
|
-
#
|
16
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
17
|
-
# @param request_body [Hash, nil] Request body to pass to the request.
|
18
|
-
# @return [Array(Hash, String)] Created Nylas object and API Request ID.
|
19
|
-
def create(query_params: {}, request_body: nil)
|
20
|
-
post(
|
21
|
-
path: "#{api_uri}/v3/#{resource_name}",
|
22
|
-
query_params: query_params,
|
23
|
-
request_body: request_body
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Lists Nylas objects.
|
29
|
-
module List
|
30
|
-
include ApiOperations::Get
|
31
|
-
# Lists Nylas objects.
|
32
|
-
#
|
33
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
34
|
-
# @return [Array(Hash, String)] List of Nylas objects and API Request ID.
|
35
|
-
def list(query_params: {})
|
36
|
-
get(
|
37
|
-
path: "#{api_uri}/v3/#{resource_name}",
|
38
|
-
query_params: query_params
|
39
|
-
)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Finds a Nylas object.
|
44
|
-
module Find
|
45
|
-
include ApiOperations::Get
|
46
|
-
# Finds a Nylas object.
|
47
|
-
#
|
48
|
-
# @param object_id [String] Object ID.
|
49
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
50
|
-
# @return [Array(Hash, String)] Nylas object and API Request ID.
|
51
|
-
def find(object_id:, query_params: {})
|
52
|
-
get(
|
53
|
-
path: "#{api_uri}/v3/#{resource_name}/#{object_id}",
|
54
|
-
query_params: query_params
|
55
|
-
)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Updates a Nylas object.
|
60
|
-
module Update
|
61
|
-
include ApiOperations::Put
|
62
|
-
# Updates a Nylas object.
|
63
|
-
#
|
64
|
-
# @param object_id [String] Object ID.
|
65
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
66
|
-
# @param request_body [Hash, nil] Request body to pass to the request.
|
67
|
-
# @return [Array(Hash, String)] Updated Nylas object and API Request ID.
|
68
|
-
def update(object_id:, query_params: {}, request_body: nil)
|
69
|
-
put(
|
70
|
-
path: "#{api_uri}/v3/#{resource_name}/#{object_id}",
|
71
|
-
query_params: query_params,
|
72
|
-
request_body: request_body
|
73
|
-
)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# Deletes a Nylas object.
|
78
|
-
module Destroy
|
79
|
-
include ApiOperations::Delete
|
80
|
-
# Deletes a Nylas object.
|
81
|
-
#
|
82
|
-
# @param object_id [String] Object ID.
|
83
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
84
|
-
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
85
|
-
def destroy(object_id:, query_params: {})
|
86
|
-
_, request_id = delete(
|
87
|
-
path: "#{api_uri}/v3/#{resource_name}/#{object_id}",
|
88
|
-
query_params: query_params
|
89
|
-
)
|
90
|
-
|
91
|
-
[true, request_id]
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "http_client"
|
4
|
-
require_relative "api_operations"
|
5
|
-
|
6
|
-
module Nylas
|
7
|
-
# Allows resources to perform CRUD operations on the Grants API endpoints without exposing the
|
8
|
-
# HTTP client to the end user.
|
9
|
-
module GrantsApiOperations
|
10
|
-
# Creates a Nylas object.
|
11
|
-
module Create
|
12
|
-
include ApiOperations::Post
|
13
|
-
# Creates a Nylas object.
|
14
|
-
#
|
15
|
-
# @param identifier [String] Grant ID or email account in which to create the object.
|
16
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
17
|
-
# @param request_body [Hash, nil] Request body to pass to the request.
|
18
|
-
# @return [Array(Hash, String)] Created Nylas object and API Request ID.
|
19
|
-
def create(identifier:, query_params: {}, request_body: nil)
|
20
|
-
post(
|
21
|
-
path: "#{api_uri}/v3/grants/#{identifier}/#{resource_name}",
|
22
|
-
query_params: query_params,
|
23
|
-
request_body: request_body
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Lists Nylas objects.
|
29
|
-
module List
|
30
|
-
include ApiOperations::Get
|
31
|
-
# Lists Nylas objects.
|
32
|
-
#
|
33
|
-
# @param identifier [String] Grant ID or email account to query.
|
34
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
35
|
-
# @return [Array(Hash, String)] List of Nylas objects and API Request ID.
|
36
|
-
def list(identifier:, query_params: {})
|
37
|
-
get(
|
38
|
-
path: "#{api_uri}/v3/grants/#{identifier}/#{resource_name}",
|
39
|
-
query_params: query_params
|
40
|
-
)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# Finds a Nylas object.
|
45
|
-
module Find
|
46
|
-
include ApiOperations::Get
|
47
|
-
# Finds a Nylas object.
|
48
|
-
#
|
49
|
-
# @param identifier [String] Grant ID or email account to query.
|
50
|
-
# @param object_id [String] Object ID.
|
51
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
52
|
-
# @return [Array(Hash, String)] Nylas object and API request ID.
|
53
|
-
def find(identifier:, object_id:, query_params: {})
|
54
|
-
get(
|
55
|
-
path: "#{api_uri}/v3/grants/#{identifier}/#{resource_name}/#{object_id}",
|
56
|
-
query_params: query_params
|
57
|
-
)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# Updates a Nylas object.
|
62
|
-
module Update
|
63
|
-
include ApiOperations::Put
|
64
|
-
# Updates a Nylas object.
|
65
|
-
#
|
66
|
-
# @param identifier [String] Grant ID or email account in which to update an object.
|
67
|
-
# @param object_id [String] Object ID.
|
68
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
69
|
-
# @param request_body [Hash, nil] Request body to pass to the request.
|
70
|
-
# @return [Array(Hash, String)] Updated Nylas object and API Request ID.
|
71
|
-
def update(identifier:, object_id:, query_params: {}, request_body: nil)
|
72
|
-
put(
|
73
|
-
path: "#{api_uri}/v3/grants/#{identifier}/#{resource_name}/#{object_id}",
|
74
|
-
query_params: query_params,
|
75
|
-
request_body: request_body
|
76
|
-
)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# Deletes a Nylas object.
|
81
|
-
module Destroy
|
82
|
-
include ApiOperations::Delete
|
83
|
-
# Deletes a Nylas object.
|
84
|
-
#
|
85
|
-
# @param identifier [String] Grant ID or email account from which to delete an object.
|
86
|
-
# @param object_id [String] Object ID.
|
87
|
-
# @param query_params [Hash, {}] Query params to pass to the request.
|
88
|
-
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
89
|
-
def destroy(identifier:, object_id:, query_params: {})
|
90
|
-
_, request_id = delete(
|
91
|
-
path: "#{api_uri}/v3/grants/#{identifier}/#{resource_name}/#{object_id}",
|
92
|
-
query_params: query_params
|
93
|
-
)
|
94
|
-
|
95
|
-
[true, request_id]
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|