lib/geocoder/results/nominatim.rb in geocoder-1.1.3 vs lib/geocoder/results/nominatim.rb in geocoder-1.1.4
- old
+ new
@@ -3,12 +3,13 @@
module Geocoder::Result
class Nominatim < Base
def poi
%w[stadium bus_stop tram_stop].each do |key|
- @data['address'][key] if @data['address'].key?(key)
+ return @data['address'][key] if @data['address'].key?(key)
end
+ return nil
end
def house_number
@data['address']['house_number']
end
@@ -67,17 +68,37 @@
def coordinates
[@data['lat'].to_f, @data['lon'].to_f]
end
+ def place_class
+ @data['class']
+ end
+
+ def place_type
+ @data['type']
+ end
+
def self.response_attributes
%w[place_id osm_type osm_id boundingbox license
polygonpoints display_name class type stadium]
end
+ def class
+ warn "DEPRECATION WARNING: The 'class' method of Geocoder::Result::Nominatim objects is deprecated and will be removed in Geocoder version 1.2.0. Please use 'place_class' instead."
+ @data['class']
+ end
+
+ def type
+ warn "DEPRECATION WARNING: The 'type' method of Geocoder::Result::Nominatim objects is deprecated and will be removed in Geocoder version 1.2.0. Please use 'place_type' instead."
+ @data['type']
+ end
+
response_attributes.each do |a|
- define_method a do
- @data[a]
+ unless method_defined?(a)
+ define_method a do
+ @data[a]
+ end
end
end
end
end