File Coverage

blib/lib/WWW/NOS/Open/Broadcast.pm
Criterion Covered Total %
statement 29 29 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 39 39 100.0


line stmt bran cond sub pod time code
1             # -*- cperl; cperl-indent-level: 4 -*-
2             # Copyright (C) 2011-2021, Roland van Ipenburg
3             package WWW::NOS::Open::Broadcast v1.0.4;
4 4     4   42 use strict;
  4         15  
  4         164  
5 4     4   32 use warnings;
  4         8  
  4         143  
6              
7 4     4   23 use utf8;
  4         11  
  4         32  
8 4     4   163 use 5.014000;
  4         15  
9              
10 4     4   27 use Moose qw/around has with/;
  4         14  
  4         30  
11 4     4   23413 use Moose::Util::TypeConstraints qw/enum/;
  4         11  
  4         45  
12 4     4   1901 use namespace::autoclean '-also' => qr/^__/sxm;
  4         9  
  4         52  
13              
14 4     4   430 use WWW::NOS::Open::TypeDef qw(NOSDateTime NOSURI);
  4         11  
  4         47  
15              
16 4     4   6526 use Readonly;
  4         11  
  4         1276  
17             Readonly::Scalar my $UNDER => q{_};
18             Readonly::Scalar my $GETTER => q{get};
19             Readonly::Array my @TV_CHANNEL_CODES => qw(NL1 NL2 NL3);
20             Readonly::Array my @RADIO_CHANNEL_CODES => qw(RA1 RA2 RA3 RA4 RA5 RA6);
21              
22             has '_id' => (
23             'is' => 'ro',
24             'isa' => 'Int',
25             'reader' => 'get_id',
26             'init_arg' => 'id',
27             );
28              
29             has '_channel_icon' => (
30             'is' => 'ro',
31             'isa' => NOSURI,
32             'coerce' => 1,
33             'reader' => 'get_channel_icon',
34             'init_arg' => 'channel_icon',
35             );
36              
37             my @dates = qw(starttime endtime);
38             while ( my $date = shift @dates ) {
39             has $UNDER
40             . $date => (
41             'is' => 'ro',
42             'isa' => NOSDateTime,
43             'coerce' => 1,
44             'reader' => $GETTER . $UNDER . $date,
45             'init_arg' => $date,
46             );
47             }
48              
49             has '_channel_code' => (
50             'is' => 'ro',
51             'isa' => enum( [ @TV_CHANNEL_CODES, @RADIO_CHANNEL_CODES ] ),
52             'reader' => 'get_channel_code',
53             'init_arg' => 'channel_code',
54             );
55              
56             my @strings = qw(type channel_name genre title description);
57             while ( my $string = shift @strings ) {
58             has $UNDER
59             . $string => (
60             'is' => 'ro',
61             'isa' => 'Str',
62             'reader' => $GETTER . $UNDER . $string,
63             'init_arg' => $string,
64             );
65             }
66              
67 4     4   37 no Moose;
  4         8  
  4         27  
68              
69             __PACKAGE__->meta->make_immutable;
70              
71             1;
72              
73             __END__
74              
75             =encoding utf8
76              
77             =for stopwords Bitbucket DateTime URI Ipenburg MERCHANTABILITY
78              
79             =head1 NAME
80              
81             WWW::NOS::Open::Broadcast - client side broadcasts in the Open NOS REST API.
82              
83             =head1 VERSION
84              
85             This document describes WWW::NOS::Open::Broadcast version C<v1.0.4>.
86              
87             =head1 SYNOPSIS
88              
89             use WWW::NOS::Open::Broadcast;
90              
91             =head1 DESCRIPTION
92              
93             =head1 SUBROUTINES/METHODS
94              
95             =head2 C<new>
96              
97             Create a new WWW::NOS::Open::Broadcast object.
98              
99             =over
100              
101             =item 1. A hash containing the properties and their values.
102              
103             =back
104              
105             =head2 C<get_id>
106              
107             Returns the id of the article as integer.
108              
109             =head2 C<get_title>
110              
111             Returns the title of the article as string.
112              
113             =head2 C<get_description>
114              
115             Returns the description of the article as string.
116              
117             =head2 C<get_published>
118              
119             Returns the publishing date of the article as a L<DateTime|DateTime> object.
120              
121             =head2 C<get_last_update>
122              
123             Returns the date of the last update for the article as a L<DateTime|DateTime>
124             object.
125              
126             =head2 C<get_thumbnail_xs>
127              
128             Returns the URL of the extra small thumbnail for the article as an L<URI|URI>
129             object.
130              
131             =head2 C<get_thumbnail_s>
132              
133             Returns the URL of the small thumbnail for the article as an L<URI|URI> object.
134              
135             =head2 C<get_thumbnail_m>
136              
137             Returns the URL of the medium sized thumbnail for the article as an L<URI|URI>
138             object.
139              
140             =head2 C<get_link>
141              
142             Returns the URL of the main article as an L<URI|URI> object.
143              
144             =head2 C<get_keywords>
145              
146             Returns the list of keywords for the article as a reference to an array of
147             strings.
148              
149             =head1 CONFIGURATION AND ENVIRONMENT
150              
151             =head1 DEPENDENCIES
152              
153             =over 4
154              
155             =item * L<DateTime|DateTime>
156              
157             =item * L<Date::Parse|Date::Parse>
158              
159             =item * L<URI|URI>
160              
161             =item * L<Moose|Moose>
162              
163             =item * L<Moose::Util::TypeConstraints|Moose::Util::TypeConstraints>
164              
165             =item * L<namespace::autoclean|namespace::autoclean>
166              
167             =back
168              
169             =head1 INCOMPATIBILITIES
170              
171             =head1 DIAGNOSTICS
172              
173             =head1 BUGS AND LIMITATIONS
174              
175             Please report any bugs or feature requests at
176             L<Bitbucket|https://bitbucket.org/rolandvanipenburg/www-nos-open/issues>.
177              
178             =head1 AUTHOR
179              
180             Roland van Ipenburg, E<lt>roland@rolandvanipenburg.comE<gt>
181              
182             =head1 LICENSE AND COPYRIGHT
183              
184             Copyright 2011-2021 by Roland van Ipenburg
185              
186             This library is free software; you can redistribute it and/or modify
187             it under the same terms as Perl itself, either Perl version 5.14.0 or,
188             at your option, any later version of Perl 5 you may have available.
189              
190             =head1 DISCLAIMER OF WARRANTY
191              
192             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
193             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
194             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
195             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
196             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
197             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
198             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
199             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
200             NECESSARY SERVICING, REPAIR, OR CORRECTION.
201              
202             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
203             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
204             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
205             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
206             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
207             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
208             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
209             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
210             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
211             SUCH DAMAGES.
212              
213             =cut