Net-PMP

 view release on metacpan or  search on metacpan

lib/Net/PMP/CollectionDoc.pm  view on Meta::CPAN

package Net::PMP::CollectionDoc;
use Moose;
use Carp;
use Data::Dump qw( dump );
use Net::PMP::TypeConstraints;
use Net::PMP::CollectionDoc::Links;
use Net::PMP::CollectionDoc::Items;
use UUID::Tiny ':std';
use JSON;
use Try::Tiny;

our $VERSION = '0.006';

# the 'required' flag on these attributes should match
# the core CollectionDoc schema:
# https://api.pmp.io/schemas/core

has 'href' => (
    is       => 'rw',
    isa      => 'Net::PMP::Type::Href',
    required => 0,
    coerce   => 1,
);
has 'links'      => ( is => 'ro', isa => 'HashRef', required => 0, );
has 'attributes' => ( is => 'ro', isa => 'HashRef', required => 0, );
has 'version' =>
    ( is => 'ro', isa => 'Str', required => 1, default => sub {'1.0'}, );
has 'items' => ( is => 'ro', isa => 'ArrayRef', required => 0, );

=head1 NAME

Net::PMP::CollectionDoc - Collection.doc+JSON object for Net::PMP::Client

=head1 SYNOPSIS

 my $doc = $pmp_client->get_doc();
 printf("API version: %s\n", $doc->version);
 my $query_links = $doc->get_links('query');

=head1 DESCRIPTION

Net::PMP::CollectionDoc represents the PMP API media type L<https://github.com/publicmediaplatform/pmpdocs/wiki/Collection.doc-JSON-Media-Type>.

=head1 METHODS

=head2 href

The unique identifier. See L<http://cdoc.io/spec.html#guid-vs-href>.

=head2 items

Returns arrayref of child items. These are returned as a convenience from the server
and are not a native part of the CollectionDoc.

=head2 get_links( I<type> )

Returns Net::PMP::CollectionDoc::Links object for I<type>, which may be one of (for example):

=over

=item creator

=item edit

=item navigation

=item query

=item permission

=back

=head2 links

Returns hashref of link data.

=head2 attributes

Returns hashref of attribute data.

=head2 version

Returns API version string.

=cut

sub get_links {
    my $self  = shift;



( run in 0.695 second using v1.01-cache-2.11-cpan-39bf76dae61 )