Sha256: 1d227957b1267c444cab2fa2acac4cf1e034b679137212c9af08fdecbe86d288

Contents?: true

Size: 1.76 KB

Versions: 4

Compression:

Stored size: 1.76 KB

Contents

#!/usr/bin/env ruby

begin
  # This should work if (1) the gem is installed, or
  # (2) we're in development and used `bundle exec`
  require 'berkeley_library/tind'
  require 'berkeley_library/alma'
rescue LoadError
  # If we're in development, `require 'bundler/setup'`
  # is roughly equivalent to `bundle exec`
  require 'bundler/setup'
  require 'berkeley_library/tind'
  require 'berkeley_library/alma'
end

def setup
  # set collection name information
  BerkeleyLibrary::TIND::Mapping::AlmaBase.collection_parameter_hash = {
    '336' => ['Image'],
    '852' => ['East Asian Library'],
    '980' => ['pre_1912'],
    '982' => ['Pre 1912 Chinese Materials - short name', 'Pre 1912 Chinese Materials - long name'],
    '991' => []
  }

  # flag: set it to true if using barcode getting Alma record; default is false
  # BerkeleyLibrary::TIND::Mapping::AlmaBase.is_barcode = true
end

def additional_tind_fields
  txt = 'v001_0064'
  url = 'https://digitalassets.lib.berkeley.edu/pre1912ChineseMaterials/ucb/ready/991032333019706532/991032333019706532_v001_0064.jpg'
  fft = BerkeleyLibrary::TIND::Mapping::TindField.f_fft(url, txt)
  datafields = [fft]

  f_035 = BerkeleyLibrary::TIND::Mapping::TindField.f_035_from_alma_id('pre_1912', '991085821143406532')
  datafields << f_035
end

###########  Use this, when creating multiple TIND records from a single Alma record  ############
alma_id = '991085821143406532'
# alma_id = '99108582114340653'  # a bad alma_id
# alma_id = '991084606989706532' # Host histrical record

setup

BerkeleyLibrary::Alma::Config.default!
alma_multiple_tind = BerkeleyLibrary::TIND::Mapping::AlmaMultipleTIND.new(alma_id)
tind_record = alma_multiple_tind.record(additional_tind_fields)
alma_multiple_tind.save_tind_record_to_file(tind_record, 'tmp/multiple.xml')

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 bin/alma-multiple-tind
berkeley_library-tind-0.7.1 bin/alma-multiple-tind
berkeley_library-tind-0.7.0 bin/alma-multiple-tind
berkeley_library-tind-0.6.0 bin/alma-multiple-tind