Class: Smplkit::Audit::Action
- Inherits:
-
Struct
- Object
- Struct
- Smplkit::Audit::Action
- Defined in:
- lib/smplkit/audit/models.rb
Overview
A distinct action slug seen for the account.
Same shape as ResourceType — id and action are the same value. created_at is the earliest sighting; when the parent list call filtered by resource_type, this is the first sighting of that specific (action, resource_type) triple, not the action overall.
Instance Attribute Summary collapse
-
#action ⇒ String
The distinct action slug.
-
#created_at ⇒ String
ISO-8601 timestamp of the earliest sighting for this slug.
-
#id ⇒ String
JSON:API resource id (same as
action).
Class Method Summary collapse
Instance Attribute Details
#action ⇒ String
Returns The distinct action slug.
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/smplkit/audit/models.rb', line 206 Action = Struct.new(:id, :action, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, action: attrs.action || resource.id, created_at: attrs.created_at ) end end |
#created_at ⇒ String
Returns ISO-8601 timestamp of the earliest sighting for this slug.
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/smplkit/audit/models.rb', line 206 Action = Struct.new(:id, :action, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, action: attrs.action || resource.id, created_at: attrs.created_at ) end end |
#id ⇒ String
Returns JSON:API resource id (same as action).
206 207 208 209 210 211 212 213 214 215 |
# File 'lib/smplkit/audit/models.rb', line 206 Action = Struct.new(:id, :action, :created_at, keyword_init: true) do def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, action: attrs.action || resource.id, created_at: attrs.created_at ) end end |
Class Method Details
.from_resource(resource) ⇒ Object
207 208 209 210 211 212 213 214 |
# File 'lib/smplkit/audit/models.rb', line 207 def self.from_resource(resource) attrs = resource.attributes new( id: resource.id, action: attrs.action || resource.id, created_at: attrs.created_at ) end |