geocoder 1.3.0 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7a2b3e33175d20be86a8eaf6c74d6178bc71991
4
- data.tar.gz: d0dc03b689fbc43f16ae9395c7f743a3dd7876bd
3
+ metadata.gz: d18d22b519d25e7d3214aa1e52f39d1578a15aa4
4
+ data.tar.gz: 82e49a050c93eeb2033f27d961bb354706e9208f
5
5
  SHA512:
6
- metadata.gz: cb9f5c459af278bd20438a714475dece555b72222c34eab8c8fb61f6ddfc695848d330e9b84f366c8d67e5f253bda7d5e61020ab46382f8fbb40c8b7a9a58e82
7
- data.tar.gz: ca02902240f5287a570ee05b0bc3b0300708200108b09543763e761ad1f0a2371355ef651471cdf96ce5cdabf104a39aedb04ef684e4f02aa3023911c27d7c4a
6
+ metadata.gz: 6bee51b01c6fe33f9c2acfd174802908f311724684643de8831414a437015219cfa4ea33266062e09564afa7cff2f54778c02a8f8fa43287692568ce86662fbc
7
+ data.tar.gz: df0f94753763aa06902bd1bf25182e6b468595a4ed2f0d77767b2130af08c06b60a8b1fdffc5e0bccd1bdddae83ed305d3f6e9c914e87eb69e1142fc5f8e689e
@@ -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.3.1 (2016 Feb 20)
7
+ -------------------
8
+ * Warn about upcoming discontinuation of :yahoo lookup (thanks github.com/galiat).
9
+ * Add #viewport method to results that return viewport data (thanks github.com/lime).
10
+
6
11
  1.3.0 (2016 Jan 31)
7
12
  -------------------
8
13
  * Lazy load lookups to reduce memory footprint (thanks github.com/TrangPham).
