package JSONAPI::Document;
$JSONAPI::Document::VERSION = '2.4';
# ABSTRACT: Turn DBIx results into JSON API documents.
use Moo;
use Carp ();
use JSONAPI::Document::Builder;
use JSONAPI::Document::Bu
tions->{includes}) {
@relationships = @{ $options->{includes} };
}
my $builder = JSONAPI::Document::Builder::Compound->new(
api_url => $self->api_url,
fields
_related') {
$includes = [$row->result_source->relationships()];
}
my $builder = JSONAPI::Document::Builder->new(
api_url => $self->api_url,
fields
kage JSONAPI::Document::Builder::Role::Attributes;
$JSONAPI::Document::Builder::Role::Attributes::VERSION = '2.4';
=head1 NAME
JSONAPI::Document::Builder::Role::Attributes - Utility role for JSON API
row) = @_;
$row //= $self->row;
my $sparse_fieldset = $self->fields;
if ($row->DOES('JSONAPI::Document::Role::Attributes')) {
my $columns = $row->attributes($sparse_fieldset);
package JSONAPI::Document::Builder::Compound;
$JSONAPI::Document::Builder::Compound::VERSION = '2.4';
=head1 NAME
JSONAPI::Document::Builder::Compound - Compound Resource Document builder
=head1 VER
ent with all of its relationships and attributes.
=cut
use Moo;
extends 'JSONAPI::Document::Builder';
use Carp ();
use JSONAPI::Document::Builder::Relationships;
=head2 relationships
ArrayRef of
elf, $primary_row, $relationship, $fields, $options) = @_;
$options //= {};
my $builder = JSONAPI::Document::Builder::Relationships->new({
api_url => $self->api_url,
f