2018-10-15 23:35:51 +02:00
|
|
|
class AddressController < ApplicationController
|
2016-06-09 12:08:18 +02:00
|
|
|
def get
|
|
|
|
request = params[:request]
|
|
|
|
|
2018-10-15 21:53:52 +02:00
|
|
|
json = ApiAdresse::AddressAdapter.new(request).get_suggestions.map do |value|
|
2018-01-15 19:22:02 +01:00
|
|
|
{ label: value }
|
|
|
|
end.to_json
|
|
|
|
|
|
|
|
render json: json
|
2016-06-09 12:08:18 +02:00
|
|
|
end
|
2016-06-09 16:28:44 +02:00
|
|
|
|
|
|
|
def get_address_point
|
2018-10-15 21:48:17 +02:00
|
|
|
request = params[:request]
|
|
|
|
|
|
|
|
point = ApiAdresse::PointAdapter.new(request).geocode
|
2016-06-09 16:28:44 +02:00
|
|
|
|
2018-01-11 19:04:39 +01:00
|
|
|
if point.present?
|
2016-06-09 16:28:44 +02:00
|
|
|
lon = point.x.to_s
|
|
|
|
lat = point.y.to_s
|
|
|
|
end
|
|
|
|
|
2018-01-16 13:34:24 +01:00
|
|
|
render json: { lon: lon, lat: lat, zoom: '14', dossier_id: params[:dossier_id] }
|
2016-06-09 16:28:44 +02:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|