line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebAPI::DBIC::Resource::HAL::Role::Item; |
2
|
|
|
|
|
|
|
$WebAPI::DBIC::Resource::HAL::Role::Item::VERSION = '0.004001'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
34062152
|
use Moo::Role; |
|
2
|
|
|
|
|
41962
|
|
|
2
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
requires '_build_content_types_provided'; |
8
|
|
|
|
|
|
|
requires 'render_item_as_hal_hash'; |
9
|
|
|
|
|
|
|
requires 'encode_json'; |
10
|
|
|
|
|
|
|
requires 'item'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around '_build_content_types_provided' => sub { |
14
|
|
|
|
|
|
|
my $orig = shift; |
15
|
|
|
|
|
|
|
my $self = shift; |
16
|
|
|
|
|
|
|
my $types = $self->$orig(); |
17
|
|
|
|
|
|
|
unshift @$types, { 'application/hal+json' => 'to_json_as_hal' }; |
18
|
|
|
|
|
|
|
return $types; |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
0
|
|
sub to_json_as_hal { return $_[0]->encode_json($_[0]->render_item_as_hal_hash($_[0]->item)) } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding UTF-8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
WebAPI::DBIC::Resource::HAL::Role::Item |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
version 0.004001 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Provides methods to support the C<application/hal+json> media type |
42
|
|
|
|
|
|
|
for GET and HEAD requests for requests representing individual resources, |
43
|
|
|
|
|
|
|
e.g. a single row of a database table. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
WebAPI::DBIC::Resource::HAL::Role::Item - methods related to handling HAL requests for item resources |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 AUTHOR |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Tim Bunce <Tim.Bunce@pobox.com> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Tim Bunce. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
58
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |