GeoIP2/Model/Insights.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 22 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« GeoIP2/Model/ISP.pm ↑ Summary GeoIP2/Record/City.pm »
1 package GeoIP2::Model::Insights;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 our $VERSION = '2.006000';
7  
8 9 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 9 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 9 with 'GeoIP2::Role::Model::Location', 'GeoIP2::Role::Model::HasSubdivisions';
13  
14 ## no critic (ProhibitUnusedPrivateSubroutines)
15 162 ▶sub _has { has(@_) }
Subroutine _has: called CC=1 SCAR=0.0
16 ## use critic
17  
18 9 __PACKAGE__->_define_attributes_for_keys( __PACKAGE__->_all_record_names() );
19  
20 9 1;
21  
22 # ABSTRACT: Model class for GeoIP2 Precision: Insights
23  
24 __END__
25  
26 =pod
27  
28 =encoding UTF-8
29  
30 =head1 NAME
31  
32 GeoIP2::Model::Insights - Model class for GeoIP2 Precision: Insights
33  
34 =head1 VERSION
35  
36 version 2.006000
37  
38 =head1 SYNOPSIS
39  
40 use 5.008;
41  
42 use GeoIP2::WebService::Client;
43  
44 my $client = GeoIP2::WebService::Client->new(
45 account_id => 42,
46 license_key => 'abcdef123456',
47 );
48  
49 my $insights = $client->insights( ip => '24.24.24.24' );
50  
51 my $city_rec = $insights->city();
52 print $city_rec->name(), "\n";
53  
54 =head1 DESCRIPTION
55  
56 This class provides a model for the data returned by the GeoIP2 Precision:
57 Insights web service.
58  
59 The only difference between the City and Insights model classes is
60 which fields in each record may be populated. See
61 L<http://dev.maxmind.com/geoip/geoip2/web-services> for more details.
62  
63 =head1 METHODS
64  
65 This class provides the following methods.
66  
67 =head2 $insights->city()
68  
69 Returns a L<GeoIP2::Record::City> object representing city data for the
70 requested IP address.
71  
72 =head2 $insights->continent()
73  
74 Returns a L<GeoIP2::Record::Continent> object representing continent data for
75 the requested IP address.
76  
77 =head2 $insights->country()
78  
79 Returns a L<GeoIP2::Record::Country> object representing country data for the
80 requested IP address. This record represents the country where MaxMind
81 believes the IP is located.
82  
83 =head2 $insights->location()
84  
85 Returns a L<GeoIP2::Record::Location> object representing location data for the
86 requested IP address.
87  
88 =head2 $insights->maxmind()
89  
90 Returns a L<GeoIP2::Record::MaxMind> object representing data about your
91 MaxMind account.
92  
93 =head2 $insights->postal()
94  
95 Returns a L<GeoIP2::Record::Postal> object representing postal code data for
96 the requested IP address.
97  
98 =head2 $insights->registered_country()
99  
100 Returns a L<GeoIP2::Record::Country> object representing the registered
101 country data for the requested IP address. This record represents the country
102 where the ISP has registered a given IP block and may differ from the
103 user's country.
104  
105 =head2 $insights->represented_country()
106  
107 Returns a L<GeoIP2::Record::RepresentedCountry> object for the country
108 represented by the requested IP address. The represented country may differ
109 from the C<country> for things like military bases.
110  
111 =head2 $insights->subdivisions()
112  
113 Returns an array of L<GeoIP2::Record::Subdivision> objects representing the
114 country subdivisions for the requested IP address. The number and type of
115 subdivisions varies by country, but a subdivision is typically a state,
116 province, county, etc.
117  
118 Some countries have multiple levels of subdivisions. For instance, the
119 subdivisions array for Oxford in the United Kingdom would have England as the
120 first element and Oxfordshire as the second element. The subdivisions array
121 for Minneapolis in the United States would have a single object for Minnesota.
122  
123 If the response did not contain any subdivisions, this method returns an empty
124 list.
125  
126 =head2 $insights->most_specific_subdivision()
127  
128 Returns a single L<GeoIP2::Record::Subdivision> object representing the most
129 specific subdivision returned.
130  
131 If the response did not contain any subdivisions, this method returns a
132 L<GeoIP2::Record::Subdivision> object with no values.
133  
134 =head2 $insights->traits()
135  
136 Returns a L<GeoIP2::Record::Traits> object representing the traits for the
137 requested IP address.
138  
139 =head1 SUPPORT
140  
141 =head1 AUTHORS
142  
143 =over 4
144  
145 =item *
146  
147 Dave Rolsky <drolsky@maxmind.com>
148  
149 =item *
150  
151 Greg Oschwald <goschwald@maxmind.com>
152  
153 =item *
154  
155 Mark Fowler <mfowler@maxmind.com>
156  
157 =item *
158  
159 Olaf Alders <oalders@maxmind.com>
160  
161 =back
162  
163 =head1 COPYRIGHT AND LICENSE
164  
165 This software is copyright (c) 2013 - 2018 by MaxMind, Inc.
166  
167 This is free software; you can redistribute it and/or modify it under
168 the same terms as the Perl 5 programming language system itself.
169  
170 =cut
« GeoIP2/Model/ISP.pm ↑ Summary GeoIP2/Record/City.pm »