Method: GoogleMapsGeocoder#initialize
- Defined in:
- lib/google_maps_geocoder/google_maps_geocoder.rb
#initialize(address) ⇒ GoogleMapsGeocoder
Geocodes the specified address and wraps the results in a GoogleMapsGeocoder object.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/google_maps_geocoder/google_maps_geocoder.rb', line 73 def initialize(address) @json = address.is_a?(String) ? google_maps_response(address) : address status = @json && @json['status'] raise RuntimeError if status == 'OVER_QUERY_LIMIT' raise GeocodingError, @json if !@json || @json.empty? || status != 'OK' set_attributes_from_json Logger.new($stderr).info('GoogleMapsGeocoder') do "Geocoded \"#{address}\" => \"#{formatted_address}\"" end end |