lib/exlibris/primo/eshelf.rb in exlibris-primo-0.1.1 vs lib/exlibris/primo/eshelf.rb in exlibris-primo-0.1.4
- old
+ new
@@ -6,17 +6,18 @@
# in a hash with setup parameters, a user_id and an institution.
# Valid setup parameters include:
# :base_url, :resolver_base_url, :vid, :config
#
# == Examples of usage
- # Exlibris::Primo::EShelf.new({ :base_url => "http://primo.institution.edu", :vid => "VID", :resolver_base_url => "http://sfx.institution.edu"} , "USER_ID", "PRIMO").count
+ # Exlibris::Primo::EShelf.new({ :base_url => "http://primo.institution.edu", :vid => "VID", :resolver_base_url => "http://resolver.institution.edu"} , "USER_ID", "PRIMO").count
# Exlibris::Primo::EShelf.new(@eshelf_setup, @valid_user_id, @valid_institute).basket_id
class EShelf
#Namespaces
SEAR_NS = {'sear' => 'http://www.exlibrisgroup.com/xsd/jaguar/search'}
PRIM_NS = {'prim' => 'http://www.exlibris.com/primo/xsd/primoeshelffolder'}
+ PRIM_BIB_NS = {'bib' => 'http://www.exlibrisgroup.com/xsd/primo/primo_nm_bib'}
def initialize(setup, user_id, institution)
@base_url = setup[:base_url]
raise_required_setup_parameter_error :base_url if @base_url.nil?
@resolver_base_url = setup[:resolver_base_url]
@@ -47,11 +48,11 @@
end
# Fetch all records from user's Eshelf as an array of Primo Record objects
def records
eshelf.search("//sear:DOC", SEAR_NS).each { |doc|
- @records.push(Record.new({ :base_url => @base_url, :resolver_base_url => @resolver_base_url, :vid => @vid, :record => doc.at("//xmlns:record", doc.namespaces), :institution => @institution }))
+ @records.push(Record.new({ :base_url => @base_url, :resolver_base_url => @resolver_base_url, :vid => @vid, :record => doc.at("//bib:record", PRIM_BIB_NS), :institution => @institution }))
} if @records.empty?
return @records
end
# Fetch default basket id from eshelf structure web service call
@@ -75,6 +76,6 @@
def raise_required_setup_parameter_error(parameter)
raise ArgumentError.new("Error in #{self.class}. Missing required setup parameter: #{parameter}.")
end
end
end
-end
+end
\ No newline at end of file