class BerkeleyLibrary::Alma::MMSID
{RecordId} subclass representing an Alma
MMS ID. Note that only bibliographic records (prefix ‘99`) are supported.
See [Record Numbers](knowledge.exlibrisgroup.com/Alma/Product_Documentation/010Alma_Online_Help_(English)/Metadata_Management/005Introduction_to_Metadata_Management/020Record_Numbers) in the Alma
documentation.
Constants
- INST_CODE_UCB
The four-digit institition code for UC berkeley
- UNIQ_PREFIX_UCB
The UC Berkeley prefix to the unique part of the MMS ID
Attributes
@return [String] the four-digit institution code
@return [String] the MMS ID, as a string
@return [String] the type prefix part of the MMS ID. Note that only bibliographic records
(prefix `99`) are supported.
@return [String] the unique part of the record number
Public Class Methods
Initializes a new {MMSID} from a string.
@param id [String] the ID string @raise [ArgumentError] if the specified string is not an Alma
bibliographic MMS ID.
# File lib/berkeley_library/alma/mms_id.rb, line 47 def initialize(id) @mms_id, @type_prefix, @unique_part, @institution = parse_mms_id(id) end
Public Instance Methods
Whether this ID appears to be for a Berkeley record, based on its institution code and on whether the unique part of the ID starts with the expected prefix for Berkeley.
@return [TrueClass, FalseClass] true if this ID appears to be for a Berkeley record, false otherwise
# File lib/berkeley_library/alma/mms_id.rb, line 80 def berkeley? unique_part.start_with?(UNIQ_PREFIX_UCB) && institution == INST_CODE_UCB end
Returns the permalink URI for this MMS ID. Requires {Config#alma_permalink_base_uri} to be set.
@return [URI] the permalink URI.
# File lib/berkeley_library/alma/mms_id.rb, line 65 def permalink_uri URIs.append(permalink_base_uri, "alma#{mms_id}") end
Returns the SRU query value for this MMS ID.
@return [String] the SRU query value
# File lib/berkeley_library/alma/mms_id.rb, line 72 def sru_query_value "alma.mms_id=#{mms_id}" end
Returns the MMS ID as a string.
@return [String] the MMS ID
# File lib/berkeley_library/alma/mms_id.rb, line 57 def to_s mms_id end
Private Instance Methods
# File lib/berkeley_library/alma/mms_id.rb, line 93 def parse_mms_id(id) raise ArgumentError, "Not an MMS ID: #{id.inspect}" unless (md = ALMA_RECORD_RE.match(id.to_s)) md.to_a end
Private methods
# File lib/berkeley_library/alma/mms_id.rb, line 89 def permalink_base_uri Config.alma_permalink_base_uri end