Class: Smplkit::Audit::ResourceType

Inherits:
Struct
  • Object
show all
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

Class Method Summary collapse

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



113
114
115
# File 'lib/smplkit/audit/models.rb', line 113

def created_at
  @created_at
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



113
114
115
# File 'lib/smplkit/audit/models.rb', line 113

def id
  @id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



113
114
115
# File 'lib/smplkit/audit/models.rb', line 113

def resource_type
  @resource_type
end

Class Method Details

.from_resource(resource) ⇒ Object



114
115
116
117
118
119
120
121
# File 'lib/smplkit/audit/models.rb', line 114

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