Class: Smplkit::Audit::ResourceType
- Inherits:
-
Struct
- Object
- Struct
- Smplkit::Audit::ResourceType
- Defined in:
- lib/smplkit/audit/models.rb
Overview
A distinct resource_type slug seen for the account.
The id and resource_type are the same value — JSON:API surfaces the customer-facing key as the resource id (ADR-014). The duplication keeps SDK consumers from having to dig into the id field when filtering UI controls; pick whichever name reads better in context.
Instance Attribute Summary collapse
-
#created_at ⇒ String
ISO-8601 timestamp of the earliest sighting for this slug.
-
#id ⇒ String
JSON:API resource id (same as
resource_type). -
#resource_type ⇒ String
The distinct resource_type slug.
Class Method Summary collapse
Instance Attribute Details
#created_at ⇒ String
Returns ISO-8601 timestamp of the earliest sighting for this slug.
207 208 209 210 211 212 213 214 215 216 |
# File 'lib/smplkit/audit/models.rb', line 207 ResourceType = Struct.new(:id, :resource_type, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, resource_type: attrs.resource_type || resource.id, created_at: attrs.created_at ) end end |
#id ⇒ String
Returns JSON:API resource id (same as resource_type).
207 208 209 210 211 212 213 214 215 216 |
# File 'lib/smplkit/audit/models.rb', line 207 ResourceType = Struct.new(:id, :resource_type, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, resource_type: attrs.resource_type || resource.id, created_at: attrs.created_at ) end end |
#resource_type ⇒ String
Returns The distinct resource_type slug.
207 208 209 210 211 212 213 214 215 216 |
# File 'lib/smplkit/audit/models.rb', line 207 ResourceType = Struct.new(:id, :resource_type, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, resource_type: attrs.resource_type || resource.id, created_at: attrs.created_at ) end end |
Class Method Details
.from_resource(resource) ⇒ Object
208 209 210 211 212 213 214 215 |
# File 'lib/smplkit/audit/models.rb', line 208 def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, resource_type: attrs.resource_type || resource.id, created_at: attrs.created_at ) end |