line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
876
|
use utf8; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
4
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package JSON::API::v1::MetaObject; |
4
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
5
|
1
|
|
|
1
|
|
467
|
use Moose; |
|
1
|
|
|
|
|
454640
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
8015
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: A JSON API Meta object according to jsonapi v1 specification |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has members => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => 'HashRef', |
13
|
|
|
|
|
|
|
traits => ['Hash'], |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
default => sub { {} }, |
16
|
|
|
|
|
|
|
handles => { |
17
|
|
|
|
|
|
|
has_member => 'exists', |
18
|
|
|
|
|
|
|
get_member => 'get', |
19
|
|
|
|
|
|
|
set_member => 'set', |
20
|
|
|
|
|
|
|
add_member => 'set', |
21
|
|
|
|
|
|
|
clear_member => 'delete', |
22
|
|
|
|
|
|
|
get_member_names => 'keys', |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub TO_JSON { |
27
|
2
|
|
|
2
|
0
|
6
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
4
|
my %rv; |
30
|
2
|
|
|
|
|
77
|
foreach ($self->get_member_names) { |
31
|
0
|
|
|
|
|
0
|
$rv{$_} = $self->get_member($_); |
32
|
|
|
|
|
|
|
} |
33
|
2
|
|
|
|
|
47
|
return \%rv; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
with qw( |
37
|
|
|
|
|
|
|
JSON::API::v1::Roles::TO_JSON |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
JSON::API::v1::MetaObject - A JSON API Meta object according to jsonapi v1 specification |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 0.002 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 DESCRIPTION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This module attempts to make a Moose object behave like a JSON API object as |
62
|
|
|
|
|
|
|
defined by L<jsonapi.org>. This object adheres to the v1 specification |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Wesley Schwengle. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This is free software, licensed under: |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The (three-clause) BSD License |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |