GeoIP2/Record/RepresentedCountry.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/Record/Postal.pm ↑ Summary GeoIP2/Record/Subdivision.pm »
1 package GeoIP2::Record::RepresentedCountry;
2  
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 our $VERSION = '2.006000';
7  
8 12 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 ▶use GeoIP2::Types qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 12 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 12 with 'GeoIP2::Role::Record::Country';
15  
16 12 has type => (
17 is => 'ro',
18 isa => Str,
19 predicate => 'has_type',
20 );
21  
22 12 1;
23  
24 # ABSTRACT: Contains data for the represented country record associated with an IP address
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 GeoIP2::Record::RepresentedCountry - Contains data for the represented country record associated with an IP address
35  
36 =head1 VERSION
37  
38 version 2.006000
39  
40 =head1 SYNOPSIS
41  
42 use 5.008;
43  
44 use GeoIP2::WebService::Client;
45  
46 my $client = GeoIP2::WebService::Client->new(
47 account_id => 42,
48 license_key => 'abcdef123456',
49 );
50  
51 my $insights = $client->insights( ip => '24.24.24.24' );
52  
53 my $country_rec = $insights->reprented_country();
54 print $country_rec->name(), "\n";
55 print $country_rec->type(), "\n";
56  
57 =head1 DESCRIPTION
58  
59 This class contains the country-level data associated with an IP address for
60 the IP's represented country. The represented country is the country
61 represented by something like a military base.
62  
63 This record is returned by all the end points.
64  
65 =head1 METHODS
66  
67 This class provides the following methods:
68  
69 =head2 $country_rec->confidence()
70  
71 This returns a value from 0-100 indicating MaxMind's confidence that the
72 country is correct.
73  
74 This attribute is only available from the Insights end point and the GeoIP2
75 Enterprise database.
76  
77 =head2 $country_rec->geoname_id()
78  
79 This returns a C<geoname_id> for the country.
80  
81 This attribute is returned by all end points.
82  
83 =head2 $country_rec->is_in_european_union()
84  
85 This returns a true value if the country is a member state of the European
86 Union and a false value otherwise.
87  
88 This attribute is available from all web service end points and the GeoIP2
89 Country, City, and Enterprise databases.
90  
91 =head2 $country_rec->iso_code()
92  
93 This returns the two-character ISO 3166-1
94 (L<http://en.wikipedia.org/wiki/ISO_3166-1>) alpha code for the country.
95  
96 This attribute is returned by all end points.
97  
98 =head2 $country_rec->name()
99  
100 This returns a name for the country. The locale chosen depends on the
101 C<locales> argument that was passed to the record's constructor. This will be
102 passed through from the L<GeoIP2::WebService::Client> object you used to fetch
103 the data that populated this record.
104  
105 If the record does not have a name in any of the locales you asked for, this
106 method returns C<undef>.
107  
108 This attribute is returned by all end points.
109  
110 =head2 $country_rec->names()
111  
112 This returns a hash reference where the keys are locale codes and the values
113 are names. See L<GeoIP2::WebService::Client> for a list of the possible
114 locale codes.
115  
116 This attribute is returned by all end points.
117  
118 =head2 $country_rec->type()
119  
120 This returns a string indicating the type of entity that is representing the
121 country. Currently we only return C<military> but this could expand to include
122 other types in the future.
123  
124 This attribute is returned by all end points.
125  
126 =head1 SUPPORT
127  
128 =head1 AUTHORS
129  
130 =over 4
131  
132 =item *
133  
134 Dave Rolsky <drolsky@maxmind.com>
135  
136 =item *
137  
138 Greg Oschwald <goschwald@maxmind.com>
139  
140 =item *
141  
142 Mark Fowler <mfowler@maxmind.com>
143  
144 =item *
145  
146 Olaf Alders <oalders@maxmind.com>
147  
148 =back
149  
150 =head1 COPYRIGHT AND LICENSE
151  
152 This software is copyright (c) 2013 - 2018 by MaxMind, Inc.
153  
154 This is free software; you can redistribute it and/or modify it under
155 the same terms as the Perl 5 programming language system itself.
156  
157 =cut
« GeoIP2/Record/Postal.pm ↑ Summary GeoIP2/Record/Subdivision.pm »