File Coverage

blib/lib/GeoIP2/Record/Postal.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             package GeoIP2::Record::Postal;
2              
3 12     12   73 use strict;
  12         18  
  12         305  
4 12     12   63 use warnings;
  12         21  
  12         380  
5              
6             our $VERSION = '2.006002';
7              
8 12     12   61 use Moo;
  12         20  
  12         68  
9              
10 12     12   3166 use GeoIP2::Types qw( NonNegativeInt Str );
  12         30  
  12         589  
11              
12 12     12   68 use namespace::clean -except => 'meta';
  12         25  
  12         106  
13              
14             has code => (
15             is => 'ro',
16             isa => Str,
17             predicate => 'has_code',
18             );
19              
20             has confidence => (
21             is => 'ro',
22             isa => NonNegativeInt,
23             predicate => 'has_confidence',
24             );
25              
26             1;
27              
28             # ABSTRACT: Contains data for the postal code record associated with an IP address
29              
30             __END__
31              
32             =pod
33              
34             =encoding UTF-8
35              
36             =head1 NAME
37              
38             GeoIP2::Record::Postal - Contains data for the postal code record associated with an IP address
39              
40             =head1 VERSION
41              
42             version 2.006002
43              
44             =head1 SYNOPSIS
45              
46             use 5.008;
47              
48             use GeoIP2::WebService::Client;
49              
50             my $client = GeoIP2::WebService::Client->new(
51             account_id => 42,
52             license_key => 'abcdef123456',
53             );
54              
55             my $insights = $client->insights( ip => '24.24.24.24' );
56              
57             my $postal_rec = $insights->postal();
58             print $postal_rec->code(), "\n";
59              
60             =head1 DESCRIPTION
61              
62             This class contains the postal code data associated with an IP address.
63              
64             This record is returned by all the end points except the Country end point.
65              
66             =head1 METHODS
67              
68             This class provides the following methods:
69              
70             =head2 $postal_rec->code()
71              
72             This returns the postal code associated with the IP address. Postal codes are
73             not available for all countries. In some countries, this will only contain
74             part of the postal code.
75              
76             This attribute is returned by all end points except the Country end point.
77              
78             =head2 $postal_rec->confidence()
79              
80             This returns a value from 0-100 indicating MaxMind's confidence that the
81             postal code is correct.
82              
83             This attribute is only available from the Insights end point and the GeoIP2
84             Enterprise database.
85              
86             =head1 SUPPORT
87              
88             Bugs may be submitted through L<https://github.com/maxmind/GeoIP2-perl/issues>.
89              
90             =head1 AUTHORS
91              
92             =over 4
93              
94             =item *
95              
96             Dave Rolsky <drolsky@maxmind.com>
97              
98             =item *
99              
100             Greg Oschwald <goschwald@maxmind.com>
101              
102             =item *
103              
104             Mark Fowler <mfowler@maxmind.com>
105              
106             =item *
107              
108             Olaf Alders <oalders@maxmind.com>
109              
110             =back
111              
112             =head1 COPYRIGHT AND LICENSE
113              
114             This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
115              
116             This is free software; you can redistribute it and/or modify it under
117             the same terms as the Perl 5 programming language system itself.
118              
119             =cut