Class: Knockapi::Resources::Tenants::Bulk

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/tenants/bulk.rb,
sig/knockapi/resources/tenants/bulk.rbs

Overview

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

Constructor Details

#initialize(client:) ⇒ Bulk

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 Bulk.

Parameters:



58
59
60
# File 'lib/knockapi/resources/tenants/bulk.rb', line 58

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(tenant_ids:, request_options: {}) ⇒ Knockapi::Models::BulkOperation

Delete up to 1,000 tenants at a time in a single operation. This operation cannot be undone.

Parameters:

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/knockapi/resources/tenants/bulk.rb', line 21

def delete(params)
  parsed, options = Knockapi::Tenants::BulkDeleteParams.dump_request(params)
  query = Knockapi::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :post,
    path: "v1/tenants/bulk/delete",
    query: query,
    model: Knockapi::BulkOperation,
    options: options
  )
end

#set(tenants:, request_options: {}) ⇒ Knockapi::Models::BulkOperation

Set or update up to 1,000 tenants in a single operation.

Parameters:

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
# File 'lib/knockapi/resources/tenants/bulk.rb', line 44

def set(params)
  parsed, options = Knockapi::Tenants::BulkSetParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/tenants/bulk/set",
    body: parsed,
    model: Knockapi::BulkOperation,
    options: options
  )
end