Class: Smplkit::Audit::Categories
- Inherits:
-
Object
- Object
- Smplkit::Audit::Categories
- Defined in:
- lib/smplkit/audit/categories.rb
Overview
client.audit.categories.list — distinct category values seen for the account.
Response time is independent of how many years of events the account has accumulated. Sorted alphabetically; offset paginated.
Instance Method Summary collapse
-
#initialize(api, environment: nil) ⇒ Categories
constructor
A new instance of Categories.
-
#list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) ⇒ Smplkit::Audit::CategoryListPage
List the distinct
categoryvalues seen in the account.
Constructor Details
#initialize(api, environment: nil) ⇒ Categories
Returns a new instance of Categories.
11 12 13 14 |
# File 'lib/smplkit/audit/categories.rb', line 11 def initialize(api, environment: nil) @api = api @environment = environment end |
Instance Method Details
#list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) ⇒ Smplkit::Audit::CategoryListPage
List the distinct category values seen in the account.
environments scopes the listing to a set of environments: pass an array of environment keys and/or the reserved “smplkit” control-plane bucket; the values are comma-joined into filter[environment]. Omit it (the default) to scope the listing to the client’s configured environment; with no configured environment the filter is left off entirely.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/smplkit/audit/categories.rb', line 38 def list(page_number: nil, page_size: nil, meta_total: nil, environments: nil) opts = {} opts[:page_number] = page_number if page_number opts[:page_size] = page_size if page_size opts[:meta_total] = unless .nil? resolved_environment = Smplkit::Audit.resolve_environment_filter(environments, @environment) opts[:filter_environment] = resolved_environment if resolved_environment resp = Smplkit::Audit.call_api { @api.list_categories(opts) } rows = (resp.data || []).map { |r| Category.from_resource(r) } CategoryListPage.new(rows, Smplkit::Audit.extract_pagination(resp.)) end |