Class: Cadenya::Resources::Tenants::Subjects

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

Overview

Read and erase tenants and the subjects under them. Tenants and subjects are created by assertion — on objective creation or widget session mint — never directly, so this service has no create or update: it exists to enumerate what assertions have produced, and to destroy it on request.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Subjects

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

Parameters:



60
61
62
# File 'lib/cadenya/resources/tenants/subjects.rb', line 60

def initialize(client:)
  @client = client
end

Instance Method Details

#list(tenant_id, workspace_id: nil, cursor: nil, include_info: nil, limit: nil, query: nil, sort_order: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Subject>

Some parameter documentations has been truncated, see Models::Tenants::SubjectListParams for more details.

Lists the subjects asserted under a tenant. Subjects are only listable through their tenant: a subject's external_id is unique within its tenant, not across the workspace, so the same key can name different people under different tenants.

Parameters:

  • tenant_id (String)

    Path param: Tenant whose subjects to list. Accepts the canonical tenant_… form

  • workspace_id (String)

    Path param: Workspace ID.

  • cursor (String)

    Query param: Pagination cursor from previous response.

  • include_info (Boolean)

    Query param: When true, the info field on each returned subject is populated.

  • limit (Integer)

    Query param: Maximum number of results to return.

  • query (String)

    Query param: Substring match against the subject's name and external_id.

  • sort_order (String)

    Query param: Sort order for results (asc or desc by creation time).

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cadenya/resources/tenants/subjects.rb', line 40

def list(tenant_id, params = {})
  parsed, options = Cadenya::Tenants::SubjectListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  workspace_id =
    parsed.delete(:workspace_id) do
      @client.workspace_id
    end
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/tenants/%2$s/subjects", workspace_id, tenant_id],
    query: query.transform_keys(include_info: "includeInfo", sort_order: "sortOrder"),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::Subject,
    options: options
  )
end