File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Reaction.pm
Criterion Covered Total %
statement 9 13 69.2
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod n/a
total 12 20 60.0


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

3: # ABSTRACT: A reaction item. 4:
5: use Moo;
6: use Types::Standard qw(InstanceOf Maybe Str);
7:
8: use WebService::Mattermost::Helper::Alias 'view';
9:
10: extends 'WebService::Mattermost::V4::API::Object';
11: with qw(
12: WebService::Mattermost::V4::API::Object::Role::BelongingToPost
13: WebService::Mattermost::V4::API::Object::Role::BelongingToUser
14: WebService::Mattermost::V4::API::Object::Role::CreatedAt
15: );
16:
17: ################################################################################
18:
19: has emoji_name => (is => 'ro', isa => Maybe[Str], lazy => 1, builder => 1);
20: has emoji => (is => 'ro', isa => Maybe[InstanceOf[view 'Emoji']], lazy => 1, builder => 1);
21:
22: ################################################################################
23:
24: sub _build_emoji_name { shift->raw_data->{emoji_name} }
25:
26: sub _build_emoji {
27: my $self = shift;
28:
29: return unless $self->emoji_name;
30: return $self->api->emoji->get_by_name($self->emoji_name)->item;
31: }
32:
33: ################################################################################
34:
35: 1;
36:
37: __END__
38:
39: =pod
40:
41: =encoding UTF-8
42:
43: =head1 NAME
44:
45: WebService::Mattermost::V4::API::Object::Reaction - A reaction item.
46:
47: =head1 VERSION
48:
49: version 0.28
50:
51: =head1 DESCRIPTION
52:
53: Details a Mattermost reaction object.
54:
55: =head2 ATTRIBUTES
56:
57: =over 4
58:
59: =item C<emoji_name>
60:
61: The name of the emoji attached to the post.
62:
63: =item C<emoji>
64:
65: Related L<WebService::Mattermost::V4::API::Object::Emoji> object.
66:
67: =back
68:
69: =head1 SEE ALSO
70:
71: =over 4
72:
73: =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToPost>
74:
75: =item L<WebService::Mattermost::V4::API::Object::Role::BelongingToUser>
76:
77: =item L<WebService::Mattermost::V4::API::Object::Role::CreatedAt>
78:
79: =back
80:
81: =head1 AUTHOR
82:
83: Mike Jones <mike@netsplit.org.uk>
84:
85: =head1 COPYRIGHT AND LICENSE
86:
87: This software is Copyright (c) 2020 by Mike Jones.
88:
89: This is free software, licensed under:
90:
91: The MIT (X11) License
92:
93: =cut
94: