File Coverage

blib/lib/Consul/ACL.pm
Criterion Covered Total %
statement 15 18 83.3
branch 0 8 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 20 34 58.8


line stmt bran cond sub pod time code
1             package Consul::ACL;
2             $Consul::ACL::VERSION = '0.026';
3 9     9   52 use namespace::autoclean;
  9         17  
  9         55  
4              
5 9     9   600 use Moo;
  9         14  
  9         38  
6 9     9   2485 use Types::Standard qw(Str);
  9         16  
  9         52  
7 9     9   3835 use Carp qw(croak);
  9         16  
  9         354  
8 9     9   45 use JSON::MaybeXS;
  9         33  
  9         1837  
9              
10             has name => ( is => 'ro', isa => Str );
11             has id => ( is => 'ro', isa => Str );
12             has type => ( is => 'ro', isa => Str );
13             has rules => ( is => 'ro', isa => Str );
14              
15 0     0 0   sub to_json { shift->_json }
16             has _json => ( is => 'lazy', isa => Str );
17             sub _build__json {
18 0     0     my ($self) = @_;
19 0 0         encode_json({
    0          
    0          
    0          
20             defined $self->name ? ( Name => $self->name ) : (),
21             defined $self->id ? ( ID => $self->id ) : (),
22             defined $self->type ? ( Type => $self->type ) : (),
23             defined $self->rules ? ( Rules => $self->rules ) : (),
24             });
25             }
26              
27             1;