From 977447c5ca83a184226c472d60c67170c2881045 Mon Sep 17 00:00:00 2001 From: IP2Location Date: Tue, 1 Jun 2021 12:33:54 +0800 Subject: [PATCH] Added supports for address type and category fields. Added exception handling for incorrect BIN database. --- LICENSE.txt | 2 +- README.md | 12 +- VERSION | 2 +- example.rb | 4 +- ip2location_ruby-8.3.0.gem | Bin 0 -> 2098176 bytes ip2location_ruby.gemspec | 2 +- lib/ip2location_ruby.rb | 196 ++++++++++++++++++--- lib/ip2location_ruby/database_config.rb | 40 +++-- lib/ip2location_ruby/ip2location_config.rb | 19 +- rb/data/IP2LOCATION-LITE-DB1.IPV6.BIN | Bin 5253688 -> 5569782 bytes spec/assets/IP2LOCATION-LITE-DB1.IPV6.BIN | Bin 5253688 -> 5569782 bytes spec/ip2location_ruby_database_spec.rb | 12 ++ spec/ip2location_ruby_webservice_spec.rb | 4 +- 13 files changed, 234 insertions(+), 59 deletions(-) create mode 100644 ip2location_ruby-8.3.0.gem diff --git a/LICENSE.txt b/LICENSE.txt index 051cab2..ce2d298 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2020 IP2Location ( support@ip2location.com ) +Copyright (c) 2021 IP2Location ( support@ip2location.com ) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index eafef33..b35ac31 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Total Downloads](https://img.shields.io/gem/dt/ip2location_ruby.svg)](https://rubygems.org/gems/ip2location_ruby) # IP2Location Ruby Library -This is IP2Location Ruby library that enables the user to find the country, region or state, city, latitude and longitude, US ZIP code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, and usage type by IP address or hostname originates from. The library reads the geo location information from **IP2Location BIN data** file or web service. +This is IP2Location Ruby library that enables the user to find the country, region or state, city, latitude and longitude, US ZIP code, time zone, Internet Service Provider (ISP) or company name, domain name, net speed, area code, weather station code, weather station name, mobile country code (MCC), mobile network code (MNC) and carrier brand, elevation, usage type, IP address type and IAB advertising category from IP address using IP2Location database. The library reads the geo location information from **IP2Location BIN data** file or web service. Supported IPv4 and IPv6 address. @@ -19,6 +19,10 @@ Below is the description of the functions available in the **BIN Database** look |---|---| | open | Open the IP2Location BIN data for lookup. | | close | Close and clean up the file pointer. | +| get_package_version | Get the package version (1 to 25 for DB1 to DB25 respectively). | +| get_module_version | Get the module version. | +| get_database_version | Get the database version. | +| get_last_error_message | Return the last error message. | | get_all | Return the geolocation information in array. | | get_country_short | Return the ISO3166-1 country code (2-digits) of the IP address. | | get_country_long | Return the ISO3166-1 country name of the IP address. | @@ -40,6 +44,8 @@ Below is the description of the functions available in the **BIN Database** look | get_mobilebrand | Commercial brand associated with the mobile carrier. | | get_elevation | Return average height of city above sea level in meters (m). | | get_usagetype | Return the ISP's usage type of IP address. | +| get_addresstype | Returns the IP address type (A-Anycast, B-Broadcast, M-Multicast & U-Unicast) of IP address or domain name. | +| category | Returns the IAB content taxonomy category of IP address or domain name. | ## Web Service @@ -47,8 +53,8 @@ Below is the description of the functions available in the **Web Service** looku | Function Name | Description | |---|---| -| Constructor | Expect 3 input parameters:
  1. IP2Location API Key.
  2. Package (WS1 - WS24)
  3. Use HTTPS or HTTP
| -| lookup | Return the IP information in array.