Method: Rubydora::DigitalObject#datastreams
- Defined in:
- lib/rubydora/digital_object.rb
#datastreams ⇒ Array<Rubydora::Datastream> Also known as: datastream
List of datastreams
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/rubydora/digital_object.rb', line 150 def datastreams @datastreams ||= begin h = Hash.new { |h,k| h[k] = datastream_object_for(k) } begin = { :pid => pid, :profiles => 'true' } [:asOfDateTime] = asOfDateTime if asOfDateTime datastreams_xml = repository.datastreams() # pre-3.6, the profiles parm will be ignored datastreams_xml.gsub! '<objectDatastreams', '<objectDatastreams xmlns="http://www.fedora.info/definitions/1/0/access/"' unless datastreams_xml =~ /xmlns=/ doc = Nokogiri::XML(datastreams_xml) doc.xpath('//access:datastream', {'access' => "http://www.fedora.info/definitions/1/0/access/"}).each do |ds| h[ds['dsid']] = datastream_object_for ds['dsid'] end # post-3.6, full ds profiles will be returned doc.xpath('//access:datastreamProfile', {'access' => "http://www.fedora.info/definitions/1/0/access/"}).each do |ds| # n.b. that the dsID attribute has a different name in the profile response h[ds['dsID']] = datastream_object_for(ds['dsID'], {:profile => ProfileParser.hash_datastream_profile_node(ds)}) end rescue RestClient::ResourceNotFound end h end end |