NAME
JSONAPI::Document::Builder::Relationships - Related Resource Document builder
VERSION
version 2.4
DESCRIPTION
Builds the related resource document for a given row.
row
The DBIx::Class::Row
for relationship
.
Note this is not the relationship row, rather it is its parent.
relationship
String name of the relationship.
with_attributes
Boolean; Default: false
If specified, will build the relationship with attributes instead of links.
Default behaviour is to build with links.
build : HashRef
Main caller method; Builds the related resource document.
build_links_document(DBIx::Class::Row $row, Str $relationship) : HashRef
Builds a HashRef containing strings that represent URLs for fetching the given relationship, as well as the relationship ID(s).
For referential purposes, self and related mean the following:
- self
-
A link pointing to the relationship itself regardless of whether it is a one-to-one or has-many type of relationship. It contains the word "relationship" in the URL.
The specification defines this link as the link to the relationship itself in the context of the primary resource. This means that the resource(s) returned from this URL should be directly related to the primary resource, i.e.
$dbic_row->$relationship
. -
Behaves the same as "self" except that its URL structure is different. I fail to see the difference.
build_document(DBIx::Class::Row $row, Str $relationship) : HashRef
Builds a HashRef of the relationship(s) with attributes.
build_single_document(DBIx::Class::Row $related_row, Str $relationship) : HashRef
Builds a HashRef representing a single relationship row.