Class: Geocoder::Lookup::MelissaStreet

Inherits:
Base
  • Object
show all
Defined in:
lib/geocoder/lookups/melissa_street.rb

Instance Method Summary collapse

Methods inherited from Base

#cache, #handle, #initialize, #map_link_url, #query_url, #required_api_key_parts, #search, #supported_protocols

Constructor Details

This class inherits a constructor from Geocoder::Lookup::Base

Instance Method Details

#nameObject



7
8
9
# File 'lib/geocoder/lookups/melissa_street.rb', line 7

def name
  "MelissaStreet"
end

#results(query) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/geocoder/lookups/melissa_street.rb', line 11

def results(query)
  return [] unless doc = fetch_data(query)

  if doc["TransmissionResults"] == "GE05"
    raise_error(Geocoder::InvalidApiKey) ||
      Geocoder.log(:warn, "Melissa service error: invalid API key.")
  end

  return doc["Records"]
end