File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Role/BelongingToTeam.pm
Criterion Covered Total %
statement 9 14 64.2
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod n/a
total 12 21 57.1


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Object::Role::BelongingToTeam;
2:

3: # ABSTRACT: Mark an object as belonging to a team. 4:
5: use Moo::Role;
6: use Types::Standard qw(InstanceOf Maybe Str);
7:
8: use WebService::Mattermost::Helper::Alias 'view';
9:
10: ################################################################################
11:
12: has team_id => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1);
13: has team => (is => 'ro', isa => Maybe[InstanceOf[view 'Team']], lazy => 1, builder => 1);
14:
15: ################################################################################
16:
17: sub _build_team_id {
18: my $self = shift;
19:
20: return $self->raw_data->{team_id};
21: }
22:
23: sub _build_team {
24: my $self = shift;
25:
26: return unless $self->team_id;
27: return $self->api->teams->get_by_id($self->team_id)->item;
28: }
29:
30: ################################################################################
31:
32: 1;
33:
34: __END__
35:
36: =pod
37:
38: =encoding UTF-8
39:
40: =head1 NAME
41:
42: WebService::Mattermost::V4::API::Object::Role::BelongingToTeam - Mark an object as belonging to a team.
43:
44: =head1 VERSION
45:
46: version 0.30
47:
48: =head1 DESCRIPTION
49:
50: Link a view object to its creator.
51:
52: =head2 ATTRIBUTES
53:
54: =over 4
55:
56: =item C<team_id>
57:
58: The creator's string ID.
59:
60: =item C<team>
61:
62: Linked L<WebService::Mattermost::V4::API::Object::Team> object.
63:
64: =back
65:
66: =head1 AUTHOR
67:
68: Mike Jones <mike@netsplit.org.uk>
69:
70: =head1 COPYRIGHT AND LICENSE
71:
72: This software is Copyright (c) 2023 by Mike Jones.
73:
74: This is free software, licensed under:
75:
76: The MIT (X11) License
77:
78: =cut
79: