Class: BerkeleyLibrary::AV::Metadata::Source
- Inherits:
-
TypesafeEnum::Base
- Object
- TypesafeEnum::Base
- BerkeleyLibrary::AV::Metadata::Source
show all
- Includes:
- Constants
- Defined in:
- lib/berkeley_library/av/metadata/source.rb
Constant Summary
collapse
- LINK_TEXT_ALMA =
'View library catalog record.'.freeze
- LINK_TEXT_TIND =
'View record in Digital Collections.'.freeze
Constants included
from Constants
Constants::ALMA_RECORD_RE, Constants::MILLENNIUM_RECORD_RE, Constants::OCLC_RECORD_RE, Constants::SUBFIELD_CODES_TRACKS, Constants::SUBFIELD_CODE_ALMA_BIB_NUMBER, Constants::SUBFIELD_CODE_DURATION, Constants::SUBFIELD_CODE_LINKTEXT, Constants::SUBFIELD_CODE_PATH, Constants::SUBFIELD_CODE_TIND_BIB_NUMBER, Constants::SUBFIELD_CODE_TITLE, Constants::SUBFIELD_CODE_URI, Constants::TAG_ALMA_MIGRATION_INFO, Constants::TAG_LINK_FIELD, Constants::TAG_TIND_CATALOG_ID, Constants::TAG_TIND_ID, Constants::TAG_TITLE_FIELD, Constants::TAG_TRACK_FIELD, Constants::TAG_TRANSCRIPT_FIELD, Constants::UNKNOWN_TITLE
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.for_record_id(record_id) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/berkeley_library/av/metadata/source.rb', line 23
def for_record_id(record_id)
id_type = RecordId.ensure_record_id(record_id).type
return ALMA if [RecordId::Type::ALMA, RecordId::Type::MILLENNIUM].include?(id_type)
TIND
end
|
Instance Method Details
#catalog_link_text ⇒ Object
35
36
37
38
|
# File 'lib/berkeley_library/av/metadata/source.rb', line 35
def catalog_link_text
return LINK_TEXT_ALMA if self == ALMA
return LINK_TEXT_TIND if self == TIND
end
|
#display_uri_for(metadata) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/berkeley_library/av/metadata/source.rb', line 40
def display_uri_for(metadata)
record_id = canonical_record_id_for(metadata)
raise ArgumentError, "#{self}: unable to determine record ID from metadata #{metadata.inspect}" unless record_id
_display_uri_for(record_id)
end
|
#find_bib_number(metadata) ⇒ Object
47
48
49
50
|
# File 'lib/berkeley_library/av/metadata/source.rb', line 47
def find_bib_number(metadata)
return alma_bib_number(metadata.marc_record) if self == Source::ALMA
return tind_bib_number(metadata.marc_record) if self == Source::TIND
end
|
#name ⇒ Object
31
32
33
|
# File 'lib/berkeley_library/av/metadata/source.rb', line 31
def name
key.to_s
end
|