NAME
WWW::NOS::Open - Perl framework for the Open NOS REST API.
VERSION
This document describes WWW::NOS::Open version 0.02.
SYNOPSIS
use WWW::NOS::Open;
my $nos = WWW::NOS::Open->new($API_KEY);
@latest_articles = $nos->get_latest_articles('nieuws');
DESCRIPTION
Wrapper around the REST API to get data from Open NOS into Perl.
SUBROUTINES/METHODS
new
Create a new WWW::NOS::Open object.
- 1. The API key to use in the connection to the Open NOS service. You need to register at Open NOS to get an API key.
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
orsport
. Defaults to the categorynieuws
.
get_latest_videos
Returns the ten most recent videos as an array of WWW::NOS::Open::Video objects.
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
orsport
. Defaults to the categorynieuws
.
search
Search the searchengine 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
This module uses the environment variable NOSOPEN_SERVER
to specify a server that is not the default Open NOS live server at http://open.nos.nl.
The useragent identifier used in the request to the REST API is WWW::NOS::Open/0.01
.
DEPENDENCIES
Date::Calc Date::Format HTTP::Headers HTTP::Request HTTP::Status JSON LWP::UserAgent Log::Log4perl Moose Moose::Util::TypeConstraints Readonly URI URI::Escape WWW::NOS::Open::Article WWW::NOS::Open::AudioFragment WWW::NOS::Open::Broadcast WWW::NOS::Open::DayGuide WWW::NOS::Open::Document WWW::NOS::Open::Exceptions WWW::NOS::Open::Result WWW::NOS::Open::TypeDef WWW::NOS::Open::Version WWW::NOS::Open::Video XML::Simple namespace::autoclean
INCOMPATIBILITIES
DIAGNOSTICS
This module uses Log::Log4perl.
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 RT for rt.cpan.org.
AUTHOR
Roland van Ipenburg <ipenburg@xs4all.nl>
LICENSE AND COPYRIGHT
Copyright 2011 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.12.2 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.