| 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
Condition33%1/3
not defined $token or $token eq ""
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 ""
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
not defined $channel or $channel eq ""
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 ""
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | my $limit = delete($args{limit}) || 15; | ||||||||||||||||||||||||||
|
Condition50%1/2
delete $args{'limit'} || 15
MC/DC0%0/1
delete $args{'limit'} || 15
delete $args{'limit'}
Truth table50%1/2
A
A= delete $args{'limit'}
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||