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