1package GeoIP2::Model::Insights;
2
3use strict;
4use warnings;
5
6our $VERSION = '2.006002';
7
8use Moo;
9
10use namespace::clean -except => 'meta';
11
12with 'GeoIP2::Role::Model::Location', 'GeoIP2::Role::Model::HasSubdivisions';
13
14## no critic (ProhibitUnusedPrivateSubroutines)
15sub _has { has(@_) }
16## use critic
17
18__PACKAGE__->_define_attributes_for_keys( __PACKAGE__->_all_record_names() );
19
201;
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
32GeoIP2::Model::Insights - Model class for GeoIP2 Precision: Insights
33
34=head1 VERSION
35
36version 2.006002
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
56This class provides a model for the data returned by the GeoIP2 Precision:
57Insights web service.
58
59The only difference between the City and Insights model classes is
60which fields in each record may be populated. See
61L<http://dev.maxmind.com/geoip/geoip2/web-services> for more details.
62
63=head1 METHODS
64
65This class provides the following methods.
66
67=head2 $insights->city()
68
69Returns a L<GeoIP2::Record::City> object representing city data for the
70requested IP address.
71
72=head2 $insights->continent()
73
74Returns a L<GeoIP2::Record::Continent> object representing continent data for
75the requested IP address.
76
77=head2 $insights->country()
78
79Returns a L<GeoIP2::Record::Country> object representing country data for the
80requested IP address. This record represents the country where MaxMind
81believes the IP is located.
82
83=head2 $insights->location()
84
85Returns a L<GeoIP2::Record::Location> object representing location data for the
86requested IP address.
87
88=head2 $insights->maxmind()
89
90Returns a L<GeoIP2::Record::MaxMind> object representing data about your
91MaxMind account.
92
93=head2 $insights->postal()
94
95Returns a L<GeoIP2::Record::Postal> object representing postal code data for
96the requested IP address.
97
98=head2 $insights->registered_country()
99
100Returns a L<GeoIP2::Record::Country> object representing the registered
101country data for the requested IP address. This record represents the country
102where the ISP has registered a given IP block and may differ from the
103user's country.
104
105=head2 $insights->represented_country()
106
107Returns a L<GeoIP2::Record::RepresentedCountry> object for the country
108represented by the requested IP address. The represented country may differ
109from the C<country> for things like military bases.
110
111=head2 $insights->subdivisions()
112
113Returns an array of L<GeoIP2::Record::Subdivision> objects representing the
114country subdivisions for the requested IP address. The number and type of
115subdivisions varies by country, but a subdivision is typically a state,
116province, county, etc.
117
118Some countries have multiple levels of subdivisions. For instance, the
119subdivisions array for Oxford in the United Kingdom would have England as the
120first element and Oxfordshire as the second element. The subdivisions array
121for Minneapolis in the United States would have a single object for Minnesota.
122
123If the response did not contain any subdivisions, this method returns an empty
124list.
125
126=head2 $insights->most_specific_subdivision()
127
128Returns a single L<GeoIP2::Record::Subdivision> object representing the most
129specific subdivision returned.
130
131If the response did not contain any subdivisions, this method returns a
132L<GeoIP2::Record::Subdivision> object with no values.
133
134=head2 $insights->traits()
135
136Returns a L<GeoIP2::Record::Traits> object representing the traits for the
137requested IP address.
138
139=head1 SUPPORT
140
141Bugs may be submitted through L<https://github.com/maxmind/GeoIP2-perl/issues>.
142
143=head1 AUTHORS
144
145=over 4
146
147=item *
148
149Dave Rolsky <drolsky@maxmind.com>
150
151=item *
152
153Greg Oschwald <goschwald@maxmind.com>
154
155=item *
156
157Mark Fowler <mfowler@maxmind.com>
158
159=item *
160
161Olaf Alders <oalders@maxmind.com>
162
163=back
164
165=head1 COPYRIGHT AND LICENSE
166
167This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
168
169This is free software; you can redistribute it and/or modify it under
170the same terms as the Perl 5 programming language system itself.
171
172=cut
173