geocoder 1.8.5 → 1.8.6
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 +5 -0
- data/lib/geocoder/lookup.rb +1 -0
- data/lib/geocoder/lookups/ban_data_gouv_fr.rb +1 -1
- data/lib/geocoder/lookups/ip2location_io.rb +2 -2
- data/lib/geocoder/lookups/ipinfo_io_lite.rb +42 -0
- data/lib/geocoder/lookups/mapbox.rb +1 -0
- data/lib/geocoder/lookups/pc_miler.rb +3 -1
- data/lib/geocoder/results/ipinfo_io_lite.rb +16 -0
- data/lib/geocoder/results/mapbox.rb +1 -2
- data/lib/geocoder/stores/active_record.rb +3 -2
- data/lib/geocoder/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b8e84b8e86854f7aadc62c7b2a5258af91c7a24e80e99755e3f96629bb501f3
|
4
|
+
data.tar.gz: 5f2ddd4bb79edb7a05539f8bd58108a5b84359a46f6fea711770b575428c628f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42721f88ac240ccf70e58d3ff9556e413727ce385c28b40aef5a9a43819468b91a58c8543d3f267452fd1f5560dfd7cbf7d6e01f77d0d8d7cef23dbc1d5bf81
|
7
|
+
data.tar.gz: eb50fe5f2852c809778ff329a11d189a6ac226d6b2c99404b530c75bae316211cf79cbc3d2d2ef391b73a1dd0dbba57fb6b9bfc8ec597a63e7027929bd0ad0e6
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@ Changelog
|
|
3
3
|
|
4
4
|
Major changes to Geocoder for each release. Please see the Git log for complete list of changes.
|
5
5
|
|
6
|
+
1.8.6 (2025 Sep 21)
|
7
|
+
-------------------
|
8
|
+
* Add support for IPInfo Lite lookup (thanks github.com/iltempo).
|
9
|
+
* Various minor fixes and improvements.
|
10
|
+
|
6
11
|
1.8.5 (2024 Dec 18)
|
7
12
|
-------------------
|
8
13
|
* Fix bug when working with IPAddr objects (thanks github.com/ledermann and github.com/mattlemx).
|
data/lib/geocoder/lookup.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'geocoder/lookups/base'
|
2
|
+
require 'geocoder/results/ipinfo_io_lite'
|
3
|
+
|
4
|
+
module Geocoder::Lookup
|
5
|
+
class IpinfoIoLite < Base
|
6
|
+
def name
|
7
|
+
'Ipinfo.io Lite'
|
8
|
+
end
|
9
|
+
|
10
|
+
private # ---------------------------------------------------------------
|
11
|
+
|
12
|
+
def base_query_url(query)
|
13
|
+
url = "#{protocol}://api.ipinfo.io/lite/#{query.sanitized_text}"
|
14
|
+
url << '?' if configuration.api_key
|
15
|
+
url
|
16
|
+
end
|
17
|
+
|
18
|
+
def results(query)
|
19
|
+
# don't look up a loopback or private address, just return the stored result
|
20
|
+
return [reserved_result(query.text)] if query.internal_ip_address?
|
21
|
+
|
22
|
+
if !(doc = fetch_data(query)).is_a?(Hash) or doc['error']
|
23
|
+
[]
|
24
|
+
else
|
25
|
+
[doc]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def reserved_result(ip)
|
30
|
+
{
|
31
|
+
'ip' => ip,
|
32
|
+
'bogon' => true
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def query_url_params(query)
|
37
|
+
{
|
38
|
+
token: configuration.api_key
|
39
|
+
}.merge(super)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -10,10 +10,12 @@ module Geocoder::Lookup
|
|
10
10
|
# AF: Africa
|
11
11
|
# AS: Asia
|
12
12
|
# EU: Europe
|
13
|
+
# ME: Middle East
|
14
|
+
# MX: Mexico
|
13
15
|
# NA: North America
|
14
16
|
# OC: Oceania
|
15
17
|
# SA: South America
|
16
|
-
%w[AF AS EU NA OC SA]
|
18
|
+
%w[AF AS EU ME MX NA OC SA]
|
17
19
|
end
|
18
20
|
|
19
21
|
def name
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'geocoder/results/base'
|
2
|
+
|
3
|
+
module Geocoder::Result
|
4
|
+
class IpinfoIoLite < Base
|
5
|
+
|
6
|
+
def self.response_attributes
|
7
|
+
%w(ip asn as_name as_domain country country_code continent continent_code)
|
8
|
+
end
|
9
|
+
|
10
|
+
response_attributes.each do |a|
|
11
|
+
define_method a do
|
12
|
+
@data[a]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -132,7 +132,8 @@ module Geocoder::Store
|
|
132
132
|
# If radius is a DB column name, bounding box should include
|
133
133
|
# all rows within the maximum radius appearing in that column.
|
134
134
|
# Note: performance is dependent on variability of radii.
|
135
|
-
|
135
|
+
radius_is_column = radius.is_a?(Symbol) || (defined?(Arel::Nodes::SqlLiteral) && radius.is_a?(Arel::Nodes::SqlLiteral))
|
136
|
+
bb_radius = radius_is_column ? maximum(radius) : radius
|
136
137
|
b = Geocoder::Calculations.bounding_box([latitude, longitude], bb_radius, options)
|
137
138
|
args = b + [
|
138
139
|
full_column_name(latitude_attribute),
|
@@ -146,7 +147,7 @@ module Geocoder::Store
|
|
146
147
|
min_radius = options.fetch(:min_radius, 0).to_f
|
147
148
|
# if radius is a DB column name,
|
148
149
|
# find rows between min_radius and value in column
|
149
|
-
if
|
150
|
+
if radius_is_column
|
150
151
|
c = "BETWEEN ? AND #{radius}"
|
151
152
|
a = [min_radius]
|
152
153
|
else
|
data/lib/geocoder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-09-21 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: base64
|
@@ -109,6 +108,7 @@ files:
|
|
109
108
|
- lib/geocoder/lookups/ipdata_co.rb
|
110
109
|
- lib/geocoder/lookups/ipgeolocation.rb
|
111
110
|
- lib/geocoder/lookups/ipinfo_io.rb
|
111
|
+
- lib/geocoder/lookups/ipinfo_io_lite.rb
|
112
112
|
- lib/geocoder/lookups/ipqualityscore.rb
|
113
113
|
- lib/geocoder/lookups/ipregistry.rb
|
114
114
|
- lib/geocoder/lookups/ipstack.rb
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- lib/geocoder/results/ipdata_co.rb
|
178
178
|
- lib/geocoder/results/ipgeolocation.rb
|
179
179
|
- lib/geocoder/results/ipinfo_io.rb
|
180
|
+
- lib/geocoder/results/ipinfo_io_lite.rb
|
180
181
|
- lib/geocoder/results/ipqualityscore.rb
|
181
182
|
- lib/geocoder/results/ipregistry.rb
|
182
183
|
- lib/geocoder/results/ipstack.rb
|
@@ -224,7 +225,6 @@ licenses:
|
|
224
225
|
metadata:
|
225
226
|
source_code_uri: https://github.com/alexreisner/geocoder
|
226
227
|
changelog_uri: https://github.com/alexreisner/geocoder/blob/master/CHANGELOG.md
|
227
|
-
post_install_message:
|
228
228
|
rdoc_options: []
|
229
229
|
require_paths:
|
230
230
|
- lib
|
@@ -239,8 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: '0'
|
241
241
|
requirements: []
|
242
|
-
rubygems_version: 3.3
|
243
|
-
signing_key:
|
242
|
+
rubygems_version: 3.6.3
|
244
243
|
specification_version: 4
|
245
244
|
summary: Complete geocoding solution for Ruby.
|
246
245
|
test_files: []
|