Class: Knockapi::Resources::Tenants
- Inherits:
-
Object
- Object
- Knockapi::Resources::Tenants
- Defined in:
- lib/knockapi/resources/tenants.rb,
lib/knockapi/resources/tenants/bulk.rb,
sig/knockapi/resources/tenants.rbs,
sig/knockapi/resources/tenants/bulk.rbs
Overview
A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
Defined Under Namespace
Classes: Bulk
Instance Attribute Summary collapse
-
#bulk ⇒ Knockapi::Resources::Tenants::Bulk
readonly
A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
Instance Method Summary collapse
-
#delete(id, request_options: {}) ⇒ nil
Delete a tenant and all associated data.
-
#get(id, resolve_full_preference_settings: nil, request_options: {}) ⇒ Knockapi::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantGetParams for more details.
-
#initialize(client:) ⇒ Tenants
constructor
private
A new instance of Tenants.
-
#list(after: nil, before: nil, name: nil, page_size: nil, tenant_id: nil, request_options: {}) ⇒ Knockapi::Internal::EntriesCursor<Knockapi::Models::Tenant>
List tenants for the current environment.
-
#set(id, resolve_full_preference_settings: nil, channel_data: nil, name: nil, settings: nil, request_options: {}) ⇒ Knockapi::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantSetParams for more details.
Constructor Details
#initialize(client:) ⇒ Tenants
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tenants.
133 134 135 136 |
# File 'lib/knockapi/resources/tenants.rb', line 133 def initialize(client:) @client = client @bulk = Knockapi::Resources::Tenants::Bulk.new(client: client) end |
Instance Attribute Details
#bulk ⇒ Knockapi::Resources::Tenants::Bulk (readonly)
A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
11 12 13 |
# File 'lib/knockapi/resources/tenants.rb', line 11 def bulk @bulk end |
Instance Method Details
#delete(id, request_options: {}) ⇒ nil
Delete a tenant and all associated data. This operation cannot be undone.
56 57 58 59 60 61 62 63 |
# File 'lib/knockapi/resources/tenants.rb', line 56 def delete(id, params = {}) @client.request( method: :delete, path: ["v1/tenants/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#get(id, resolve_full_preference_settings: nil, request_options: {}) ⇒ Knockapi::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantGetParams for more details.
Get a tenant by ID.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/knockapi/resources/tenants.rb', line 81 def get(id, params = {}) parsed, = Knockapi::TenantGetParams.dump_request(params) query = Knockapi::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/tenants/%1$s", id], query: query, model: Knockapi::Tenant, options: ) end |
#list(after: nil, before: nil, name: nil, page_size: nil, tenant_id: nil, request_options: {}) ⇒ Knockapi::Internal::EntriesCursor<Knockapi::Models::Tenant>
List tenants for the current environment.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/knockapi/resources/tenants.rb', line 32 def list(params = {}) parsed, = Knockapi::TenantListParams.dump_request(params) query = Knockapi::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/tenants", query: query, page: Knockapi::Internal::EntriesCursor, model: Knockapi::Tenant, options: ) end |
#set(id, resolve_full_preference_settings: nil, channel_data: nil, name: nil, settings: nil, request_options: {}) ⇒ Knockapi::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantSetParams for more details.
Sets a tenant within an environment, performing an upsert operation. Any existing properties will be merged with the incoming properties.
116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/knockapi/resources/tenants.rb', line 116 def set(id, params = {}) query_params = [:resolve_full_preference_settings] parsed, = Knockapi::TenantSetParams.dump_request(params) query = Knockapi::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :put, path: ["v1/tenants/%1$s", id], query: query, body: parsed.except(*query_params), model: Knockapi::Tenant, options: ) end |