line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebAPI::DBIC::Resource::Role::Set; |
2
|
|
|
|
|
|
|
$WebAPI::DBIC::Resource::Role::Set::VERSION = '0.004001'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
30325571
|
use Moo::Role; |
|
2
|
|
|
|
|
45100
|
|
|
2
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
requires 'encode_json'; |
8
|
|
|
|
|
|
|
requires 'render_item_as_plain_hash'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has content_types_provided => ( |
12
|
|
|
|
|
|
|
is => 'lazy', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _build_content_types_provided { |
16
|
0
|
|
|
0
|
|
|
return [ { 'application/vnd.wapid+json' => 'to_plain_json'} ] |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
0
|
|
sub to_plain_json { return $_[0]->encode_json($_[0]->render_set_as_plain($_[0]->set)) } |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
|
sub allowed_methods { return [ qw(GET HEAD) ] } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Avoid complaints about $set: |
24
|
|
|
|
|
|
|
## no critic (NamingConventions::ProhibitAmbiguousNames) |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub render_set_as_plain { |
27
|
0
|
|
|
0
|
0
|
|
my ($self, $set) = @_; |
28
|
0
|
|
|
|
|
|
my $set_data = [ map { $self->render_item_as_plain_hash($_) } $set->all ]; |
|
0
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $set_data; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=pod |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding UTF-8 |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
WebAPI::DBIC::Resource::Role::Set |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 VERSION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
version 0.004001 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Handles GET and HEAD requests for requests representing set resources, e.g. |
51
|
|
|
|
|
|
|
the rows of a database table. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Supports the C<application/json> content type. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
WebAPI::DBIC::Resource::Role::Set - methods related to handling requests for set resources |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 AUTHOR |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Tim Bunce <Tim.Bunce@pobox.com> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Tim Bunce. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
68
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |