Class: Knockapi::Resources::Tenants
- Inherits:
-
Object
- Object
- Knockapi::Resources::Tenants
- Defined in:
- lib/knockapi/resources/tenants.rb,
lib/knockapi/resources/tenants/bulk.rb
Defined Under Namespace
Classes: Bulk
Instance Attribute Summary collapse
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.
126 127 128 129 |
# File 'lib/knockapi/resources/tenants.rb', line 126 def initialize(client:) @client = client @bulk = Knockapi::Resources::Tenants::Bulk.new(client: client) end |
Instance Attribute Details
#bulk ⇒ Knockapi::Resources::Tenants::Bulk (readonly)
7 8 9 |
# File 'lib/knockapi/resources/tenants.rb', line 7 def bulk @bulk end |
Instance Method Details
#delete(id, request_options: {}) ⇒ nil
Delete a tenant and all associated data. This operation cannot be undone.
51 52 53 54 55 56 57 58 |
# File 'lib/knockapi/resources/tenants.rb', line 51 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.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/knockapi/resources/tenants.rb', line 76 def get(id, params = {}) parsed, = Knockapi::TenantGetParams.dump_request(params) @client.request( method: :get, path: ["v1/tenants/%1$s", id], query: parsed, 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.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/knockapi/resources/tenants.rb', line 28 def list(params = {}) parsed, = Knockapi::TenantListParams.dump_request(params) @client.request( method: :get, path: "v1/tenants", query: parsed, 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.
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/knockapi/resources/tenants.rb', line 110 def set(id, params = {}) parsed, = Knockapi::TenantSetParams.dump_request(params) query_params = [:resolve_full_preference_settings] @client.request( method: :put, path: ["v1/tenants/%1$s", id], query: parsed.slice(*query_params), body: parsed.except(*query_params), model: Knockapi::Tenant, options: ) end |