GeoIP2/Model/Enterprise.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/Domain.pm ↑ Summary GeoIP2/Model/ISP.pm »
1 package GeoIP2::Model::Enterprise;
2  
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 our $VERSION = '2.006000';
7  
8 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 7 with 'GeoIP2::Role::Model::Location', 'GeoIP2::Role::Model::HasSubdivisions';
13  
14 ## no critic (ProhibitUnusedPrivateSubroutines)
15 126 ▶sub _has { has(@_) }
Subroutine _has: called CC=1 SCAR=0.0
16 ## use critic
17  
18 7 __PACKAGE__->_define_attributes_for_keys( __PACKAGE__->_all_record_names() );
19  
20 7 1;
21  
22 # ABSTRACT: Model class for GeoIP2 Enterprise
23  
24 __END__
25  
26 =pod
27  
28 =encoding UTF-8
29  
30 =head1 NAME
31  
32 GeoIP2::Model::Enterprise - Model class for GeoIP2 Enterprise
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 $reader = GeoIP2::Database::Reader->new(
45 file => '/path/to/database',
46 locales => [ 'en', 'de', ]
47 );
48  
49 my $enterprise = $reader->enterprise( ip => '24.24.24.24' );
50  
51 my $city_rec = $enterprise->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 Enterprise
57 database.
58  
59 The only difference between the City and Enterprise 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 $enterprise->city()
68  
69 Returns a L<GeoIP2::Record::City> object representing city data for the
70 requested IP address.
71  
72 =head2 $enterprise->continent()
73  
74 Returns a L<GeoIP2::Record::Continent> object representing continent data for
75 the requested IP address.
76  
77 =head2 $enterprise->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 $enterprise->location()
84  
85 Returns a L<GeoIP2::Record::Location> object representing location data for the
86 requested IP address.
87  
88 =head2 $enterprise->postal()
89  
90 Returns a L<GeoIP2::Record::Postal> object representing postal code data for
91 the requested IP address.
92  
93 =head2 $enterprise->registered_country()
94  
95 Returns a L<GeoIP2::Record::Country> object representing the registered
96 country data for the requested IP address. This record represents the country
97 where the ISP has registered a given IP block and may differ from the
98 user's country.
99  
100 =head2 $enterprise->represented_country()
101  
102 Returns a L<GeoIP2::Record::RepresentedCountry> object for the country
103 represented by the requested IP address. The represented country may differ
104 from the C<country> for things like military bases.
105  
106 =head2 $enterprise->subdivisions()
107  
108 Returns an array of L<GeoIP2::Record::Subdivision> objects representing the
109 country subdivisions for the requested IP address. The number and type of
110 subdivisions varies by country, but a subdivision is typically a state,
111 province, county, etc.
112  
113 Some countries have multiple levels of subdivisions. For instance, the
114 subdivisions array for Oxford in the United Kingdom would have England as the
115 first element and Oxfordshire as the second element. The subdivisions array
116 for Minneapolis in the United States would have a single object for Minnesota.
117  
118 If the response did not contain any subdivisions, this method returns an empty
119 list.
120  
121 =head2 $enterprise->most_specific_subdivision()
122  
123 Returns a single L<GeoIP2::Record::Subdivision> object representing the most
124 specific subdivision returned.
125  
126 If the response did not contain any subdivisions, this method returns a
127 L<GeoIP2::Record::Subdivision> object with no values.
128  
129 =head2 $enterprise->traits()
130  
131 Returns a L<GeoIP2::Record::Traits> object representing the traits for the
132 requested IP address.
133  
134 =head1 SUPPORT
135  
136 =head1 AUTHORS
137  
138 =over 4
139  
140 =item *
141  
142 Dave Rolsky <drolsky@maxmind.com>
143  
144 =item *
145  
146 Greg Oschwald <goschwald@maxmind.com>
147  
148 =item *
149  
150 Mark Fowler <mfowler@maxmind.com>
151  
152 =item *
153  
154 Olaf Alders <oalders@maxmind.com>
155  
156 =back
157  
158 =head1 COPYRIGHT AND LICENSE
159  
160 This software is copyright (c) 2013 - 2018 by MaxMind, Inc.
161  
162 This is free software; you can redistribute it and/or modify it under
163 the same terms as the Perl 5 programming language system itself.
164  
165 =cut
« GeoIP2/Model/Domain.pm ↑ Summary GeoIP2/Model/ISP.pm »