Class: Nylas::Workspaces
- Includes:
- ApiOperations::Delete, ApiOperations::Get, ApiOperations::Patch, ApiOperations::Post
- Defined in:
- lib/nylas/resources/workspaces.rb
Overview
Nylas Workspaces API
A workspace groups grants in a Nylas application by email domain. Grants can be auto-grouped (by matching email domain) or manually assigned/removed.
Instance Method Summary collapse
-
#auto_group(request_body: nil) ⇒ Array(Hash, String, Hash)
Auto-group grants into workspaces by matching email domain.
-
#create(request_body:) ⇒ Array(Hash, String, Hash)
Create a workspace.
-
#destroy(workspace_id:) ⇒ Array(TrueClass, String)
Delete a workspace.
-
#find(workspace_id:) ⇒ Array(Hash, String, Hash)
Return a workspace.
-
#list ⇒ Array(Array(Hash), String, Hash)
Return all workspaces for the application.
-
#manual_assign(workspace_id:, request_body:) ⇒ Array(Hash, String, Hash)
Manually assign grants to or remove grants from a workspace.
-
#update(workspace_id:, request_body:) ⇒ Array(Hash, String)
Update a workspace.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Nylas::Resource
Instance Method Details
#auto_group(request_body: nil) ⇒ Array(Hash, String, Hash)
Auto-group grants into workspaces by matching email domain.
Runs as a background job and returns immediately with a job ID. Rate limited to one call per minute per application.
89 90 91 92 93 94 |
# File 'lib/nylas/resources/workspaces.rb', line 89 def auto_group(request_body: nil) post( path: "#{api_uri}/v3/workspaces/auto-group", request_body: request_body ) end |
#create(request_body:) ⇒ Array(Hash, String, Hash)
Create a workspace.
46 47 48 49 50 51 |
# File 'lib/nylas/resources/workspaces.rb', line 46 def create(request_body:) post( path: "#{api_uri}/v3/workspaces", request_body: request_body ) end |
#destroy(workspace_id:) ⇒ Array(TrueClass, String)
Delete a workspace.
73 74 75 76 77 78 79 |
# File 'lib/nylas/resources/workspaces.rb', line 73 def destroy(workspace_id:) _, request_id = delete( path: "#{api_uri}/v3/workspaces/#{workspace_id}" ) [true, request_id] end |
#find(workspace_id:) ⇒ Array(Hash, String, Hash)
Return a workspace.
34 35 36 37 38 |
# File 'lib/nylas/resources/workspaces.rb', line 34 def find(workspace_id:) get( path: "#{api_uri}/v3/workspaces/#{workspace_id}" ) end |
#list ⇒ Array(Array(Hash), String, Hash)
Return all workspaces for the application.
The list endpoint is not paginated; data is a flat array of workspaces.
23 24 25 26 27 |
# File 'lib/nylas/resources/workspaces.rb', line 23 def list get( path: "#{api_uri}/v3/workspaces" ) end |
#manual_assign(workspace_id:, request_body:) ⇒ Array(Hash, String, Hash)
Manually assign grants to or remove grants from a workspace.
104 105 106 107 108 109 |
# File 'lib/nylas/resources/workspaces.rb', line 104 def manual_assign(workspace_id:, request_body:) post( path: "#{api_uri}/v3/workspaces/#{workspace_id}/manual-assign", request_body: request_body ) end |
#update(workspace_id:, request_body:) ⇒ Array(Hash, String)
Update a workspace.
The API exposes update via PATCH only (there is no PUT route). The workspace must be addressed by its UUID; a domain path param is not accepted on update.
61 62 63 64 65 66 |
# File 'lib/nylas/resources/workspaces.rb', line 61 def update(workspace_id:, request_body:) patch( path: "#{api_uri}/v3/workspaces/#{workspace_id}", request_body: request_body ) end |