class GdsApi::Imminence

def self.extract_location_hash(location)

def self.extract_location_hash(location)
  # Deal with all known location formats:
  #   Old style: [latitude, longitude]; empty array for no location
  #   New style: hash with keys "longitude", "latitude"; nil for no location
  case location
  when Array
    {"latitude" => location[0], "longitude" => location[1]}
  when Hash
    location
  when nil
    {"latitude" => nil, "longitude" => nil}
  end
end