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