NAME

WWW::NOS::Open - Perl framework for the Open NOS REST API

VERSION

This document describes WWW::NOS::Open version v1.0.5.

SYNOPSIS

use WWW::NOS::Open;
my $nos = WWW::NOS::Open->new($API_KEY);
@latest_articles = $nos->get_latest_articles('nieuws');

DESCRIPTION

The Dutch public broadcasting foundation NOS provides a REST API to their content. This module provides a wrapper around that API to use data from the Open NOS platform with Perl.

SUBROUTINES/METHODS

new

Create a new WWW::NOS::Open object.

get_version

Gets the version of the REST API as a WWW::NOS::Open::Version object.

get_latest_articles

Returns the ten most recent articles as an array of WWW::NOS::Open::Article objects.

1. The optional category of the requested articles, nieuws or sport. Defaults to the category nieuws.

get_latest_videos

Returns the ten most recent videos as an array of WWW::NOS::Open::Video objects.

1. The optional category of the requested videos, nieuws or sport. Defaults to the category nieuws.

get_latest_audio_fragments

Returns the ten most recent audio fragments as an array of WWW::NOS::Open::AudioFragment objects.

1. The optional category of the requested audio fragments, nieuws or sport. Defaults to the category nieuws.

Search the search engine from NOS for keywords. Returns a WWW::NOS::Open::Results object with a maximum of 25 items.

1. The keyword or a combination of keywords, for example cricket, cricket AND engeland, cricket OR curling.

get_tv_broadcasts

Gets a collection of television broadcasts between two optional dates. Returns an array of WWW::NOS::Open::DayGuide objects. The period defaults to starting yesterday and ending tomorrow. The period has an upper limit of 14 days. An NOSOpenExceededRangeException is thrown when this limit is exceeded.

1. Start date in the format YYYY-MM-DD or as DateTime object.
2. End date in the format YYYY-MM-DD or as DateTime object.

get_radio_broadcasts

Gets a collection of radio broadcasts between two optional dates. Returns an array of WWW::NOS::Open::DayGuide objects. The period defaults to starting yesterday and ending tomorrow. The period has an upper limit of 14 days. An NOSOpenExceededRangeException is thrown when this limit is exceeded.

1. Start date in the format YYYY-MM-DD or as DateTime object.
2. End date in the format YYYY-MM-DD or as DateTime object.

CONFIGURATION AND ENVIRONMENT

To use this module with the live content of Open NOS you need an API key which can be obtained by registering at Open NOS and then configure your account there with the IP range you'll be accessing the service from.

This module can use the optional environment variable NOSOPEN_SERVER to specify a server URL that is not the default Open NOS live service at http://open.nos.nl.

The user agent identifier used in the request to the REST API is WWW::NOS::Open/v1.0.5.

DEPENDENCIES

INCOMPATIBILITIES

None.

DIAGNOSTICS

Exceptions in the form of an Exception::Class are thrown when the Open NOS service reports an exception:

NOSOpenUnauthorizedException

When a request was made without a valid API key, or from an IP address not configured to be valid for that API key.

NOSOpenExceededRangeException

When the time period for a guide request exceeds the supported range of 14 days.

NOSOpenInternalServerErrorException

When an internal server error has occurred in the Open NOS service.

NOSOpenBadRequestException

When the Open NOS service reports the request had bad syntax.

BUGS AND LIMITATIONS

Currently this module only uses the XML output of the Open NOS service and has no option to use the JSON or serialized PHP formats. When the API matures the other output options might be added and the content of the raw responses exposed for further processing in an appropriate environment.

Please report any bugs or feature requests at Bitbucket.

AUTHOR

Roland van Ipenburg, <roland@rolandvanipenburg.com>

LICENSE AND COPYRIGHT

Copyright 2011-2021 by Roland van Ipenburg

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.0 or, at your option, any later version of Perl 5 you may have available.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.