line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::MinFraud::Record::IPAddress; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
19
|
use Moo; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
14
|
|
4
|
3
|
|
|
3
|
|
757
|
use namespace::autoclean; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.010000'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
245
|
use B; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
163
|
|
9
|
3
|
|
|
3
|
|
1199
|
use GeoIP2::Role::Model::Location 2.004000; |
|
3
|
|
|
|
|
96378
|
|
|
3
|
|
|
|
|
98
|
|
10
|
3
|
|
|
3
|
|
1183
|
use GeoIP2::Role::Model::HasSubdivisions; |
|
3
|
|
|
|
|
26487
|
|
|
3
|
|
|
|
|
90
|
|
11
|
3
|
|
|
3
|
|
22
|
use Types::Standard qw( ArrayRef InstanceOf ); |
|
3
|
|
|
|
|
34
|
|
|
3
|
|
|
|
|
61
|
|
12
|
3
|
|
|
3
|
|
2518
|
use Sub::Quote qw( quote_sub ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
106
|
|
13
|
3
|
|
|
3
|
|
1181
|
use WebService::MinFraud::Record::Location; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
84
|
|
14
|
3
|
|
|
3
|
|
18
|
use WebService::MinFraud::Record::Country; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
573
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'GeoIP2::Role::Model::Location', 'GeoIP2::Role::Model::HasSubdivisions', |
17
|
|
|
|
|
|
|
'WebService::MinFraud::Role::Record::HasRisk'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
## no critic (ProhibitUnusedPrivateSubroutines) |
20
|
54
|
|
|
54
|
|
38380
|
sub _has { has(@_) } |
21
|
|
|
|
|
|
|
## use critic |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__PACKAGE__->_define_attributes_for_keys( __PACKAGE__->_all_record_names() ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
for my $name ( 'Country', 'Location' ) { |
26
|
|
|
|
|
|
|
my $attr = lc $name; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $raw_attr = '_raw_' . $attr; |
29
|
|
|
|
|
|
|
my $class = "WebService::MinFraud::Record::$name"; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has "+$attr" => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
isa => InstanceOf [$class], |
34
|
|
|
|
|
|
|
init_arg => undef, |
35
|
|
|
|
|
|
|
lazy => 1, |
36
|
|
|
|
|
|
|
default => quote_sub( |
37
|
|
|
|
|
|
|
## no critic (ProhibitCallsToUnexportedSubs) |
38
|
|
|
|
|
|
|
sprintf( |
39
|
|
|
|
|
|
|
q{ $_[0]->_build_mf_record( %s, %s ) }, |
40
|
|
|
|
|
|
|
map { B::perlstring($_) } $class, $raw_attr |
41
|
|
|
|
|
|
|
) |
42
|
|
|
|
|
|
|
), |
43
|
|
|
|
|
|
|
predicate => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _build_mf_record { |
48
|
12
|
|
|
12
|
|
71088
|
my $self = shift; |
49
|
12
|
|
|
|
|
32
|
my $class = shift; |
50
|
12
|
|
|
|
|
24
|
my $method = shift; |
51
|
|
|
|
|
|
|
|
52
|
12
|
|
|
|
|
47
|
my $raw = $self->$method; |
53
|
|
|
|
|
|
|
|
54
|
12
|
|
|
|
|
25
|
return $class->new( %{$raw}, locales => $self->locales() ); |
|
12
|
|
|
|
|
201
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# ABSTRACT: Contains data for the IPAddress record returned from a minFraud web service query |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
WebService::MinFraud::Record::IPAddress - Contains data for the IPAddress record returned from a minFraud web service query |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 1.010000 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
use 5.010; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
use WebService::MinFraud::Client; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $client = WebService::MinFraud::Client->new( |
82
|
|
|
|
|
|
|
account_id => 42, |
83
|
|
|
|
|
|
|
license_key => 'abcdef123456', |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
my $request = { device => { ip_address => '24.24.24.24' } }; |
86
|
|
|
|
|
|
|
my $insights = $client->insights($request); |
87
|
|
|
|
|
|
|
my $ip_address = $insights->ip_address; |
88
|
|
|
|
|
|
|
say $ip_address->city->name; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 DESCRIPTION |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This class contains the GeoIP2 location data returned from a minFraud service |
93
|
|
|
|
|
|
|
query for the given C<ip_address>. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 METHODS |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This class provides the following methods: |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 city |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::City> object representing city data for the IP |
102
|
|
|
|
|
|
|
address. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 continent |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::Continent> object representing continent data for |
107
|
|
|
|
|
|
|
the IP address. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 country |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns a L<WebService::MinFraud::Record::Country> object for the IP address. |
112
|
|
|
|
|
|
|
This record represents the country where MaxMind believes the IP is located. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 location |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Returns a L<WebService::MinFraud::Record::Location> object for the IP address. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 most_specific_subdivision |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::Subdivision> object which is the most specific |
121
|
|
|
|
|
|
|
(smallest) subdivision. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
If the response did not contain any subdivisions, this method returns a |
124
|
|
|
|
|
|
|
L<GeoIP2::Record::Subdivision> object with no values. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 postal |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::Postal> object representing postal code data for |
129
|
|
|
|
|
|
|
the IP address. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 registered_country |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::Country> object representing the registered country |
134
|
|
|
|
|
|
|
data for the IP address. This record represents the country where the ISP has |
135
|
|
|
|
|
|
|
registered a given IP block and may differ from the user's country. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 represented_country |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::RepresentedCountry> object for the country |
140
|
|
|
|
|
|
|
represented by the IP address. The represented country may differ from the |
141
|
|
|
|
|
|
|
country returned by the C<< country >> method, for locations such as military |
142
|
|
|
|
|
|
|
bases. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 risk |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Returns the risk associated with the IP address. The value ranges from 0.01 to |
147
|
|
|
|
|
|
|
99. A higher value indicates a higher risk. The IP address risk is distinct |
148
|
|
|
|
|
|
|
from the value returned by C<< risk_score >> methods of |
149
|
|
|
|
|
|
|
L<WebService::MinFraud::Model::Insights> and |
150
|
|
|
|
|
|
|
L<WebService::MinFraud::Model::Score> modules. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 subdivisions |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Returns an array of L<GeoIP2::Record::Subdivision> objects representing the |
155
|
|
|
|
|
|
|
country divisions for the IP address. The number and type of subdivisions |
156
|
|
|
|
|
|
|
varies by country, but a subdivision is typically a state, province, county, or |
157
|
|
|
|
|
|
|
administrative region. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 traits |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Returns a L<GeoIP2::Record::Traits> object representing traits for the IP |
162
|
|
|
|
|
|
|
address, such as autonomous system number (ASN). |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 PREDICATE METHODS |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The following predicate methods are available, which return true if the related |
167
|
|
|
|
|
|
|
data was present in the response body, false if otherwise: |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 has_country |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 has_location |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 has_risk |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 SUPPORT |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 AUTHOR |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Mateu Hunter <mhunter@maxmind.com> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
This software is copyright (c) 2015 - 2020 by MaxMind, Inc. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
188
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |