Skip to content
Snippets Groups Projects
Commit e05f5c15 authored by Paul Millar's avatar Paul Millar
Browse files

Remove arrow anti-pattern

parent 08b36634
No related branches found
No related tags found
No related merge requests found
Pipeline #474573 passed with warnings
......@@ -9,26 +9,27 @@ def check_oai_pmh_endpoint(endpoint_url)
queryIdentify_url = endpoint_url + "?verb=Identify"
begin
response = HTTParty.head(queryIdentify_url)
if response.success?
response = HTTParty.get(queryIdentify_url)
if !(response.body.nil? || response.body.empty?)
xml_response = Nokogiri::XML(response.body)
oai_pmh_tag = xml_response.at_xpath('//*[name()="OAI-PMH"]')
if oai_pmh_tag
puts " Endpoint is active."
return "Active"
else
puts " Error: Identify response has no OAI-PMH tag."
return "Error"
end
else
puts " Error: Identify response is empty."
return "Error"
end
else
if !response.success?
puts " Error: Identify response has HTTP status code #{response.code}."
return "Error"
end
response = HTTParty.get(queryIdentify_url)
if response.body.nil? || response.body.empty?
puts " Error: Identify response is empty."
return "Error"
end
xml_response = Nokogiri::XML(response.body)
oai_pmh_tag = xml_response.at_xpath('//*[name()="OAI-PMH"]')
if !oai_pmh_tag
puts " Error: Identify response has no OAI-PMH tag."
return "Error"
end
puts " Endpoint is active."
return "Active"
rescue StandardError => e
puts " Error: Identify request failed: #{e.message}"
return "Error"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment