Class: Smplkit::Audit::ResourceTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/audit/resource_types.rb

Overview

client.audit.resource_types.list — distinct resource_type slugs seen for the account.

Backed by a maintain-by-write side table (ADR-047 §2.5), so the response time is independent of how many years of events the account has accumulated. Sorted alphabetically; cursor pagination via page_after.

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ ResourceTypes

Returns a new instance of ResourceTypes.



13
14
15
# File 'lib/smplkit/audit/resource_types.rb', line 13

def initialize(api)
  @api = api
end

Instance Method Details

#list(page_size: nil, page_after: nil) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/smplkit/audit/resource_types.rb', line 17

def list(page_size: nil, page_after: nil)
  opts = {}
  opts[:page_size] = page_size if page_size
  opts[:page_after] = page_after if page_after

  resp = Smplkit::Audit.call_api { @api.list_resource_types(opts) }
  rows = (resp.data || []).map { |r| ResourceType.from_resource(r) }
  ResourceTypeListPage.new(rows, Smplkit::Audit.next_cursor(resp.links&._next))
end