Module: BerkeleyLibrary::TIND::Mapping::AlmaBase

Includes:
Logging
Included in:
AlmaMultipleTIND, AlmaSingleTIND
Defined in:
lib/berkeley_library/tind/mapping/alma_base.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.collection_parameter_hashObject

Returns the value of attribute collection_parameter_hash.



14
15
16
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 14

def collection_parameter_hash
  @collection_parameter_hash
end

.is_035_from_mms_idObject

Returns the value of attribute is_035_from_mms_id.



16
17
18
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 16

def is_035_from_mms_id
  @is_035_from_mms_id
end

.is_barcodeObject

Returns the value of attribute is_barcode.



15
16
17
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 15

def is_barcode
  @is_barcode
end

Instance Method Details

#base_save(id, tind_record, file) ⇒ Object

This is mainly for testing purpose, each collection can have a function to save it's record

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 40

def base_save(id, tind_record, file)
  raise ArgumentError, "#{id} has no TIND record or not a qualified TIND record." unless tind_record

  BerkeleyLibrary::TIND::MARC::XMLWriter.open(file) do |writer|
    writer.write(tind_record)
  end
end

#base_tind_record(id, datafields, alma_record = nil) ⇒ Object

id can be: 1) Alma mms id 2) Oskicat No 3) BarCode No When alma record is nil or un-qualified, raise error Input datafields - an array of record specific datafields: for example, fft datafields, datafield 035 etc.

Raises:

  • (ArgumentError)


26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/berkeley_library/tind/mapping/alma_base.rb', line 26

def base_tind_record(id, datafields, alma_record = nil)
  marc_record = alma_record || alma_record_from(id)

  raise ArgumentError, "#{id} has no Alma record." unless marc_record

  unless Util.qualified_alma_record?(marc_record)
    raise ArgumentError,
          "#{id} belong to a host bibliographic record which should not be uploaded to TIND."
  end

  tind_record(id, marc_record, datafields)
end