ip_geo_lookup 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/lib/ip_geo_lookup/version.rb +1 -1
- data/lib/ip_geo_lookup.rb +14 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea6488fcae67b2a8f2410b546c5b1221537fd79a479ddb171d8ab7c8c4b0ceaf
|
|
4
|
+
data.tar.gz: cae667b6dbefb63e664c9ba23dad5ed962f668929cf336ed1db3a1b9990e2346
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 939e008059236ce7b03000d2a641b9b158bdc4f1e1f605c72d52a32e0fa59cf1aea104cc9211f52b2a542d71ced400cf463227a147a643b0b17eeb8dfb58eeff
|
|
7
|
+
data.tar.gz: 527c273c7349b7c2df38a283ec63b18cdff7c1197fe2f1b3d21cde0e4eb7788903bc1160ae178af2e25ea708d1ac8cfd539a00ff8d49ecfeea4c10c09f8b8e0b
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] - 2026-04-13
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Normalize non-ASCII characters in geolocation string fields (`country_name`, `region`, `city`, `continent_name`) to ASCII-only Latin characters
|
|
15
|
+
- Accented Latin characters are transliterated via Unicode NFD decomposition (e.g., "São Paulo" → "Sao Paulo", "Zürich" → "Zurich")
|
|
16
|
+
- Non-Latin scripts (Arabic, Chinese, Devanagari, Armenian, Georgian, Hebrew) are stripped to guarantee consistent ASCII output
|
|
17
|
+
|
|
10
18
|
## [0.1.1] - 2026-03-30
|
|
11
19
|
|
|
12
20
|
### Fixed
|
|
@@ -33,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
33
41
|
- CI via GitHub Actions: test matrix (Ruby 2.6, 3.0, 4.0), StandardRB linting, automated gem publishing
|
|
34
42
|
- Dependabot for actions and bundler dependency updates
|
|
35
43
|
|
|
36
|
-
[Unreleased]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.
|
|
44
|
+
[Unreleased]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.2...HEAD
|
|
45
|
+
[0.1.2]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.1...v0.1.2
|
|
37
46
|
[0.1.1]: https://github.com/msuliq/ip_geo_lookup/compare/v0.1.0...v0.1.1
|
|
38
47
|
[0.1.0]: https://github.com/msuliq/ip_geo_lookup/releases/tag/v0.1.0
|
data/lib/ip_geo_lookup.rb
CHANGED
|
@@ -70,11 +70,11 @@ module IpGeoLookup
|
|
|
70
70
|
def build_result(record)
|
|
71
71
|
Result.new(
|
|
72
72
|
country_code: deep_fetch(record, "country", "iso_code"),
|
|
73
|
-
country_name: deep_fetch(record, "country", "names", "en"),
|
|
74
|
-
region: deep_fetch(record, "subdivisions", 0, "names", "en"),
|
|
75
|
-
city: deep_fetch(record, "city", "names", "en"),
|
|
73
|
+
country_name: normalize_str(deep_fetch(record, "country", "names", "en")),
|
|
74
|
+
region: normalize_str(deep_fetch(record, "subdivisions", 0, "names", "en")),
|
|
75
|
+
city: normalize_str(deep_fetch(record, "city", "names", "en")),
|
|
76
76
|
continent_code: deep_fetch(record, "continent", "code"),
|
|
77
|
-
continent_name: deep_fetch(record, "continent", "names", "en"),
|
|
77
|
+
continent_name: normalize_str(deep_fetch(record, "continent", "names", "en")),
|
|
78
78
|
latitude: deep_fetch(record, "location", "latitude"),
|
|
79
79
|
longitude: deep_fetch(record, "location", "longitude"),
|
|
80
80
|
time_zone: deep_fetch(record, "location", "time_zone"),
|
|
@@ -83,6 +83,16 @@ module IpGeoLookup
|
|
|
83
83
|
)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
def normalize_str(str)
|
|
87
|
+
return nil if str.nil?
|
|
88
|
+
|
|
89
|
+
str = str.encode("UTF-8") unless str.encoding == Encoding::UTF_8
|
|
90
|
+
str.unicode_normalize(:nfd)
|
|
91
|
+
.gsub(/[^\p{ASCII}]/, "")
|
|
92
|
+
.gsub(/\s+/, " ")
|
|
93
|
+
.strip
|
|
94
|
+
end
|
|
95
|
+
|
|
86
96
|
def deep_fetch(obj, *keys)
|
|
87
97
|
keys.each do |key|
|
|
88
98
|
case obj
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ip_geo_lookup
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Suleyman Musayev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A lightweight, zero-dependency Ruby gem for resolving IPv4 and IPv6 addresses
|
|
14
14
|
to country, region, city, coordinates, and more. Ships with an embedded MaxMind
|