Class: Trycourier::Resources::Users::Tenants
- Inherits:
-
Object
- Object
- Trycourier::Resources::Users::Tenants
- Defined in:
- lib/trycourier/resources/users/tenants.rb
Instance Method Summary collapse
-
#add_multiple(user_id, tenants: , request_options: {}) ⇒ nil
This endpoint is used to add a user to multiple tenants in one call.
-
#add_single(tenant_id, user_id: , profile: nil, request_options: {}) ⇒ nil
This endpoint is used to add a single tenant.
-
#initialize(client:) ⇒ Tenants
constructor
private
A new instance of Tenants.
-
#list(user_id, cursor: nil, limit: nil, request_options: {}) ⇒ Trycourier::Models::Users::TenantListResponse
Some parameter documentations has been truncated, see Models::Users::TenantListParams for more details.
-
#remove_all(user_id, request_options: {}) ⇒ nil
Removes a user from any tenants they may have been associated with.
-
#remove_single(tenant_id, user_id: , request_options: {}) ⇒ nil
Removes a user from the supplied tenant.
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.
145 146 147 |
# File 'lib/trycourier/resources/users/tenants.rb', line 145 def initialize(client:) @client = client end |
Instance Method Details
#add_multiple(user_id, tenants: , request_options: {}) ⇒ nil
This endpoint is used to add a user to multiple tenants in one call. A custom profile can also be supplied for each tenant. This profile will be merged with the user’s main profile when sending to the user with that tenant.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/trycourier/resources/users/tenants.rb', line 51 def add_multiple(user_id, params) parsed, = Trycourier::Users::TenantAddMultipleParams.dump_request(params) @client.request( method: :put, path: ["users/%1$s/tenants", user_id], body: parsed, model: NilClass, options: ) end |
#add_single(tenant_id, user_id: , profile: nil, request_options: {}) ⇒ nil
This endpoint is used to add a single tenant.
A custom profile can also be supplied with the tenant. This profile will be merged with the user’s main profile when sending to the user with that tenant.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/trycourier/resources/users/tenants.rb', line 80 def add_single(tenant_id, params) parsed, = Trycourier::Users::TenantAddSingleParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["users/%1$s/tenants/%2$s", user_id, tenant_id], body: parsed, model: NilClass, options: ) end |
#list(user_id, cursor: nil, limit: nil, request_options: {}) ⇒ Trycourier::Models::Users::TenantListResponse
Some parameter documentations has been truncated, see Models::Users::TenantListParams for more details.
Returns a paginated list of user tenant associations.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trycourier/resources/users/tenants.rb', line 25 def list(user_id, params = {}) parsed, = Trycourier::Users::TenantListParams.dump_request(params) @client.request( method: :get, path: ["users/%1$s/tenants", user_id], query: parsed, model: Trycourier::Models::Users::TenantListResponse, options: ) end |
#remove_all(user_id, request_options: {}) ⇒ nil
Removes a user from any tenants they may have been associated with.
106 107 108 109 110 111 112 113 |
# File 'lib/trycourier/resources/users/tenants.rb', line 106 def remove_all(user_id, params = {}) @client.request( method: :delete, path: ["users/%1$s/tenants", user_id], model: NilClass, options: params[:request_options] ) end |
#remove_single(tenant_id, user_id: , request_options: {}) ⇒ nil
Removes a user from the supplied tenant.
128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/trycourier/resources/users/tenants.rb', line 128 def remove_single(tenant_id, params) parsed, = Trycourier::Users::TenantRemoveSingleParams.dump_request(params) user_id = parsed.delete(:user_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["users/%1$s/tenants/%2$s", user_id, tenant_id], model: NilClass, options: ) end |