Exlibris::Primo

<img src=“https://secure.travis-ci.org/scotdalton/exlibris-primo.png” alt=“Build Status” /> <img src=“https://gemnasium.com/scotdalton/exlibris-primo.png” alt=“Dependency Status” /> <img src=“https://codeclimate.com/badge.png” />

Exlibris::Primo offers a set of libraries for interacting with the ExLibris Primo APIs.

Exlibris::Primo::Searcher

The Exlibris::Primo::Searcher class performs a search against Primo for given parameters and exposes the set of holdings (availibrary elements), rsrcs, tocs, and related links (addlink elements).

Example of Exlibris::Primo::Searcher in action

setup = {
  :base_url => "http://primo.institution.edu", :vid => "VID", :institution => "INSTITUTION",
  :config => {
    "libraries" => 
      {"library_code1" => "library_display_1", "library_code2" => "library_display_1"}, 
    "statuses" => 
      {"status_code1" => "status_display_1", "status_code2" => "status_display_2"}}
}
params = {
   :primo_id => primo_id,
   :isbn => isbn, 
   :issn => issn,
   :title => title,
   :author => author,
   :genre => genre
}
searcher = Exlibris::Primo::Searcher.new(setup, params)
count = search.count
holdings = searcher.holdings
rsrcs = searcher.rsrcs
tocs = searcher.tocs
related_links = searcher.related_links

Exlibris::Primo::Record

The Exlibris::Primo::Record class creates an object representation of a Primo record for given parameters and exposes the record’s primary attributes (format, title, author, url, openurl) and full record Xml (raw_xml) as instance variables.

Example of Exlibris::Primo::Record in action

setup = { 
  :base_url => "http://primo.institution.edu", 
  :resolver_base_url => "http://resolver.institution.edu", 
  :vid => "VID", 
  :institution => "DEFAULT", 
  :record_id => "PrimoRecordId" 
}
record = Exlibris::Primo::Record.new(setup)
raw_xml = record.instance_variable_get(:@raw_xml)
record_hash = record.to_h
openurl = record_hash["openurl"]

Exlibris::Primo::EShelf

The Exlibris::Primo::EShelf class provides methods for reading a given user’s Primo eshelf and eshelf structure as well as adding and removing records.

Example of Exlibris::Primo::EShelf in action

setup = { 
  :base_url => "http://primo.institution.edu", 
  :vid => "VID", 
  :resolver_base_url => "http://resolver.institution.edu"
}
eshelf = Exlibris::Primo::EShelf.new(setup, "USER_ID", "PRIMO")
records = eshelf.records
p records.first.class
record_count = eshelf.count
basket_id = eshelf.basket_id
eshelf.add_records(["PrimoRecordId","PrimoRecordId2"], basket_id)