File Coverage

blib/lib/WebService/MinFraud/Role/HasCommonAttributes.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 11 11 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1             package WebService::MinFraud::Role::HasCommonAttributes;
2              
3 4     4   1886 use Moo::Role;
  4         8  
  4         21  
4 4     4   1106 use namespace::autoclean;
  4         9  
  4         27  
5              
6             our $VERSION = '1.010000';
7              
8 4     4   307 use Types::Standard qw( ArrayRef InstanceOf Num Str );
  4         10  
  4         22  
9 4     4   3029 use Types::UUID;
  4         9  
  4         21  
10 4     4   1664 use WebService::MinFraud::Record::Warning;
  4         10  
  4         153  
11 4     4   19 use WebService::MinFraud::Types qw( NonNegativeInt NonNegativeNum );
  4         7  
  4         1096  
12              
13             requires 'raw';
14              
15             has funds_remaining => (
16             is => 'lazy',
17             isa => NonNegativeNum,
18             init_arg => undef,
19 3     3   52856 builder => sub { $_[0]->raw->{funds_remaining} },
20             predicate => 1,
21             );
22              
23             has id => (
24             is => 'lazy',
25             isa => Uuid,
26             init_arg => undef,
27 8     8   2877 builder => sub { $_[0]->raw->{id} },
28             predicate => 1,
29             );
30              
31             has queries_remaining => (
32             is => 'lazy',
33             isa => NonNegativeInt,
34             init_arg => undef,
35 3     3   1750 builder => sub { $_[0]->raw->{queries_remaining} },
36             predicate => 1,
37             );
38              
39             has risk_score => (
40             is => 'lazy',
41             isa => Num,
42             init_arg => undef,
43 6     6   2555 builder => sub { $_[0]->raw->{risk_score} },
44             predicate => 1,
45             );
46              
47             has warnings => (
48             is => 'lazy',
49             isa => ArrayRef [ InstanceOf ['WebService::MinFraud::Record::Warning'] ],
50             init_arg => undef,
51             builder => sub {
52 10         6699 [ map { WebService::MinFraud::Record::Warning->new($_) }
53 5     5   25689 @{ $_[0]->raw->{warnings} } ];
  5         28  
54             },
55             predicate => 1,
56             );
57              
58             1;
59              
60             # ABSTRACT: A role for attributes common to both the Insights and Score models
61              
62             __END__
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             WebService::MinFraud::Role::HasCommonAttributes - A role for attributes common to both the Insights and Score models
71              
72             =head1 VERSION
73              
74             version 1.010000
75              
76             =head1 SUPPORT
77              
78             Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>.
79              
80             =head1 AUTHOR
81              
82             Mateu Hunter <mhunter@maxmind.com>
83              
84             =head1 COPYRIGHT AND LICENSE
85              
86             This software is copyright (c) 2015 - 2020 by MaxMind, Inc.
87              
88             This is free software; you can redistribute it and/or modify it under
89             the same terms as the Perl 5 programming language system itself.
90              
91             =cut