Class: Smplkit::Audit::Category
- Inherits:
-
Struct
- Object
- Struct
- Smplkit::Audit::Category
- Defined in:
- lib/smplkit/audit/models.rb
Overview
A distinct category value seen for the account.
Same shape as ResourceType/EventType — id and category are the same value (JSON:API surfaces the customer-facing key as the resource id, ADR-014). created_at is the earliest sighting of this category for the account.
Instance Attribute Summary collapse
-
#category ⇒ String
The distinct category value.
-
#created_at ⇒ String
ISO-8601 timestamp of the earliest sighting for this value.
-
#id ⇒ String
JSON:API resource id (same as
category).
Class Method Summary collapse
Instance Attribute Details
#category ⇒ String
Returns The distinct category value.
284 285 286 287 288 289 290 291 292 293 |
# File 'lib/smplkit/audit/models.rb', line 284 Category = Struct.new(:id, :category, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, category: attrs.category || resource.id, created_at: attrs.created_at ) end end |
#created_at ⇒ String
Returns ISO-8601 timestamp of the earliest sighting for this value.
284 285 286 287 288 289 290 291 292 293 |
# File 'lib/smplkit/audit/models.rb', line 284 Category = Struct.new(:id, :category, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, category: attrs.category || resource.id, created_at: attrs.created_at ) end end |
#id ⇒ String
Returns JSON:API resource id (same as category).
284 285 286 287 288 289 290 291 292 293 |
# File 'lib/smplkit/audit/models.rb', line 284 Category = Struct.new(:id, :category, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, category: attrs.category || resource.id, created_at: attrs.created_at ) end end |
Class Method Details
.from_resource(resource) ⇒ Object
285 286 287 288 289 290 291 292 |
# File 'lib/smplkit/audit/models.rb', line 285 def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, category: attrs.category || resource.id, created_at: attrs.created_at ) end |