File Coverage

blib/lib/Slack/BlockKit/Block/RichText/UserGroup.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Slack::BlockKit::Block::RichText::UserGroup 0.005;
2             # ABSTRACT: a Block Kit rich text element that mentions a @usergroup
3              
4 4     4   29 use Moose;
  4         9  
  4         41  
5 4     4   23488 use MooseX::StrictConstructor;
  4         8  
  4         43  
6              
7             with 'Slack::BlockKit::Role::HasMentionStyle';
8              
9             #pod =head1 OVERVIEW
10             #pod
11             #pod This represents the mention of a specific Slack user group in a hunk of rich
12             #pod text. The group name will be styled and linked-to. So, to send something
13             #pod like:
14             #pod
15             #pod I will ask @team-tam.
16             #pod
17             #pod You would use the L<sugar|Slack::BlockKit::Sugar> like so:
18             #pod
19             #pod blocks(richtext(section(
20             #pod "I will ask ", usergroup($usergroup_id), "."
21             #pod )));
22             #pod
23             #pod =cut
24              
25 4     4   16051 use v5.36.0;
  4         18  
26              
27             #pod =attr usergroup_id
28             #pod
29             #pod This must be the Slack usergroup id for the group being mentioned. This is
30             #pod generally a bunch of alphanumeric characters beginning with C<S>.
31             #pod
32             #pod =cut
33              
34             has usergroup_id => (
35             is => 'ro',
36             isa => 'Str',
37             required => 1,
38             );
39              
40             sub as_struct ($self) {
41             return {
42             type => 'usergroup',
43             usergroup_id => $self->usergroup_id,
44             };
45             }
46              
47 4     4   37 no Moose;
  4         8  
  4         30  
48             __PACKAGE__->meta->make_immutable;
49              
50             __END__
51              
52             =pod
53              
54             =encoding UTF-8
55              
56             =head1 NAME
57              
58             Slack::BlockKit::Block::RichText::UserGroup - a Block Kit rich text element that mentions a @usergroup
59              
60             =head1 VERSION
61              
62             version 0.005
63              
64             =head1 OVERVIEW
65              
66             This represents the mention of a specific Slack user group in a hunk of rich
67             text. The group name will be styled and linked-to. So, to send something
68             like:
69              
70             I will ask @team-tam.
71              
72             You would use the L<sugar|Slack::BlockKit::Sugar> like so:
73              
74             blocks(richtext(section(
75             "I will ask ", usergroup($usergroup_id), "."
76             )));
77              
78             =head1 PERL VERSION
79              
80             This module should work on any version of perl still receiving updates from
81             the Perl 5 Porters. This means it should work on any version of perl
82             released in the last two to three years. (That is, if the most recently
83             released version is v5.40, then this module should work on both v5.40 and
84             v5.38.)
85              
86             Although it may work on older versions of perl, no guarantee is made that the
87             minimum required version will not be increased. The version may be increased
88             for any reason, and there is no promise that patches will be accepted to
89             lower the minimum required perl.
90              
91             =head1 ATTRIBUTES
92              
93             =head2 usergroup_id
94              
95             This must be the Slack usergroup id for the group being mentioned. This is
96             generally a bunch of alphanumeric characters beginning with C<S>.
97              
98             =head1 AUTHOR
99              
100             Ricardo SIGNES <cpan@semiotic.systems>
101              
102             =head1 COPYRIGHT AND LICENSE
103              
104             This software is copyright (c) 2024 by Ricardo SIGNES.
105              
106             This is free software; you can redistribute it and/or modify it under
107             the same terms as the Perl 5 programming language system itself.
108              
109             =cut