JSONAPI::Document::Role::Attributes - Consumable role to build resource attributes


version 2.4


This role allows you to customize the fetching of a rows attributes.

Simply add this to the row object and implement the attributes method and it'll be called instead of JSONAPI::Document doing the building of attributes.

The method is passed a single argument, an ArrayRef of requested fields, which should be honoured in the returned HashRef.

attributes(ArrayRef $fields?) : HashRef

Returns a hashref of columns/attributes for the consuming classes row.