| 1 | package GeoIP2::Record::Continent; | ||
| 2 | 6 | $GeoIP2::Record::Continent::VERSION = '0.050000'; | |
| 3 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 6 | ▶ | use GeoIP2::Types qw( PositiveInt Str ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 6 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 6 | with 'GeoIP2::Role::Record::HasNames'; | |
| 11 | |||
| 12 | 6 | has code => ( | |
| 13 | is => 'ro', | ||
| 14 | isa => Str, | ||
| 15 | predicate => 'has_code', | ||
| 16 | ); | ||
| 17 | |||
| 18 | 6 | has geoname_id => ( | |
| 19 | is => 'ro', | ||
| 20 | isa => PositiveInt, | ||
| 21 | predicate => 'has_geoname_id', | ||
| 22 | ); | ||
| 23 | |||
| 24 | 6 | 1; | |
| 25 | |||
| 26 | # ABSTRACT: Contains data for the continent record associated with an IP address | ||
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | GeoIP2::Record::Continent - Contains data for the continent record associated with an IP address | ||
| 35 | |||
| 36 | =head1 VERSION | ||
| 37 | |||
| 38 | version 0.050000 | ||
| 39 | |||
| 40 | =head1 SYNOPSIS | ||
| 41 | |||
| 42 | use 5.008; | ||
| 43 | |||
| 44 | use GeoIP2::WebService::Client; | ||
| 45 | |||
| 46 | my $client = GeoIP2::WebService::Client->new( | ||
| 47 | user_id => 42, | ||
| 48 | license_key => 'abcdef123456', | ||
| 49 | ); | ||
| 50 | |||
| 51 | my $insights = $client->insights( ip => '24.24.24.24' ); | ||
| 52 | |||
| 53 | my $continent_rec = $insights->continent(); | ||
| 54 | say $continent_rec->name(); | ||
| 55 | |||
| 56 | =head1 DESCRIPTION | ||
| 57 | |||
| 58 | This class contains the continent-level data associated with an IP address. | ||
| 59 | |||
| 60 | This record is returned by all the end points. | ||
| 61 | |||
| 62 | =head1 METHODS | ||
| 63 | |||
| 64 | This class provides the following methods: | ||
| 65 | |||
| 66 | =head2 $continent_rec->code() | ||
| 67 | |||
| 68 | This returns a two character continent code like "NA" (North America) or "OC" | ||
| 69 | (Oceania). | ||
| 70 | |||
| 71 | This attribute is returned by all end points. | ||
| 72 | |||
| 73 | =head2 $continent_rec->geoname_id() | ||
| 74 | |||
| 75 | This returns a C<geoname_id> for the continent. | ||
| 76 | |||
| 77 | This attribute is returned by all end points. | ||
| 78 | |||
| 79 | =head2 $continent_rec->name() | ||
| 80 | |||
| 81 | This returns a name for the continent. The locale chosen depends on the | ||
| 82 | C<locales> argument that was passed to the record's constructor. This will be | ||
| 83 | passed through from the L<GeoIP2::WebService::Client> object you used to fetch | ||
| 84 | the data that populated this record. | ||
| 85 | |||
| 86 | If the record does not have a name in any of the locales you asked for, this | ||
| 87 | method returns C<undef>. | ||
| 88 | |||
| 89 | This attribute is returned by all end points. | ||
| 90 | |||
| 91 | =head2 $continent_rec->names() | ||
| 92 | |||
| 93 | This returns a hash reference where the keys are locale codes and the values | ||
| 94 | are names. See L<GeoIP2::WebService::Client> for a list of the possible | ||
| 95 | locale codes. | ||
| 96 | |||
| 97 | This attribute is returned by all end points. | ||
| 98 | |||
| 99 | =head1 AUTHORS | ||
| 100 | |||
| 101 | =over 4 | ||
| 102 | |||
| 103 | =item * | ||
| 104 | |||
| 105 | Dave Rolsky <drolsky@maxmind.com> | ||
| 106 | |||
| 107 | =item * | ||
| 108 | |||
| 109 | Greg Oschwald <goschwald@maxmind.com> | ||
| 110 | |||
| 111 | =item * | ||
| 112 | |||
| 113 | Olaf Alders <oalders@maxmind.com> | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | =head1 COPYRIGHT AND LICENSE | ||
| 118 | |||
| 119 | This software is copyright (c) 2014 by MaxMind, Inc.. | ||
| 120 | |||
| 121 | This is free software; you can redistribute it and/or modify it under | ||
| 122 | the same terms as the Perl 5 programming language system itself. | ||
| 123 | |||
| 124 | =cut | ||