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   2168 use Moo::Role;
  4         13  
  4         26  
4 4     4   1284 use namespace::autoclean;
  4         16  
  4         34  
5              
6             our $VERSION = '1.009001';
7              
8 4     4   351 use Types::Standard qw( ArrayRef InstanceOf Num Str );
  4         10  
  4         39  
9 4     4   3375 use Types::UUID;
  4         9  
  4         28  
10 4     4   1832 use WebService::MinFraud::Record::Warning;
  4         16  
  4         114  
11 4     4   27 use WebService::MinFraud::Types qw( NonNegativeInt NonNegativeNum );
  4         65  
  4         1412  
12              
13             requires 'raw';
14              
15             has funds_remaining => (
16             is => 'lazy',
17             isa => NonNegativeNum,
18             init_arg => undef,
19 3     3   64900 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 6     6   2924 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   1988 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   3218 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         7903 [ map { WebService::MinFraud::Record::Warning->new($_) }
53 5     5   30434 @{ $_[0]->raw->{warnings} } ];
  5         33  
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.009001
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 - 2019 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