diff --git a/CLAUDE.md b/CLAUDE.md index 074858b..3d4ed6d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,8 +5,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview **GeoIP2-ruby** is MaxMind's official Ruby client library for: -- **GeoIP2/GeoLite2 Web Services**: Country, City, and Insights endpoints -- **GeoIP2/GeoLite2 Databases**: Local MMDB file reading for various database types (City, Country, ASN, Anonymous IP, Anonymous Plus, ISP, etc.) +- **GeoIP/GeoLite Web Services**: Country, City Plus, and Insights endpoints +- **GeoIP/GeoLite Databases**: Local MMDB file reading for various database types (City, Country, ASN, Anonymous IP, Anonymous Plus, ISP, etc.) The library provides both web service clients and database readers that return strongly-typed model objects containing geographic, ISP, anonymizer, and other IP-related data. @@ -385,6 +385,6 @@ ruby -Ilib:test test/test_reader.rb ## Additional Resources - [API Documentation](https://www.rubydoc.info/gems/maxmind-geoip2) -- [GeoIP2 Web Services Docs](https://dev.maxmind.com/geoip/docs/web-services) +- [GeoIP Web Services Docs](https://dev.maxmind.com/geoip/docs/web-services) - [MaxMind DB Format](https://maxmind.github.io/MaxMind-DB/) - GitHub Issues: https://github.com/maxmind/GeoIP2-ruby/issues diff --git a/README.md b/README.md index 0eba707..4c98ffb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# GeoIP2 Ruby API +# GeoIP Ruby API ## Description -This is the Ruby API for the GeoIP2 and GeoLite2 +This is the Ruby API for the GeoIP and GeoLite [webservices](https://dev.maxmind.com/geoip/docs/web-services?lang=en) and [databases](https://dev.maxmind.com/geoip/docs/databases?lang=en). @@ -15,7 +15,7 @@ gem install maxmind-geoip2 ## IP Geolocation Usage IP geolocation is inherently imprecise. Locations are often near the center -of the population. Any location provided by a GeoIP2 database or web +of the population. Any location provided by a GeoIP database or web service should not be used to identify a particular address or household. ## Database Reader @@ -217,7 +217,7 @@ puts record.organization # University of Minnesota ### Usage To use this API, you must create a new `MaxMind::GeoIP2::Client` object -with your account ID and license key. To use the GeoLite2 web service, you +with your account ID and license key. To use the GeoLite web service, you may also set the `host` parameter to `geolite.info`. You may then you call the method corresponding to a specific end point, passing it the IP address you want to look up. @@ -243,18 +243,18 @@ client = MaxMind::GeoIP2::Client.new( account_id: 42, license_key: 'license_key', - # To use the GeoLite2 web service instead of the GeoIP2 web service, set + # To use the GeoLite web service instead of the GeoIP web service, set # the host parameter to "geolite.info": # host: 'geolite.info', - # To use the Sandbox GeoIP2 web service instead of the production GeoIP2 + # To use the Sandbox GeoIP web service instead of the production GeoIP # web service, set the host parameter to "sandbox.maxmind.com": # host: 'sandbox.maxmind.com', ) # Replace "city" with the method corresponding to the web service that # you are using, e.g., "country", "insights". Please note that Insights -# is only supported by the GeoIP2 web service and not the GeoLite2 web +# is only supported by the GeoIP web service and not the GeoLite web # service. record = client.city('128.101.101.101') @@ -299,7 +299,7 @@ which can be populated vary between end points. In addition, while an end point may offer a particular piece of data, MaxMind does not always have every piece of data for any given IP address. -See the [GeoIP2 web service +See the [GeoIP web service documentation](https://dev.maxmind.com/geoip/docs/web-services?lang=en) for details on what data each end point may return. @@ -313,7 +313,7 @@ databases with data on geographical features around the world, including populated places. They offer both free and paid premium data. Each feature is unique identified by a `geoname_id`, which is an integer. -Many of the records returned by the GeoIP2 web services and databases +Many of the records returned by the GeoIP web services and databases include a `geoname_id` property. This is the ID of a geographical feature (city, region, country, etc.) in the GeoNames database. diff --git a/lib/maxmind/geoip2/client.rb b/lib/maxmind/geoip2/client.rb index 367fe8a..addd92d 100644 --- a/lib/maxmind/geoip2/client.rb +++ b/lib/maxmind/geoip2/client.rb @@ -13,7 +13,7 @@ module MaxMind module GeoIP2 # This class provides a client API for all the - # {https://dev.maxmind.com/geoip/docs/web-services?lang=en GeoIP2 web + # {https://dev.maxmind.com/geoip/docs/web-services?lang=en GeoIP web # services}. The services are Country, City Plus, and Insights. Each service # returns a different set of data about an IP address, with Country returning # the least data and Insights the most. @@ -60,7 +60,7 @@ class Client # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/PerceivedComplexity - # Create a Client that may be used to query a GeoIP2 web service. + # Create a Client that may be used to query a GeoIP web service. # # Once created, the Client is safe to use for lookups from multiple # threads. @@ -73,8 +73,8 @@ class Client # property from most preferred to least preferred. # # @param host [String] the host to use when querying the web service. Set - # this to "geolite.info" to use the GeoLite2 web service instead of the - # GeoIP2 web service. Set this to "sandbox.maxmind.com" to use the + # this to "geolite.info" to use the GeoLite web service instead of the + # GeoIP web service. Set this to "sandbox.maxmind.com" to use the # Sandbox environment. The sandbox allows you to experiment with the # API without affecting your production data. # @@ -205,7 +205,7 @@ def country(ip_address = 'me') # This method calls the Insights web service. # - # Insights is only supported by the GeoIP2 web service. The GeoLite2 web + # Insights is only supported by the GeoIP web service. The GeoLite web # service does not support it. # # @param ip_address [String] IPv4 or IPv6 address as a string. If no diff --git a/lib/maxmind/geoip2/model/asn.rb b/lib/maxmind/geoip2/model/asn.rb index e88ff3a..03aa502 100644 --- a/lib/maxmind/geoip2/model/asn.rb +++ b/lib/maxmind/geoip2/model/asn.rb @@ -5,7 +5,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the GeoLite2 ASN database. + # Model class for the GeoLite ASN database. class ASN < Abstract # The autonomous system number associated with the IP address. # diff --git a/lib/maxmind/geoip2/model/city.rb b/lib/maxmind/geoip2/model/city.rb index 563035b..7439b45 100644 --- a/lib/maxmind/geoip2/model/city.rb +++ b/lib/maxmind/geoip2/model/city.rb @@ -9,8 +9,8 @@ module MaxMind module GeoIP2 module Model - # Model class for the data returned by the GeoIP2 City Plus web service - # and the City database. It is also used for GeoLite2 City lookups. + # Model class for the data returned by the GeoIP City Plus web service + # and the City database. It is also used for GeoLite City lookups. # # See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more # details. diff --git a/lib/maxmind/geoip2/model/connection_type.rb b/lib/maxmind/geoip2/model/connection_type.rb index 2eb8d90..8dcf60c 100644 --- a/lib/maxmind/geoip2/model/connection_type.rb +++ b/lib/maxmind/geoip2/model/connection_type.rb @@ -5,7 +5,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the GeoIP2 Connection Type database. + # Model class for the GeoIP Connection Type database. class ConnectionType < Abstract # The connection type may take the following values: "Dialup", # "Cable/DSL", "Corporate", "Cellular", and "Satellite". Additional diff --git a/lib/maxmind/geoip2/model/country.rb b/lib/maxmind/geoip2/model/country.rb index 7d5e375..70275d8 100644 --- a/lib/maxmind/geoip2/model/country.rb +++ b/lib/maxmind/geoip2/model/country.rb @@ -9,8 +9,8 @@ module MaxMind module GeoIP2 module Model - # Model class for the data returned by the GeoIP2 Country web service and - # database. It is also used for GeoLite2 Country lookups. + # Model class for the data returned by the GeoIP Country web service and + # database. It is also used for GeoLite Country lookups. class Country # Continent data for the IP address. # diff --git a/lib/maxmind/geoip2/model/domain.rb b/lib/maxmind/geoip2/model/domain.rb index ac88735..1392385 100644 --- a/lib/maxmind/geoip2/model/domain.rb +++ b/lib/maxmind/geoip2/model/domain.rb @@ -5,7 +5,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the GeoIP2 Domain database. + # Model class for the GeoIP Domain database. class Domain < Abstract # The second level domain associated with the IP address. This will be # something like "example.com" or "example.co.uk", not "foo.example.com". diff --git a/lib/maxmind/geoip2/model/enterprise.rb b/lib/maxmind/geoip2/model/enterprise.rb index c6151a6..07a2a52 100644 --- a/lib/maxmind/geoip2/model/enterprise.rb +++ b/lib/maxmind/geoip2/model/enterprise.rb @@ -5,7 +5,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the data returned by GeoIP2 Enterprise database lookups. + # Model class for the data returned by GeoIP Enterprise database lookups. # # See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more # details. diff --git a/lib/maxmind/geoip2/model/insights.rb b/lib/maxmind/geoip2/model/insights.rb index efbb5ae..0760e67 100644 --- a/lib/maxmind/geoip2/model/insights.rb +++ b/lib/maxmind/geoip2/model/insights.rb @@ -6,7 +6,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the data returned by the GeoIP2 Insights web service. + # Model class for the data returned by the GeoIP Insights web service. # # See https://dev.maxmind.com/geoip/docs/web-services?lang=en for more # details. diff --git a/lib/maxmind/geoip2/model/isp.rb b/lib/maxmind/geoip2/model/isp.rb index ca039e8..dfbb395 100644 --- a/lib/maxmind/geoip2/model/isp.rb +++ b/lib/maxmind/geoip2/model/isp.rb @@ -5,7 +5,7 @@ module MaxMind module GeoIP2 module Model - # Model class for the GeoIP2 ISP database. + # Model class for the GeoIP ISP database. class ISP < Abstract # The autonomous system number associated with the IP address. # diff --git a/lib/maxmind/geoip2/reader.rb b/lib/maxmind/geoip2/reader.rb index 3417bed..73c1b54 100644 --- a/lib/maxmind/geoip2/reader.rb +++ b/lib/maxmind/geoip2/reader.rb @@ -14,7 +14,7 @@ module MaxMind module GeoIP2 - # Reader is a reader for the GeoIP2/GeoLite2 database format. IP addresses + # Reader is a reader for the GeoIP/GeoLite database format. IP addresses # can be looked up using the database specific methods. # # == Example @@ -31,7 +31,7 @@ class Reader # rubocop:disable Metrics/CyclomaticComplexity # rubocop:disable Metrics/PerceivedComplexity - # Create a Reader for looking up IP addresses in a GeoIP2/GeoLite2 database + # Create a Reader for looking up IP addresses in a GeoIP/GeoLite database # file. # # If you're performing multiple lookups, it's most efficient to create one @@ -41,7 +41,7 @@ class Reader # threads. It is safe to use after forking. # # @overload initialize(database:, locales: ['en'], mode: MaxMind::DB::MODE_AUTO) - # @param database [String] a path to a GeoIP2/GeoLite2 database file. + # @param database [String] a path to a GeoIP/GeoLite database file. # @param locales [Array] a list of locale codes to use in the name # property from most preferred to least preferred. # @param mode [Symbol] Defines how to open the database. It may be one of diff --git a/lib/maxmind/geoip2/record/city.rb b/lib/maxmind/geoip2/record/city.rb index 27a7cc1..80353dc 100644 --- a/lib/maxmind/geoip2/record/city.rb +++ b/lib/maxmind/geoip2/record/city.rb @@ -14,7 +14,7 @@ module Record class City < Place # A value from 0-100 indicating MaxMind's confidence that the city is # correct. This attribute is only available from the Insights service and - # the GeoIP2 Enterprise database. + # the GeoIP Enterprise database. # # @return [Integer, nil] def confidence diff --git a/lib/maxmind/geoip2/record/country.rb b/lib/maxmind/geoip2/record/country.rb index 672760b..0774a6e 100644 --- a/lib/maxmind/geoip2/record/country.rb +++ b/lib/maxmind/geoip2/record/country.rb @@ -13,7 +13,7 @@ module Record class Country < Place # A value from 0-100 indicating MaxMind's confidence that the country is # correct. This attribute is only available from the Insights service and - # the GeoIP2 Enterprise database. + # the GeoIP Enterprise database. # # @return [Integer, nil] def confidence diff --git a/lib/maxmind/geoip2/record/postal.rb b/lib/maxmind/geoip2/record/postal.rb index 5933c6c..d579ce7 100644 --- a/lib/maxmind/geoip2/record/postal.rb +++ b/lib/maxmind/geoip2/record/postal.rb @@ -22,7 +22,7 @@ def code # A value from 0-100 indicating MaxMind's confidence that the postal code # is correct. This attribute is only available from the Insights service - # and the GeoIP2 Enterprise database. + # and the GeoIP Enterprise database. # # @return [Integer, nil] def confidence diff --git a/lib/maxmind/geoip2/record/subdivision.rb b/lib/maxmind/geoip2/record/subdivision.rb index 5038eb3..5f0871e 100644 --- a/lib/maxmind/geoip2/record/subdivision.rb +++ b/lib/maxmind/geoip2/record/subdivision.rb @@ -14,7 +14,7 @@ module Record class Subdivision < Place # This is a value from 0-100 indicating MaxMind's confidence that the # subdivision is correct. This attribute is only available from the - # Insights service and the GeoIP2 Enterprise database. + # Insights service and the GeoIP Enterprise database. # # @return [Integer, nil] def confidence diff --git a/lib/maxmind/geoip2/record/traits.rb b/lib/maxmind/geoip2/record/traits.rb index 37ca2e6..075b008 100644 --- a/lib/maxmind/geoip2/record/traits.rb +++ b/lib/maxmind/geoip2/record/traits.rb @@ -103,7 +103,7 @@ def anonymous_vpn? # {https://en.wikipedia.org/wiki/Anycast anycast network}. # # This property is only available from the Country, City Plus, and - # Insights web services and the GeoIP2 Country, City, and Enterprise + # Insights web services and the GeoIP Country, City, and Enterprise # databases. # # @return [Boolean] diff --git a/maxmind-geoip2.gemspec b/maxmind-geoip2.gemspec index f40f649..017ff9b 100644 --- a/maxmind-geoip2.gemspec +++ b/maxmind-geoip2.gemspec @@ -9,10 +9,10 @@ Gem::Specification.new do |s| s.authors = ['William Storey'] s.files = Dir['**/*'].difference(Dir['.github/**/*', 'dev-bin/**/*', 'test/**/*', 'CLAUDE.md', 'Gemfile*', 'Rakefile', '*.gemspec', 'README.dev.md']) s.name = 'maxmind-geoip2' - s.summary = 'A gem for interacting with the GeoIP2 webservices and databases.' + s.summary = 'A gem for interacting with the GeoIP webservices and databases.' s.version = MaxMind::GeoIP2::VERSION - s.description = 'A gem for interacting with the GeoIP2 webservices and databases. MaxMind provides geolocation data as downloadable databases as well as through a webservice.' + s.description = 'A gem for interacting with the GeoIP webservices and databases. MaxMind provides geolocation data as downloadable databases as well as through a webservice.' s.email = 'support@maxmind.com' s.homepage = 'https://github.com/maxmind/GeoIP2-ruby' s.licenses = ['Apache-2.0', 'MIT'] diff --git a/mise.lock b/mise.lock new file mode 100644 index 0000000..20b29f4 --- /dev/null +++ b/mise.lock @@ -0,0 +1,32 @@ +# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html + +[[tools.ruby]] +version = "4.0.5" +backend = "core:ruby" + +[tools.ruby."platforms.linux-arm64"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.linux-arm64-musl"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.linux-x64"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.linux-x64-musl"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.macos-arm64"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.macos-x64"] +checksum = "sha256:7d6149079a63f8ae1d326c9fa65c6019ba2dc3155eae7b39159817911c88958e" +url = "https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz" + +[tools.ruby."platforms.windows-x64"] +url = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-4.0.5-1/rubyinstaller-4.0.5-1-x64.7z" diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..bea4666 --- /dev/null +++ b/mise.toml @@ -0,0 +1,17 @@ +[settings] +experimental = true +lockfile = true +disable_backends = [ + "asdf", + "vfox", +] + +[tools] +ruby = "latest" + +[hooks] +enter = "mise install --quiet --locked" + +[[watch_files]] +patterns = ["mise.toml", "mise.lock"] +run = "mise install --quiet --locked" diff --git a/test/test_model_country.rb b/test/test_model_country.rb index f5e56b2..842b33a 100644 --- a/test/test_model_country.rb +++ b/test/test_model_country.rb @@ -77,7 +77,7 @@ def test_unknown_trait end # This can happen if we're being created from a not fully populated response - # when used by minFraud. It shouldn't ever happen from GeoIP2 though. + # when used by minFraud. It shouldn't ever happen from GeoIP though. def test_no_traits model = MaxMind::GeoIP2::Model::Country.new( {