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



99
100
101
# File 'lib/smplkit/audit/models.rb', line 99

def created_at
  @created_at
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



99
100
101
# File 'lib/smplkit/audit/models.rb', line 99

def id
  @id
end

#resource_typeObject

Returns the value of attribute resource_type

Returns:

  • (Object)

    the current value of resource_type



99
100
101
# File 'lib/smplkit/audit/models.rb', line 99

def resource_type
  @resource_type
end

Class Method Details

.from_resource(resource) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/smplkit/audit/models.rb', line 100

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