class Geocoder::Lookup::Azure
def base_query_url(query)
def base_query_url(query) host = 'atlas.microsoft.com/search/address' if query.reverse_geocode? "#{protocol}://#{host}/reverse/json?" else "#{protocol}://#{host}/json?" end end
def name
def name 'Azure' end
def query_url_params(query)
def query_url_params(query) params = { 'api-version' => 1.0, 'language' => query.options[:language] || 'en', 'limit' => configuration[:limit] || 10, 'query' => query.sanitized_text, 'subscription-key' => configuration.api_key } params.merge(super) end
def required_api_key_parts
def required_api_key_parts ['api_key'] end
def results(query)
def results(query) return [] unless (doc = fetch_data(query)) return doc if doc['error'] if doc['results']&.any? doc['results'] elsif doc['addresses']&.any? doc['addresses'] else [] end end
def supported_protocols
def supported_protocols [:https] end