Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
754 B

11 months ago
class UprnAddressSpikeController < ApplicationController
def show
if params[:uprn] || params[:address]
if params[:uprn]
uprn = params[:uprn]
service = UprnClient.new(uprn)
service.call
if service.error.present?
@error = "no match"
else
@address_returned = UprnDataPresenter.new(service.result)
end
elsif params[:address]
address = params[:address]
service = AddressClient.new(address)
service.call
if service.error.present?
@error = "no match"
else
@addresses_returned = service.result&.map { |r| AddressDataPresenter.new(r) }
end
end
end
render "content/uprn_address_spike"
end
end