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