data/README.md CHANGED
@@ -435,6 +435,7 @@ The [Google Places Details API](https://developers.google.com/places/documentati
435
435
  * **Limitations**: "If your application displays Places API data on a page or view that does not also display a Google Map, you must show a "Powered by Google" logo with that data."
436
436
 
437
437
  #### Yahoo BOSS (`:yahoo`)
438
+ **Warning - [this API will be discontinued on March 31.](https://developer.yahoo.com/boss/placefinder/)**
438
439
 
439
440
  * **API key**: requires OAuth consumer key and secret (set `Geocoder.configure(:api_key => [key, secret])`)
440
441
  * **Key signup**: http://developer.yahoo.com/boss/geo/
@@ -17,6 +17,10 @@ module Geocoder
17
17
  if !options.nil?
18
18
  Configuration.instance.configure(options)
19
19
  end
20
+
21
+ if config.lookup == :yahoo
22
+ Geocoder.log(:warn, "Yahoo BOSS Placefinder API will be discontinued March 31, 2016.")
23
+ end
20
24
  end
21
25
 
22
26
  ##
@@ -28,6 +28,7 @@ module Geocoder::Lookup
28
28
  private # ---------------------------------------------------------------
29
29
 
30
30
  def results(query)
31
+ Geocoder.log(:warn, "Yahoo BOSS Placefinder API will be discontinued March 31, 2016.")
31
32
  return [] unless doc = fetch_data(query)
32
33
  doc = doc['bossresponse']
33
34
  if doc['responsecode'].to_i == 200
@@ -35,6 +35,10 @@ module Geocoder::Result
35
35
  @data['address']
36
36
  end
37
37
 
38
+ def viewport
39
+ @data['bbox']
40
+ end
41
+
38
42
  def self.response_attributes
39
43
  %w[bbox name confidence entityType]
40
44
  end
@@ -46,6 +46,14 @@ module Geocoder::Result
46
46
  [geometry["y"], geometry["x"]]
47
47
  end
48
48
 
49
+ def viewport
50
+ north = attributes['Ymax']
51
+ south = attributes['Ymin']
52
+ east = attributes['Xmax']
53
+ west = attributes['Xmin']
54
+ [south, west, north, east]
55
+ end
56
+
49
57
  private
50
58
 
51
59
  def attributes
@@ -128,5 +128,12 @@ module Geocoder::Result
128
128
  def place_id
129
129
  @data['place_id']
130
130
  end
131
+
132
+ def viewport
133
+ viewport = geometry['viewport'] || fail
134
+ south, west = %w(lat lng).map { |c| viewport['southwest'][c] }
135
+ north, east = %w(lat lng).map { |c| viewport['northeast'][c] }
136
+ [south, west, north, east]
137
+ end
131
138
  end
132
139
  end
@@ -53,6 +53,15 @@ module Geocoder::Result
53
53
  address_data['Country']
54
54
  end
55
55
 
56
+ def viewport
57
+ map_view = data['Location']['MapView'] || fail
58
+ south = map_view['BottomRight']['Latitude']
59
+ west = map_view['TopLeft']['Longitude']
60
+ north = map_view['TopLeft']['Latitude']
61
+ east = map_view['BottomRight']['Longitude']
62
+ [south, west, north, east]
63
+ end
64
+
56
65
  private # ----------------------------------------------------------------
57
66
 
58
67
  def address_data
@@ -78,6 +78,11 @@ module Geocoder::Result
78
78
  @data['type']
79
79
  end
80
80
 
81
+ def viewport
82
+ south, north, west, east = @data['boundingbox'].map(&:to_f)
83
+ [south, west, north, east]
84
+ end
85
+
81
86
  def self.response_attributes
82
87
  %w[place_id osm_type osm_id boundingbox license
83
88
  polygonpoints display_name class type stadium]
@@ -66,6 +66,14 @@ module Geocoder::Result
66
66
  def coordinates
67
67
  [@data['geometry']['lat'].to_f, @data['geometry']['lng'].to_f]
68
68
  end
69
+
70
+ def viewport
71
+ bounds = @data['bounds'] || fail
72
+ south, west = %w(lat lng).map { |i| bounds['southwest'][i] }
73
+ north, east = %w(lat lng).map { |i| bounds['northeast'][i] }
74
+ [south, west, north, east]
75
+ end
76
+
69
77
  def self.response_attributes
70
78
  %w[boundingbox license
71
79
  formatted stadium]
@@ -53,6 +53,15 @@ module Geocoder::Result
53
53
  address_data['Country']
54
54
  end
55
55
 
56
+ def viewport
57
+ map_view = data['Location']['MapView'] || fail
58
+ south = map_view['BottomRight']['Latitude']
59
+ west = map_view['TopLeft']['Longitude']
60
+ north = map_view['TopLeft']['Latitude']
61
+ east = map_view['BottomRight']['Longitude']
62
+ [south, west, north, east]
63
+ end
64
+
56
65
  private # ----------------------------------------------------------------
57
66
 
58
67
  def address_data
@@ -35,6 +35,11 @@ module Geocoder::Result
35
35
  @data['hash']
36
36
  end
37
37
 
38
+ def viewport
39
+ boundingbox = @data['boundingbox'] || fail
40
+ %w(south west north east).map{ |i| boundingbox[i].to_f }
41
+ end
42
+
38
43
  def self.response_attributes
39
44
  %w[quality offsetlat offsetlon radius boundingbox name
40
45
  line1 line2 line3 line4 cross house street xstreet unittype unit
@@ -68,6 +68,13 @@ module Geocoder::Result
68
68
  @data['GeoObject']['metaDataProperty']['GeocoderMetaData']['precision']
69
69
  end
70
70
 
71
+ def viewport
72
+ envelope = @data['GeoObject']['boundedBy']['Envelope'] || fail
73
+ east, north = envelope['upperCorner'].split(' ').map(&:to_f)
74
+ west, south = envelope['lowerCorner'].split(' ').map(&:to_f)
75
+ [south, west, north, east]
76
+ end
77
+
71
78
  private # ----------------------------------------------------------------
72
79
 
73
80
  def address_details
@@ -1,3 +1,3 @@
1
1
  module Geocoder
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
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.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Reisner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-31 00:00:00.000000000 Z
11
+ date: 2016-02-20 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,