examples/HTTP/API/Core/Example/Slack.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 2 / 4 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 71.7% 33 / 46 CC 7 SCAR 13.0
CC
7
Cov
79%
messages_pager
5.5
new
3.3
BEGIN
1.0
CRAP 3.7
« blib/lib/HTTP/API/Core/Form.pm ↑ Summary examples/HTTP/API/Core/Example/TransportAdapters.pm »
1 package HTTP::API::Core::Example::Slack;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use parent 'HTTP::API::Core';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶sub new {
Subroutine new: called CC=3 SCAR=12.0
Pod documented
8 1 my ($class, %args) = @_;
9 1 my $token = delete $args{token};
10 1 ▶ die "token is required\n" if !defined($token) || $token eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $token or $token eq "" 0 1 1
Condition33%1/3
not defined $token or $token eq ""
l!l&&r!l&&!r
001
MC/DC0%0/2
not defined $token or $token eq ""
not defined $token $token eq ""
Truth table33%1/3
not(A) or B
A= not defined $tokenB= $token eq ""
ABresult
1X1
011
000
11  
12 1 return $class->SUPER::new(
13 base_url => 'https://slack.com/api',
14 headers => { Authorization => "Bearer $token" },
15 %args,
16 );
17 }
18  
19 1 ▶sub messages_pager {
Subroutine messages_pager: called CC=5 SCAR=17.0
Pod undocumented
20 1 my ($self, %args) = @_;
21 1 my $channel = delete $args{channel};
22 1 ▶ die "channel is required\n" if !defined($channel) || $channel eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $channel or $channel eq "" 0 1 1
Condition33%1/3
not defined $channel or $channel eq ""
l!l&&r!l&&!r
001
MC/DC0%0/2
not defined $channel or $channel eq ""
not defined $channel $channel eq ""
Truth table33%1/3
not(A) or B
A= not defined $channelB= $channel eq ""
ABresult
1X1
011
000
23 1 ▶ my $limit = delete($args{limit}) || 15;
Condition50%1/2
delete $args{'limit'} || 15
l!l
10
MC/DC0%0/1
delete $args{'limit'} || 15
delete $args{'limit'}
Truth table50%1/2
A
A= delete $args{'limit'}
Aresult
11
00
24 1 my $oldest = delete $args{oldest};
25 1 my $latest = delete $args{latest};
26 1 die "unknown messages option: $_\n" for sort keys %args;
27  
28 1 return $self->paginate(
29 '/conversations.history',
30 mode => 'cursor',
31 items => 'messages',
32 next => 'response_metadata.next_cursor',
33 cursor_param => 'cursor',
34 query => {
35 channel => $channel,
36 limit => $limit,
37 oldest => $oldest,
38 latest => $latest,
39 },
40 );
41 }
42  
43 1 1;
« blib/lib/HTTP/API/Core/Form.pm ↑ Summary examples/HTTP/API/Core/Example/TransportAdapters.pm »