| 1 | package GeoIP2::Model::Country; | ||
| 2 | 4 | $GeoIP2::Model::Country::VERSION = '0.050000'; | |
| 3 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 4 | ▶ | use GeoIP2::Types qw( HashRef object_isa_type ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 4 | ▶ | use Sub::Quote qw( quote_sub ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 4 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 4 | with 'GeoIP2::Role::Model::Location'; | |
| 12 | |||
| 13 | 4 | __PACKAGE__->_define_attributes_for_keys( | |
| 14 | qw( continent country maxmind registered_country traits )); | ||
| 15 | |||
| 16 | 4 | 1; | |
| 17 | |||
| 18 | # ABSTRACT: Model class for the GeoIP2 Precision: Country and GeoIP2 Country | ||
| 19 | |||
| 20 | __END__ | ||
| 21 | |||
| 22 | =pod | ||
| 23 | |||
| 24 | =head1 NAME | ||
| 25 | |||
| 26 | GeoIP2::Model::Country - Model class for the GeoIP2 Precision: Country and GeoIP2 Country | ||
| 27 | |||
| 28 | =head1 VERSION | ||
| 29 | |||
| 30 | version 0.050000 | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | use 5.008; | ||
| 35 | |||
| 36 | use GeoIP2::WebService::Client; | ||
| 37 | |||
| 38 | my $client = GeoIP2::WebService::Client->new( | ||
| 39 | user_id => 42, | ||
| 40 | license_key => 'abcdef123456', | ||
| 41 | ); | ||
| 42 | |||
| 43 | my $country = $client->country( ip => '24.24.24.24' ); | ||
| 44 | |||
| 45 | my $country_rec = $country->country(); | ||
| 46 | say $country_rec->iso_code(); | ||
| 47 | |||
| 48 | =head1 DESCRIPTION | ||
| 49 | |||
| 50 | This class provides a model for the data returned by the GeoIP2 Precision: | ||
| 51 | Country web service and the GeoIP2 Country database. | ||
| 52 | |||
| 53 | =head1 METHODS | ||
| 54 | |||
| 55 | This class provides the following methods, each of which returns a record | ||
| 56 | object. | ||
| 57 | |||
| 58 | =head2 $country->continent() | ||
| 59 | |||
| 60 | Returns a L<GeoIP2::Record::Continent> object representing continent data for | ||
| 61 | the requested IP address. | ||
| 62 | |||
| 63 | =head2 $country->country() | ||
| 64 | |||
| 65 | Returns a L<GeoIP2::Record::Country> object representing country data for the | ||
| 66 | requested IP address. This record represents the country where MaxMind | ||
| 67 | believes the IP is located. | ||
| 68 | |||
| 69 | =head2 $country->maxmind() | ||
| 70 | |||
| 71 | Returns a L<GeoIP2::Record::MaxMind> object representing data about your | ||
| 72 | MaxMind account. | ||
| 73 | |||
| 74 | =head2 $country->registered_country() | ||
| 75 | |||
| 76 | Returns a L<GeoIP2::Record::Country> object representing the registered | ||
| 77 | country data for the requested IP address. This record represents the country | ||
| 78 | where the ISP has registered a given IP block and may differ from the | ||
| 79 | user's country. | ||
| 80 | |||
| 81 | =head2 $country->represented_country() | ||
| 82 | |||
| 83 | Returns a L<GeoIP2::Record::RepresentedCountry> object for the country | ||
| 84 | represented by the requested IP address. The represented country may differ | ||
| 85 | from the C<country> for things like military bases. | ||
| 86 | |||
| 87 | =head2 $country->traits() | ||
| 88 | |||
| 89 | Returns a L<GeoIP2::Record::Traits> object representing the traits for the | ||
| 90 | requested IP address. | ||
| 91 | |||
| 92 | =head1 AUTHORS | ||
| 93 | |||
| 94 | =over 4 | ||
| 95 | |||
| 96 | =item * | ||
| 97 | |||
| 98 | Dave Rolsky <drolsky@maxmind.com> | ||
| 99 | |||
| 100 | =item * | ||
| 101 | |||
| 102 | Greg Oschwald <goschwald@maxmind.com> | ||
| 103 | |||
| 104 | =item * | ||
| 105 | |||
| 106 | Olaf Alders <oalders@maxmind.com> | ||
| 107 | |||
| 108 | =back | ||
| 109 | |||
| 110 | =head1 COPYRIGHT AND LICENSE | ||
| 111 | |||
| 112 | This software is copyright (c) 2014 by MaxMind, Inc.. | ||
| 113 | |||
| 114 | This is free software; you can redistribute it and/or modify it under | ||
| 115 | the same terms as the Perl 5 programming language system itself. | ||
| 116 | |||
| 117 | =cut | ||