class Exlibris::Primo::Source::Aleph

Overview

Exlibris::Primo::Source::Aleph is an Exlibris::Primo::Holding that provides a link to Aleph and a request link based on config settings in the Primo config file.

Example Config

source_id:
  base_url: http://aleph.library.edu
  rest_url: http://aleph.library.edu:1891/rest-dlf
  local_base: LOCAL01
  requestable_statuses:
    - available
    - request_ill
  sub_library_codes:
    PrimoLibrary1: AlephSubLibrary1
    PrimoLibrary2: AlephSubLibrary1
    PrimoLibrary3: AlephSubLibrary2

Public Class Methods

new(attributes={}) click to toggle source

Overwrites Exlibris::Primo::Holding#new

Calls superclass method Exlibris::Primo::Holding::new
# File lib/exlibris/primo/source/aleph.rb, line 24
def initialize(attributes={})
  super attributes
  @source_data.merge!({
    :doc_library => original_source_id,
    :sub_library_code => sub_library_code,
    :sub_library => sub_library,
    :collection => collection,
    :call_number => call_number,
    :doc_number => source_record_id,
    :rest_api_id => ils_api_id })
end

Public Instance Methods

aleph_rest_url() click to toggle source

Aleph base rest url from config.

# File lib/exlibris/primo/source/aleph.rb, line 42
def aleph_rest_url
  @aleph_rest_url ||= source_config["rest_url"] unless source_config.nil?
end
aleph_url() click to toggle source

Aleph base url from config.

# File lib/exlibris/primo/source/aleph.rb, line 37
def aleph_url
  @aleph_url ||= source_config["base_url"] unless source_config.nil?
end
local_base() click to toggle source

Aleph local base from config.

# File lib/exlibris/primo/source/aleph.rb, line 47
def local_base
  @local_base ||= source_config["local_base"] unless source_config.nil?
end
request_url() click to toggle source

Aleph doesn't work right so we have to push the patron to the Aleph holdings page!

# File lib/exlibris/primo/source/aleph.rb, line 57
def request_url
  @request_url = url if requestable?
end
rest_url() click to toggle source

Aleph record rest url

# File lib/exlibris/primo/source/aleph.rb, line 62
def rest_url
  @rest_url ||= "#{aleph_rest_url}/record/#{ils_api_id}"
end
sub_library() click to toggle source

Aleph sub library

# File lib/exlibris/primo/source/aleph.rb, line 72
def sub_library
  library
end
sub_library_code() click to toggle source

Aleph sub library code from config based on library code

# File lib/exlibris/primo/source/aleph.rb, line 67
def sub_library_code
  @sub_library_code ||= sub_library_codes[library_code] unless sub_library_codes.nil?
end
url() click to toggle source

Aleph holdings screen

# File lib/exlibris/primo/source/aleph.rb, line 52
def url
  @url ||= "#{aleph_url}/F?func=item-global&doc_library=#{original_source_id}&local_base=#{local_base}&doc_number=#{source_record_id}&sub_library=#{sub_library_code}"
end

Private Instance Methods

requestable?() click to toggle source

Is this holding requestable?

# File lib/exlibris/primo/source/aleph.rb, line 89
def requestable?
  (requestable_statuses.nil?) ? false : requestable_statuses.include?(@availability_status_code)
end
requestable_statuses() click to toggle source

Aleph requestable statuses from config

# File lib/exlibris/primo/source/aleph.rb, line 83
def requestable_statuses
  source_config["requestable_statuses"] unless source_config.nil?
end
sub_library_codes() click to toggle source

Aleph sub library codes from config to map from Primo libraries to Aleph sub libraries

# File lib/exlibris/primo/source/aleph.rb, line 77
def sub_library_codes
  @sub_library_codes ||= source_config["sub_library_codes"] unless source_config.nil?
end