File Coverage

blib/lib/WebService/Slack/WebApi/Base.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 32 35 91.4


line stmt bran cond sub pod time code
1             package WebService::Slack::WebApi::Base;
2 4     4   2199 use strict;
  4         8  
  4         216  
3 4     4   23 use warnings;
  4         8  
  4         221  
4 4     4   21 use utf8;
  4         8  
  4         23  
5              
6 4     4   2445 use Data::Validator;
  4         141868  
  4         262  
7             use Class::Accessor::Lite (
8 4         56 new => 1,
9             rw => [qw/ client /],
10 4     4   59 );
  4         8  
11              
12             sub base_name {
13 112     112 0 256 my $self = shift;
14 112         609 my @components = split /::/, ref $self;
15 112         774 return lc $components[-1];
16             }
17              
18             sub request {
19 114     114 0 466 my ($self, $path, $args) = @_;
20 114         459 my $request_path = sprintf '/%s.%s', $self->base_name, $path;
21 114         627 return $self->client->request($request_path, $args);
22             }
23              
24             sub request_json {
25 2     2 0 8 my ($self, $path, $args) = @_;
26 2         8 my $request_path = sprintf '/%s.%s', $self->base_name, $path;
27 2         12 return $self->client->request_json($request_path, $args);
28             }
29              
30             1;
31