GeoIP2/Model/Insights.pm

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