Class: Exlibris::Primo::Source::Aleph

Inherits:
Holding
  • Object
show all
Defined in:
lib/exlibris/primo/source/aleph.rb

Overview

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

Instance Attribute Summary

Attributes inherited from Holding

#author, #availability_status_code, #availlibrary, #call_number, #collection, #coverage, #display_type, #ils_api_id, #institution_code, #library_code, #notes, #original_id, #original_source_id, #record_id, #source_class, #source_data, #source_id, #source_record_id, #subfields, #title

Instance Method Summary collapse

Methods inherited from Holding

#availability_status, defaults, #expand, #institution, #library, #merge!, #source_config, #to_h, #to_source

Methods included from WriteAttributes

#write_attributes

Methods included from Config::Attributes

#availability_statuses, #base_url, #config, #facet_collections, #facet_labels, #facet_resource_types, #facet_top_level, #institution, #institutions, #libraries, #sources

Constructor Details

#initialize(attributes = {}) ⇒ Aleph

Overwrites Exlibris::Primo::Holding#new



24
25
26
27
28
29
30
31
32
33
34
# 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

Instance Method Details

#aleph_rest_urlObject

Aleph base rest url from config.



42
43
44
# 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_urlObject

Aleph base url from config.



37
38
39
# File 'lib/exlibris/primo/source/aleph.rb', line 37

def aleph_url
  @aleph_url ||= source_config["base_url"] unless source_config.nil?
end

#local_baseObject

Aleph local base from config.



47
48
49
# File 'lib/exlibris/primo/source/aleph.rb', line 47

def local_base
  @local_base ||= source_config["local_base"] unless source_config.nil?
end

#request_urlObject

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



57
58
59
# File 'lib/exlibris/primo/source/aleph.rb', line 57

def request_url
  @request_url = url if requestable?
end

#rest_urlObject

Aleph record rest url



62
63
64
# File 'lib/exlibris/primo/source/aleph.rb', line 62

def rest_url
  @rest_url ||= "#{aleph_rest_url}/record/#{ils_api_id}"
end

#sub_libraryObject

Aleph sub library



72
73
74
# File 'lib/exlibris/primo/source/aleph.rb', line 72

def sub_library
  library
end

#sub_library_codeObject

Aleph sub library code from config based on library code



67
68
69
# 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

#urlObject

Aleph holdings screen



52
53
54
# 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