NAME
Net::PMP::Profile - Base Content Profile for PMP CollectionDoc
SYNOPSIS
use Net::PMP;
use Net::PMP::Profile;
# instantiate a client
my $client = Net::PMP->client(
host => $host,
id => $client_id,
secret => $client_secret,
);
# get explicit guid. otherwise one will be created for you on save.
my $guid = Net::PMP::CollectionDoc->create_guid();
my $profile_doc = Net::PMP::Profile->new(
href => $client->uri_for_doc($guid),
guid => $guid,
title => 'I am A Title',
published => '2013-12-03T12:34:56.789Z',
valid => {
from => "2013-04-11T13:21:31.598Z",
to => "3013-04-11T13:21:31.598Z",
},
byline => 'By: John Writer and Nancy Author',
description => 'This is a summary of the document.',
tags => [qw( foo bar baz )],
itags => [qw( abc123 )],
hreflang => 'en', # ISO639-1 code
author => [qw( http://api.pmp.io/user/some-guid )],
copyright => [qw( http://americanpublicmedia.org/ )],
distributor => [qw( http://api.pmp.io/organization/different-guid )],
);
# save doc
$client->save($profile_doc);
DESCRIPTION
Net::PMP::Profile implements the CollectionDoc fields for the PMP Base Content Profile https://github.com/publicmediaplatform/pmpdocs/wiki/Base-Content-Profile.
This class does not inherit from Net::PMP::CollectionDoc. Net::PMP::Profile-based classes are intended to ease data synchronization between PMP and other systems, by providing client-based attribute validation and syntactic sugar. A CollectionDoc-based object has no inherent validation for its attributes; it simply reflects what is on the PMP server. A Profile-based object can be used to validate attribute values before they are sent to the PMP server. The as_doc method converts the Profile-based object to a CollectionDoc-based object.
METHODS
title
hreflang
valid
published
Optional ISO 8601 datetime string. You may pass in a DateTime object and as_doc() will render it correctly.
byline
Optional attribution string.
description
Optional summary string.
tags
Optional keyword array of strings.
itags
Optional array of strings for "internal" tags.
add_tag( tagname )
Push tagname onto the array.
add_itag( tagname )
Push tagname onto the array.
as_doc
Returns a Net::PMP::CollectionDoc object suitable for Net::PMP::Client interaction.
get_profile_url
Returns a string for the PMP profile's URL.
get_profile_title
Returns a string for the PMP profile's title. Default is the class name.
AUTHOR
Peter Karman, <karman at cpan.org>
BUGS
Please report any bugs or feature requests to bug-net-pmp at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-PMP-Profile. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::PMP
You can also look for information at:
- IRC
-
Join #pmp on http://freenode.net.
- RT: CPAN's request tracker (report bugs here)
- AnnoCPAN: Annotated CPAN documentation
- CPAN Ratings
- Search CPAN
ACKNOWLEDGEMENTS
American Public Media and the Public Media Platform sponsored the development of this module.
LICENSE AND COPYRIGHT
Copyright 2013 American Public Media Group
See the LICENSE file that accompanies this module.