Sha256: f3b96d9e597914cde1c91a871dfed3655d300fc25af46ee78e9f8111c7cdd64c

Contents?: true

Size: 1.87 KB

Versions: 17

Compression:

Stored size: 1.87 KB

Contents

module Exlibris::Primo::Source
  # == Overview
  # Aleph is an Exlibris::Primo::Holding that provides a link to Aleph
  # and a request button based on config settings in the primo_config file.
  class Aleph < Exlibris::Primo::Holding
    @attribute_aliases = Exlibris::Primo::Holding.attribute_aliases.merge({
      :aleph_doc_library => :original_source_id, :aleph_sub_library => :library,
      :aleph_collection => :collection, :aleph_call_number => :call_number,
      :aleph_doc_number => :source_record_id
    })
    @decode_variables = Exlibris::Primo::Holding.decode_variables.merge({
      :aleph_sub_library_code => { :code => :library_code }
    })

    # Overwrites Exlibris::Primo::Holding#new
    def initialize(parameters={})
      super(parameters)
      @aleph_local_base = aleph_config["local_base"] unless aleph_config.nil?
      # Aleph holdings page
      @url = "#{@source_url}/F?func=item-global&doc_library=#{aleph_doc_library}&local_base=#{@aleph_local_base}&doc_number=#{aleph_doc_number}&sub_library=#{@aleph_sub_library_code}"
      # Aleph doesn't work right so we have to push the patron to the Aleph holdings page!
      @request_url = url if requestable?
      @source_data.merge!({
        :aleph_doc_library => aleph_doc_library,
        :aleph_sub_library => aleph_sub_library,
        :aleph_sub_library_code => @aleph_sub_library_code,
        :aleph_collection => aleph_collection,
        :aleph_call_number => aleph_call_number,
        :aleph_doc_number => aleph_doc_number
      })
    end

    protected
    # Maps @source config to aleph_config for convenience.
    def aleph_config
      return @source_config
    end

    private
    def requestable?
      # Default to nothing is requestable
      return false if aleph_config.nil? or aleph_config["requestable_statuses"].nil?
      return aleph_config["requestable_statuses"].include?(@status_code) 
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
umlaut-3.0.0beta2 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0beta1 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha15 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha14 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha13 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha12 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha11 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha10 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha9 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha8 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha7 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha6 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha5 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha4 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha3 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha2 lib/exlibris/primo/source/aleph.rb
umlaut-3.0.0alpha1 lib/exlibris/primo/source/aleph.rb