WebApi/Chat.pm

filter: Statementstmt 100% 42 / 42 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 5 totaltotal 85.5% 59 / 69 CC 6 SCAR 5.5
CC
6
Cov
90%
schedule_message
3.1
post_ephemeral
2.0
post_message
2.0
CRAP 1.7
« WebApi/Client.pm ↑ Summary WebApi.pm »
1 package WebService::Slack::WebApi::Chat;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use feature qw/state/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use parent 'WebService::Slack::WebApi::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use WebService::Slack::WebApi::Generator (
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 delete => {
12 channel => 'Str',
13 ts => 'Str',
14 as_user => { isa => 'Bool', optional => 1 },
15 },
16 me_message => {
17 channel => 'Str',
18 text => 'Str',
19 },
20 unfurl => {
21 channel => 'Str',
22 ts => 'Str',
23 unfurls => 'Str',
24 user_auth_message => { isa => 'Str', optional => 1 },
25 user_auth_required => { isa => 'Bool', optional => 1 },
26 user_auth_url => { isa => 'Str', optional => 1 },
27 },
28 3 );
29  
30 3 ▶sub post_ephemeral {
Subroutine post_ephemeral: called CC=2 SCAR=7.0
Pod undocumented
31 3 state $rule = Data::Validator->new(
32 channel => 'Str',
33 text => { isa => 'Str', optional => 1 },
34 user => 'Str',
35 as_user => { isa => 'Bool', optional => 1 },
36 attachments => { isa => 'ArrayRef', optional => 1 },
37 link_names => { isa => 'Bool', optional => 1 },
38 parse => { isa => 'Str', optional => 1 },
39 )->with('Method', 'AllowExtra');
40 3 my ($self, $args, %extra) = $rule->validate(@_);
41  
42 3 ▶ $args->{attachments} = encode_json $args->{attachments} if exists $args->{attachments};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"attachments"} 3 0 3
43 3 return $self->request('postEphemeral', {%$args, %extra});
44 }
45  
46 3 ▶sub post_message {
Subroutine post_message: called CC=2 SCAR=7.0
Pod undocumented
47 3 state $rule = Data::Validator->new(
48 channel => 'Str',
49 text => { isa => 'Str', optional => 1 },
50 as_user => { isa => 'Bool', optional => 1 },
51 attachments => { isa => 'ArrayRef', optional => 1 },
52 icon_emoji => { isa => 'Str', optional => 1 },
53 icon_url => { isa => 'Str', optional => 1 },
54 link_names => { isa => 'Bool', optional => 1 },
55 parse => { isa => 'Str', optional => 1 },
56 reply_broadcast => { isa => 'Bool', optional => 1 },
57 thread_ts => { isa => 'Str', optional => 1 },
58 unfurl_links => { isa => 'Bool', optional => 1 },
59 unfurl_media => { isa => 'Bool', optional => 1 },
60 username => { isa => 'Str', optional => 1 },
61 )->with('Method', 'AllowExtra');
62 3 my ($self, $args, %extra) = $rule->validate(@_);
63  
64 3 ▶ $args->{attachments} = encode_json $args->{attachments} if exists $args->{attachments};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"attachments"} 3 0 3
65 3 return $self->request('postMessage', {%$args, %extra});
66 }
67  
68 3 ▶sub update {
Subroutine update: called CC=2 SCAR=7.0
Pod undocumented
69 3 state $rule = Data::Validator->new(
70 channel => 'Str',
71 text => { isa => 'Str', optional => 1 },
72 ts => 'Str',
73 as_user => { isa => 'Bool', optional => 1 },
74 attachments => { isa => 'ArrayRef', optional => 1 },
75 link_names => { isa => 'Bool', optional => 1 },
76 parse => { isa => 'Str', optional => 1 },
77 )->with('Method', 'AllowExtra');
78 3 my ($self, $args, %extra) = $rule->validate(@_);
79  
80 3 ▶ $args->{attachments} = encode_json $args->{attachments} if exists $args->{attachments};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"attachments"} 3 0 3
81 3 return $self->request('update', {%$args, %extra});
82 }
83  
84 3 ▶sub schedule_message {
Subroutine schedule_message: called CC=3 SCAR=11.3
Pod undocumented
85 3 state $rule = Data::Validator->new(
86 channel => 'Str',
87 post_at => 'Int',
88 text => { isa => 'Str', optional => 1 },
89 as_user => { isa => 'Bool', optional => 1 },
90 attachments => { isa => 'ArrayRef', optional => 1 },
91 blocks => { isa => 'ArrayRef', optional => 1 },
92 icon_emoji => { isa => 'Str', optional => 1 },
93 icon_url => { isa => 'Str', optional => 1 },
94 link_names => { isa => 'Bool', optional => 1 },
95 markdown_text => { isa => 'Str', optional => 1 },
96 metadata => { isa => 'Str', optional => 1 },
97 parse => { isa => 'Str', optional => 1 },
98 reply_broadcast => { isa => 'Bool', optional => 1 },
99 thread_ts => { isa => 'Str', optional => 1 },
100 unfurl_links => { isa => 'Bool', optional => 1 },
101 unfurl_media => { isa => 'Bool', optional => 1 },
102 )->with('Method', 'AllowExtra');
103 3 my ($self, $args, %extra) = $rule->validate(@_);
104  
105 3 ▶ $args->{attachments} = encode_json $args->{attachments} if exists $args->{attachments};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"attachments"} 0 3 3
106 3 ▶ $args->{blocks} = encode_json $args->{blocks} if exists $args->{blocks};
Branch: 1 branch
BranchTrueFalseTotal
if exists $args->{"blocks"} 0 3 3
107 3 return $self->request('scheduleMessage', {%$args, %extra});
108 }
109  
110 3 ▶sub delete_scheduled_message {
Subroutine delete_scheduled_message: called CC=1 SCAR=0.0
Pod undocumented
111 3 state $rule = Data::Validator->new(
112 channel => 'Str',
113 scheduled_message_id => 'Str',
114 as_user => { isa => 'Bool', optional => 1 },
115 )->with('Method', 'AllowExtra');
116 3 my ($self, $args, %extra) = $rule->validate(@_);
117  
118 3 return $self->request('deleteScheduledMessage', {%$args, %extra});
119 }
120  
121 3 1;
122  
« WebApi/Client.pm ↑ Summary WebApi.pm »