Module: MQReader::ClassMethods

Defined in:
lib/mq_reader/mq_reader.rb

Instance Method Summary collapse

Instance Method Details

#geocode_address(address, options = {}) ⇒ Object

Geocode a address. This method takes an address as a string and performs the geocoding against mapquest’s api. The options hash can have any option accepted by the mapquest geocoding api. The options key can be written ruby-style with underscores, they are transformed to mapquests format. If in the future a new option is added to the api by mapquest, you can add it in the options hash and it will work.

Parameters:

  • address (String)

    to geocode

  • options (Hash) (defaults to: {})

    for mapquest geocoding service



18
19
20
21
22
# File 'lib/mq_reader/mq_reader.rb', line 18

def geocode_address(address, options = {})
  path = GEOCODING_PATH
  params = ({ location: CGI::escape(address) }.merge!(to_mapquest_notation(options) ))
  MQGeocode.new(send_get_to_mapquest(path, params))
end