Class: Courier::Resources::Tenants
- Inherits:
-
Object
- Object
- Courier::Resources::Tenants
- Defined in:
- lib/courier/resources/tenants.rb,
lib/courier/resources/tenants/templates.rb,
lib/courier/resources/tenants/preferences.rb,
lib/courier/resources/tenants/preferences/items.rb,
lib/courier/resources/tenants/templates/versions.rb,
sig/courier/resources/tenants.rbs,
sig/courier/resources/tenants/templates.rbs,
sig/courier/resources/tenants/preferences.rbs,
sig/courier/resources/tenants/preferences/items.rbs,
sig/courier/resources/tenants/templates/versions.rbs
Overview
Manage tenants — the organizations, teams, or accounts your users belong to — along with their users and default preferences.
Defined Under Namespace
Classes: Preferences, Templates
Instance Attribute Summary collapse
- #preferences ⇒ Courier::Resources::Tenants::Preferences readonly
-
#templates ⇒ Courier::Resources::Tenants::Templates
readonly
Manage the templates and template versions scoped to a single tenant, including the ones authored in the embedded designer.
Instance Method Summary collapse
-
#delete(tenant_id, request_options: {}) ⇒ nil
Deletes a tenant.
-
#initialize(client:) ⇒ Tenants
constructor
private
A new instance of Tenants.
-
#list(cursor: nil, limit: nil, parent_tenant_id: nil, request_options: {}) ⇒ Courier::Models::TenantListResponse
Some parameter documentations has been truncated, see Models::TenantListParams for more details.
-
#list_users(tenant_id, cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::TenantListUsersResponse
Some parameter documentations has been truncated, see Models::TenantListUsersParams for more details.
-
#retrieve(tenant_id, request_options: {}) ⇒ Courier::Models::Tenant
Returns one tenant with its name, parent tenant id, default preferences, properties, and the user profile applied to its members.
-
#update(tenant_id, name:, brand_id: nil, default_preferences: nil, parent_tenant_id: nil, properties: nil, user_profile: nil, request_options: {}) ⇒ Courier::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantUpdateParams 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.
161 162 163 164 165 |
# File 'lib/courier/resources/tenants.rb', line 161 def initialize(client:) @client = client @preferences = Courier::Resources::Tenants::Preferences.new(client: client) @templates = Courier::Resources::Tenants::Templates.new(client: client) end |
Instance Attribute Details
#preferences ⇒ Courier::Resources::Tenants::Preferences (readonly)
9 10 11 |
# File 'lib/courier/resources/tenants.rb', line 9 def preferences @preferences end |
#templates ⇒ Courier::Resources::Tenants::Templates (readonly)
Manage the templates and template versions scoped to a single tenant, including the ones authored in the embedded designer.
14 15 16 |
# File 'lib/courier/resources/tenants.rb', line 14 def templates @templates end |
Instance Method Details
#delete(tenant_id, request_options: {}) ⇒ nil
Deletes a tenant. Its members' workspace-level profiles and preferences live outside the tenant and are managed separately.
118 119 120 121 122 123 124 125 |
# File 'lib/courier/resources/tenants.rb', line 118 def delete(tenant_id, params = {}) @client.request( method: :delete, path: ["tenants/%1$s", tenant_id], model: NilClass, options: params[:request_options] ) end |
#list(cursor: nil, limit: nil, parent_tenant_id: nil, request_options: {}) ⇒ Courier::Models::TenantListResponse
Some parameter documentations has been truncated, see Models::TenantListParams for more details.
Lists the workspace's tenants, each carrying a name, parent tenant, properties, and default preferences. Paged.
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/courier/resources/tenants.rb', line 94 def list(params = {}) parsed, = Courier::TenantListParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "tenants", query: query, model: Courier::Models::TenantListResponse, options: ) end |
#list_users(tenant_id, cursor: nil, limit: nil, request_options: {}) ⇒ Courier::Models::TenantListUsersResponse
Some parameter documentations has been truncated, see Models::TenantListUsersParams for more details.
Returns the users belonging to a tenant with cursor paging. Use it to see who a tenant-scoped send will reach.
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/courier/resources/tenants.rb', line 146 def list_users(tenant_id, params = {}) parsed, = Courier::TenantListUsersParams.dump_request(params) query = Courier::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["tenants/%1$s/users", tenant_id], query: query, model: Courier::Models::TenantListUsersResponse, options: ) end |
#retrieve(tenant_id, request_options: {}) ⇒ Courier::Models::Tenant
Returns one tenant with its name, parent tenant id, default preferences, properties, and the user profile applied to its members.
28 29 30 31 32 33 34 35 |
# File 'lib/courier/resources/tenants.rb', line 28 def retrieve(tenant_id, params = {}) @client.request( method: :get, path: ["tenants/%1$s", tenant_id], model: Courier::Tenant, options: params[:request_options] ) end |
#update(tenant_id, name:, brand_id: nil, default_preferences: nil, parent_tenant_id: nil, properties: nil, user_profile: nil, request_options: {}) ⇒ Courier::Models::Tenant
Some parameter documentations has been truncated, see Models::TenantUpdateParams for more details.
Creates or replaces a tenant from a name, parent, brand, properties, and default preferences supplied in the request body.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/courier/resources/tenants.rb', line 64 def update(tenant_id, params) parsed, = Courier::TenantUpdateParams.dump_request(params) @client.request( method: :put, path: ["tenants/%1$s", tenant_id], body: parsed, model: Courier::Tenant, options: ) end |