Exception: GoogleMapsGeocoder::GeocodingError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/google_maps_geocoder/google_maps_geocoder.rb

Overview

A geocoding error returned by Google Maps.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json = {}) ⇒ GeocodingError

Initialize a GeocodingError wrapping the JSON returned by Google Maps.


99
100
101
102
103
104
105
# File 'lib/google_maps_geocoder/google_maps_geocoder.rb', line 99

def initialize(json = {})
  @json = json
  if (message = @json['error_message'])
    Logger.new(STDERR).error(message)
  end
  super @json['status']
end

Instance Attribute Details

#jsonHash (readonly)

Returns the complete JSON response from Google Maps as a Hash.

Examples:

{
  "results" => [],
  "status" => "ZERO_RESULTS"
}

93
94
95
# File 'lib/google_maps_geocoder/google_maps_geocoder.rb', line 93

def json
  @json
end