acurley
4/9/2013 - 3:24 PM

Code to expand the Tracksys Bibl class to get the cataloging location. Useful for determining what records can be sent to DPLA. Will need

Code to expand the Tracksys Bibl class to get the cataloging location. Useful for determining what records can be sent to DPLA. Will need to add to Tracksys code base at some point.

#bibls #tracksys

#/usr/bin/ruby
class Bibl
  def get_cataloging_location
    uri = URI("#{self.physical_virgo_url}.xml")
    res = Net::HTTP.get_response(uri)
    body = res.body
    doc = Nokogiri.XML(body)
    doc.remove_namespaces!
    return doc.xpath('//datafield[@tag="040"]/subfield[@code="a"]').text()
  end
end