class Geocoder::Lookup::GooglePlacesDetails

def base_query_url(query)

def base_query_url(query)
  "#{protocol}://maps.googleapis.com/maps/api/place/details/json?"
end

def fields(query)

def fields(query)
  if query.options.has_key?(:fields)
    return format_fields(query.options[:fields])
  end
  if configuration.has_key?(:fields)
    return format_fields(configuration[:fields])
  end
  nil  # use Google Places defaults
end

def format_fields(*fields)

def format_fields(*fields)
  flattened = fields.flatten.compact
  return if flattened.empty?
  flattened.join(',')
end

def name

def name
  "Google Places Details"
end

def query_url_google_params(query)

def query_url_google_params(query)
  {
    placeid: query.text,
    fields: fields(query),
    language: query.language || configuration.language
  }
end

def required_api_key_parts

def required_api_key_parts
  ["key"]
end

def result_root_attr

def result_root_attr
  'result'
end

def results(query)

def results(query)
  result = super(query)
  return [result] unless result.is_a? Array
  result
end

def supported_protocols

def supported_protocols
  [:https]
end