GeoIP2/Record/Traits.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 31 / 31 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« GeoIP2/Record/Subdivision.pm ↑ Summary GeoIP2/Role/Error/HTTP.pm »
1 package GeoIP2::Record::Traits;
2 6 $GeoIP2::Record::Traits::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( Bool BoolCoercion IPAddress NonNegativeInt Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 ▶use Sub::Quote qw( quote_sub );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 with 'GeoIP2::Role::HasIPAddress';
12  
13 6 has autonomous_system_number => (
14 is => 'ro',
15 isa => NonNegativeInt,
16 predicate => 'has_autonomous_system_number',
17 );
18  
19 6 has autonomous_system_organization => (
20 is => 'ro',
21 isa => Str,
22 predicate => 'has_autonomous_system_organization',
23 );
24  
25 6 has domain => (
26 is => 'ro',
27 isa => Str,
28 predicate => 'has_domain',
29 );
30  
31 6 has is_anonymous_proxy => (
32 is => 'ro',
33 isa => Bool,
34 default => quote_sub(q{ 0 }),
35 coerce => BoolCoercion,
36 );
37  
38 6 has is_satellite_provider => (
39 is => 'ro',
40 isa => Bool,
41 default => quote_sub(q{ 0 }),
42 coerce => BoolCoercion,
43 );
44  
45 6 has isp => (
46 is => 'ro',
47 isa => Str,
48 predicate => 'has_isp',
49 );
50  
51 6 has organization => (
52 is => 'ro',
53 isa => Str,
54 predicate => 'has_organization',
55 );
56  
57 6 has user_type => (
58 is => 'ro',
59 isa => Str,
60 predicate => 'has_user_type',
61 );
62  
63 6 1;
64  
65 # ABSTRACT: Contains data for the traits record associated with an IP address
66  
67 __END__
68  
69 =pod
70  
71 =head1 NAME
72  
73 GeoIP2::Record::Traits - Contains data for the traits record associated with an IP address
74  
75 =head1 VERSION
76  
77 version 0.050000
78  
79 =head1 SYNOPSIS
80  
81 use 5.008;
82  
83 use GeoIP2::WebService::Client;
84  
85 my $client = GeoIP2::WebService::Client->new(
86 user_id => 42,
87 license_key => 'abcdef123456',
88 );
89  
90 my $insights = $client->insights( ip => '24.24.24.24' );
91  
92 my $traits_rec = $insights->country();
93 say $traits_rec->name();
94  
95 =head1 DESCRIPTION
96  
97 This class contains the traits data associated with an IP address.
98  
99 This record is returned by all the end points.
100  
101 =head1 METHODS
102  
103 This class provides the following methods:
104  
105 =head2 $traits_rec->autonomous_system_number()
106  
107 This returns the autonomous system number
108 (L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) associated with
109 the IP address.
110  
111 This attribute is only available from the City and Insights web service
112 endpoints.
113  
114 =head2 $traits_rec->autonomous_system_organization()
115  
116 This returns the organization associated with the registered autonomous system
117 number (L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) for the IP
118 address.
119  
120 This attribute is only available from the City and Insights web service
121 endpoints.
122  
123 =head2 $traits_rec->domain()
124  
125 This returns the second level domain associated with the IP address. This will
126 be something like "example.com" or "example.co.uk", not "foo.example.com".
127  
128 This attribute is only available from the City and Insights web service
129 endpoints.
130  
131 =head2 $traits_rec->ip_address()
132  
133 This returns the IP address that the data in the model is for. If you
134 performed a "me" lookup against the web service, this will be the externally
135 routable IP address for the system the code is running on. If the system is
136 behind a NAT, this may differ from the IP address locally assigned to it.
137  
138 This attribute is returned by all end points.
139  
140 =head2 $traits_rec->is_anonymous_proxy()
141  
142 This returns true if the IP is an anonymous proxy. See
143 L<http://dev.maxmind.com/faq/geoip#anonproxy> for further details.
144  
145 This attribute is returned by all end points.
146  
147 =head2 $traits_rec->is_satellite_provider()
148  
149 This returns true if the IP is a from a satellite provider that provides
150 service to multiple countries.
151  
152 This attribute is returned by all end points.
153  
154 =head2 $traits_rec->isp()
155  
156 This returns the name of the ISP associated with the IP address.
157  
158 This attribute is only available from the City and Insights web service
159 endpoints.
160  
161 =head2 $traits_rec->organization()
162  
163 This returns the name of the organization associated with the IP address.
164  
165 This attribute is only available from the City and Insights web service
166 endpoints.
167  
168 =head2 $traits_rec->user_type()
169  
170 This returns the user type associated with the IP address. This can be one of
171 the following values:
172  
173 =over 4
174  
175 =item * business
176  
177 =item * cafe
178  
179 =item * cellular
180  
181 =item * college
182  
183 =item * content_delivery_network
184  
185 =item * dialup
186  
187 =item * government
188  
189 =item * hosting
190  
191 =item * library
192  
193 =item * military
194  
195 =item * residential
196  
197 =item * router
198  
199 =item * school
200  
201 =item * search_engine_spider
202  
203 =item * traveler
204  
205 =back
206  
207 This attribute is only available from the Insights end point.
208  
209 =head1 AUTHORS
210  
211 =over 4
212  
213 =item *
214  
215 Dave Rolsky <drolsky@maxmind.com>
216  
217 =item *
218  
219 Greg Oschwald <goschwald@maxmind.com>
220  
221 =item *
222  
223 Olaf Alders <oalders@maxmind.com>
224  
225 =back
226  
227 =head1 COPYRIGHT AND LICENSE
228  
229 This software is copyright (c) 2014 by MaxMind, Inc..
230  
231 This is free software; you can redistribute it and/or modify it under
232 the same terms as the Perl 5 programming language system itself.
233  
234 =cut
« GeoIP2/Record/Subdivision.pm ↑ Summary GeoIP2/Role/Error/HTTP.pm »