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.027';
3 9     9   53 use namespace::autoclean;
  9         16  
  9         47  
4              
5 9     9   629 use Moo;
  9         16  
  9         41  
6 9     9   2627 use Types::Standard qw(Str);
  9         16  
  9         48  
7 9     9   3852 use Carp qw(croak);
  9         16  
  9         342  
8 9     9   78 use JSON::MaybeXS;
  9         24  
  9         1974  
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;