geocoder 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of geocoder might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -2
- data/lib/geocoder/lookup.rb +1 -0
- data/lib/geocoder/lookups/postcodes_io.rb +28 -0
- data/lib/geocoder/results/geoip2.rb +4 -0
- data/lib/geocoder/results/postcodes_io.rb +40 -0
- data/lib/geocoder/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81f22c128760be6a86ad082425c44dc7629b4dea
|
4
|
+
data.tar.gz: 49b92dcdc5b815522f9ff85cc1cfbe7b347659fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f78f3018bc36b0012d17891a1f11ee903b805b217ddee7382cc8aee396f6852ef802b38e8dbf4e16b5de2db358fbfedfc5a6c8a272831def08015a121d368d
|
7
|
+
data.tar.gz: ce136edcfad4e4e199d04e27c621e55806d9966a98c918ce9a1b8e847c4eb137770bdfb03daa09c57db38acd0a0a2169831fc42fae64c397ab16dbf32af0cc4a
|
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.4.9 (2018 May 27)
|
7
|
+
-------------------
|
8
|
+
* Fix regression in :geoip2 lookup.
|
9
|
+
* Add support for Postcodes.io lookup (thanks github.com/sledge909).
|
10
|
+
|
6
11
|
1.4.8 (2018 May 21)
|
7
12
|
-------------------
|
8
13
|
* Change default IP address lookup from :freegeoip to :ipinfo_io.
|
data/README.md
CHANGED
@@ -703,7 +703,18 @@ Data Science Toolkit provides an API whose response format is like Google's but
|
|
703
703
|
* **Terms of Service**: http://wiki.geoportail.lu/doku.php?id=en:mcg_1
|
704
704
|
* **Limitations**: ?
|
705
705
|
|
706
|
-
####
|
706
|
+
#### Postcodes.io (`:postcodes_io`)
|
707
|
+
|
708
|
+
* **API key**: none
|
709
|
+
* **Quota**: ?
|
710
|
+
* **Region**: UK
|
711
|
+
* **SSL support**: yes
|
712
|
+
* **Languages**: English
|
713
|
+
* **Documentation**: http://postcodes.io/docs
|
714
|
+
* **Terms of Service**: ?
|
715
|
+
* **Limitations**: UK postcodes only
|
716
|
+
|
717
|
+
#### PostcodeAnywhere UK (`:postcode_anywhere_uk`)
|
707
718
|
|
708
719
|
This uses the PostcodeAnywhere UK Geocode service, this will geocode any string from UK postcode, placename, point of interest or location.
|
709
720
|
|
@@ -712,7 +723,7 @@ This uses the PostcodeAnywhere UK Geocode service, this will geocode any string
|
|
712
723
|
* **Region**: UK
|
713
724
|
* **SSL support**: yes
|
714
725
|
* **Languages**: English
|
715
|
-
* **Documentation**:
|
726
|
+
* **Documentation**: http://www.postcodeanywhere.co.uk/Support/WebService/Geocoding/UK/Geocode/2/
|
716
727
|
* **Terms of Service**: ?
|
717
728
|
* **Limitations**: ?
|
718
729
|
* **Notes**: To use PostcodeAnywhere you must include an API key: `Geocoder.configure(:lookup => :postcode_anywhere_uk, :api_key => 'your_api_key')`.
|
data/lib/geocoder/lookup.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'geocoder/lookups/base'
|
2
|
+
require 'geocoder/results/postcodes_io'
|
3
|
+
|
4
|
+
module Geocoder::Lookup
|
5
|
+
class PostcodesIo < Base
|
6
|
+
def name
|
7
|
+
'Postcodes.io'
|
8
|
+
end
|
9
|
+
|
10
|
+
def query_url(query)
|
11
|
+
str = query.sanitized_text.gsub(/\s/, '')
|
12
|
+
format('%s://%s/%s', protocol, 'api.postcodes.io/postcodes', str)
|
13
|
+
end
|
14
|
+
|
15
|
+
def supported_protocols
|
16
|
+
[:https]
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def results(query)
|
22
|
+
response = fetch_data(query)
|
23
|
+
return [] if response.nil? || response['status'] != 200 || response.empty?
|
24
|
+
|
25
|
+
[response['result']]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'geocoder/results/base'
|
2
|
+
|
3
|
+
module Geocoder::Result
|
4
|
+
class PostcodesIo < Base
|
5
|
+
|
6
|
+
def coordinates
|
7
|
+
[@data['latitude'].to_f, @data['longitude'].to_f]
|
8
|
+
end
|
9
|
+
|
10
|
+
def quality
|
11
|
+
@data['quality']
|
12
|
+
end
|
13
|
+
|
14
|
+
def postal_code
|
15
|
+
@data['postcode']
|
16
|
+
end
|
17
|
+
alias address postal_code
|
18
|
+
|
19
|
+
def city
|
20
|
+
@data['admin_ward']
|
21
|
+
end
|
22
|
+
|
23
|
+
def county
|
24
|
+
@data['admin_county']
|
25
|
+
end
|
26
|
+
alias state county
|
27
|
+
|
28
|
+
def state_code
|
29
|
+
@data['codes']['admin_county']
|
30
|
+
end
|
31
|
+
|
32
|
+
def country
|
33
|
+
'United Kingdom'
|
34
|
+
end
|
35
|
+
|
36
|
+
def country_code
|
37
|
+
'UK'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/geocoder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Reisner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides object geocoding (by street or IP address), reverse geocoding
|
14
14
|
(coordinates to street address), distance queries for ActiveRecord and Mongoid,
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/geocoder/lookups/pickpoint.rb
|
89
89
|
- lib/geocoder/lookups/pointpin.rb
|
90
90
|
- lib/geocoder/lookups/postcode_anywhere_uk.rb
|
91
|
+
- lib/geocoder/lookups/postcodes_io.rb
|
91
92
|
- lib/geocoder/lookups/smarty_streets.rb
|
92
93
|
- lib/geocoder/lookups/telize.rb
|
93
94
|
- lib/geocoder/lookups/test.rb
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- lib/geocoder/results/pickpoint.rb
|
141
142
|
- lib/geocoder/results/pointpin.rb
|
142
143
|
- lib/geocoder/results/postcode_anywhere_uk.rb
|
144
|
+
- lib/geocoder/results/postcodes_io.rb
|
143
145
|
- lib/geocoder/results/smarty_streets.rb
|
144
146
|
- lib/geocoder/results/telize.rb
|
145
147
|
- lib/geocoder/results/test.rb
|