GeoIP2
view release on metacpan or search on metacpan
lib/GeoIP2/Record/Traits.pm view on Meta::CPAN
This class provides the following methods:
=head2 $traits_rec->autonomous_system_number()
This returns the autonomous system number
(L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) associated with
the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->autonomous_system_organization()
This returns the organization associated with the registered autonomous system
number (L<http://en.wikipedia.org/wiki/Autonomous_system_(Internet)>) for the IP
address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->connection_type()
This returns the connection type associated with the IP address. It may take
the following values: C<Dialup>, C<Cable/DSL>, C<Corporate>, or C<Cellular>.
Additional values may be added in the future.
This attribute is only available in the GeoIP2 Enterprise database.
=head2 $traits_rec->domain()
This returns the second level domain associated with the IP address. This will
be something like "example.com" or "example.co.uk", not "foo.example.com".
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->ip_address()
This returns the IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the externally
routable IP address for the system the code is running on. If the system is
behind a NAT, this may differ from the IP address locally assigned to it.
This attribute is returned by all end points.
lib/GeoIP2/Record/Traits.pm view on Meta::CPAN
This returns a true value if the IP address is a Tor exit node and a false
value otherwise.
This attribute is only available from the Insights web service.
=head2 $traits_rec->isp()
This returns the name of the ISP associated with the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->organization()
This returns the name of the organization associated with the IP address.
This attribute is only available from the City and Insights web service
endpoints and the GeoIP2 Enterprise database.
=head2 $traits_rec->user_type()
This returns the user type associated with the IP address. This can be one of
the following values:
=over 4
=item * business
t/GeoIP2/WebService/Client.t view on Meta::CPAN
return $self->$meth(@_);
}
sub VERSION {
return 1;
}
}
## no critic (Subroutines::ProhibitManyArgs)
sub _response {
my $endpoint = shift;
my $status = shift;
my $body = shift;
my $bad = shift;
my $content_type = shift;
my $gzip = shift;
my $headers = HTTP::Headers->new;
if ($content_type) {
$headers->header( 'Content-Type' => $content_type );
}
elsif ( $status == 200 || ( $status >= 400 && $status < 500 ) ) {
$headers->header( 'Content-Type' => 'application/vnd.maxmind.com-'
. $endpoint
. '+json; charset=UTF-8; version=1.0' );
}
my $encoded_body = q{};
if ($bad) {
$encoded_body = '{ invalid: }';
}
elsif ($body) {
$encoded_body = ref $body ? $json->encode($body) : $body;
}
( run in 0.793 second using v1.01-cache-2.11-cpan-2b1a40005be )