File Coverage

blib/lib/WebService/MinFraud/Types.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 0 3 0.0
total 30 33 90.9


line stmt bran cond sub pod time code
1             ## no critic (Subroutines::ProhibitExportingUndeclaredSubs)
2             package WebService::MinFraud::Types;
3              
4 12     12   88 use strict;
  12         41  
  12         351  
5 12     12   76 use warnings;
  12         23  
  12         483  
6              
7             our $VERSION = '1.009001';
8              
9 12     12   5232 use Sub::Quote qw( quote_sub );
  12         51386  
  12         718  
10              
11 12     12   102 use namespace::clean;
  12         30  
  12         104  
12              
13 12         1823 use GeoIP2::Types 2.006001 qw(
14             ArrayRef
15             Bool
16             BoolCoercion
17             HTTPStatus
18             HashRef
19             IPAddress
20             JSONObject
21             LocalesArrayRef
22             MaxMindID
23             MaxMindLicenseKey
24             NonNegativeInt
25             Num
26             Str
27             URIObject
28             UserAgentObject
29             object_isa_type
30 12     12   7853 );
  12         986168  
31              
32 12     12   116 use Exporter qw( import );
  12         39  
  12         1912  
33              
34             our @EXPORT_OK = qw(
35             ArrayRef
36             Bool
37             BoolCoercion
38             HTTPStatus
39             HashRef
40             IPAddress
41             IssuerObject
42             IssuerObjectCoercion
43             JSONObject
44             LocalesArrayRef
45             MaxMindID
46             MaxMindLicenseKey
47             NonNegativeInt
48             NonNegativeNum
49             Num
50             Str
51             URIObject
52             UserAgentObject
53             object_isa_type
54             );
55              
56             our %EXPORT_TAGS = ( all => \@EXPORT_OK );
57              
58             ## no critic (NamingConventions::Capitalization, ValuesAndExpressions::ProhibitImplicitNewlines)
59             sub IssuerObject () {
60 4     4 0 19 return quote_sub(
61             q{ WebService::MinFraud::Types::object_isa_type( $_[0], 'WebService::MinFraud::Record::Issuer' ) }
62             );
63             }
64              
65             sub IssuerObjectCoercion () {
66 4     4 0 285 return quote_sub(
67             q{
68             defined $_[0]
69             && Scalar::Util::blessed($_[0])
70             && $_[0]->isa('WebService::MinFraud::Record::Issuer')
71             ? $_[0]
72             : WebService::MinFraud::Record::Issuer->new($_[0]);
73             }
74             );
75             }
76              
77             sub NonNegativeNum () {
78 4     4 0 20 return quote_sub(
79             q{ GeoIP2::Types::_tc_fail( $_[0], 'NonNegativeNum' )
80             unless defined $_[0]
81             && ! ref $_[0]
82             && $_[0] =~ /^-?\d+(\.\d+)?$/
83             && $_[0] >= 0; }
84             );
85             }
86              
87             1;
88              
89             # ABSTRACT: Custom types for the MaxMind minFraud service
90              
91             __END__
92              
93             =pod
94              
95             =encoding UTF-8
96              
97             =head1 NAME
98              
99             WebService::MinFraud::Types - Custom types for the MaxMind minFraud service
100              
101             =head1 VERSION
102              
103             version 1.009001
104              
105             =head1 SUPPORT
106              
107             Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>.
108              
109             =head1 AUTHOR
110              
111             Mateu Hunter <mhunter@maxmind.com>
112              
113             =head1 COPYRIGHT AND LICENSE
114              
115             This software is copyright (c) 2015 - 2019 by MaxMind, Inc.
116              
117             This is free software; you can redistribute it and/or modify it under
118             the same terms as the Perl 5 programming language system itself.
119              
120             =cut