|
|
@ -20,11 +20,11 @@ class UprnClient |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def result |
|
|
|
def result |
|
|
|
@result ||= begin |
|
|
|
@result ||= if response.code == 200 |
|
|
|
parsed_response = JSON.parse(response.body) |
|
|
|
parsed_response = JSON.parse(response.body) |
|
|
|
parsed_response.dig("results", 0, "DPA") || parsed_response.dig("results", 0, "LPI") |
|
|
|
parsed_response.dig("results", 0, "DPA") || parsed_response.dig("results", 0, "LPI") |
|
|
|
rescue JSON::ParserError => e |
|
|
|
else |
|
|
|
Rails.logger.error("Failed to parse JSON response: #{e.message}") |
|
|
|
Rails.logger.error("Unexpected response code: #{response.code}") |
|
|
|
nil |
|
|
|
nil |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|