lib/relaton_iho/iho_bibliography.rb in relaton-iho-1.3.2 vs lib/relaton_iho/iho_bibliography.rb in relaton-iho-1.4.0

- old
+ new

@@ -8,21 +8,21 @@ class << self # @param text [String] # @return [RelatonIho::IhoBibliographicItem] def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize warn "[relaton-iho] (\"#{text}\") fetching..." - ref = text.sub(/^IHO\s/, "").downcase + ref = text.sub(/^IHO\s/, "").downcase.sub /^([[:alpha:]]+)(\d+)/, '\1-\2' uri = URI("#{ENDPOINT}#{ref}.yaml") resp = Net::HTTP.get_response uri return unless resp.code == "200" hash = HashConverter.hash_to_bib YAML.safe_load(resp.body, [Date]) item = IhoBibliographicItem.new hash warn "[relaton-iho] (\"#{text}\") found #{item.docidentifier.first.id}" item rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, - Net::ProtocolError, Net::ReadTimeout, OpenSSL::SSL::SSLError, + Net::ProtocolError, Net::ReadTimeout, # OpenSSL::SSL::SSLError, Errno::ETIMEDOUT => e raise RelatonBib::RequestError, "Could not access #{uri}: #{e.message}" end # @param ref [String] the IHO standard Code to look up (e..g "IHO B-11")