lib/relaton_iho/iho_bibliography.rb in relaton-iho-1.13.0 vs lib/relaton_iho/iho_bibliography.rb in relaton-iho-1.14.0

- old
+ new

@@ -13,15 +13,12 @@ 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" - yaml = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("3.1.0.pre1") - YAML.safe_load(resp.body, permitted_classes: [Date]) - else - YAML.safe_load(resp.body, [Date]) - end + yaml = RelatonBib.parse_yaml resp.body, [Date] hash = HashConverter.hash_to_bib yaml + hash[:fetched] = Date.today.to_s 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,