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.

Parameters:

  • (defaults to: {})

    Google Maps’ JSON response



119
120
121
122
123
124
125
# File 'lib/google_maps_geocoder/google_maps_geocoder.rb', line 119

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"
}

Returns:

  • Google Maps’ JSON response



113
114
115
# File 'lib/google_maps_geocoder/google_maps_geocoder.rb', line 113

def json
  @json
end