Skip to content

Commit

Permalink
Merge pull request #3 from scotdalton/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
scotdalton committed Mar 5, 2013
2 parents 4033c9a + c3a3366 commit c2904d7
Show file tree
Hide file tree
Showing 103 changed files with 123,479 additions and 1,613 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
.bundle/
log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
test/dummy/log/aleph/*.log
test/dummy/tmp/
test/dummy/.sass-cache
Gemfile.lock
exlibris-aleph-*.gem
test/dummy/config/aleph

config/aleph
coverage
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
language: ruby
rvm:
- 1.8.7
- 1.9.3
- jruby-18mode # JRuby (1.8)
- jruby-19mode # JRuby (1.9)
15 changes: 1 addition & 14 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,4 @@ source "http://rubygems.org"
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec

group :development, :test do
# jquery-rails is used by the dummy application
gem "jquery-rails"

platforms :jruby do
gem 'jruby-openssl'
gem 'activerecord-jdbcsqlite3-adapter', :require => 'jdbc-sqlite3', :require =>'arjdbc'
end

platforms :ruby do
gem 'sqlite3'
end
end
gem "coveralls", "~> 0.6.0", require: false, :group => :test
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Exlibris::Aleph
[![Gem Version](https://badge.fury.io/rb/exlibris-aleph.png)](http://badge.fury.io/rb/exlibris-aleph)
[![Build Status](https://api.travis-ci.org/scotdalton/exlibris-aleph.png?branch=master)](https://travis-ci.org/scotdalton/exlibris-aleph)
[![Dependency Status](https://gemnasium.com/scotdalton/exlibris-aleph.png)](https://gemnasium.com/scotdalton/exlibris-aleph)
[![Code Climate](https://codeclimate.com/github/scotdalton/exlibris-aleph.png)](https://codeclimate.com/github/scotdalton/exlibris-aleph)
[![Coverage Status](https://coveralls.io/repos/scotdalton/exlibris-aleph/badge.png?branch=master)](https://coveralls.io/r/scotdalton/exlibris-aleph)

Exlibris::Aleph offers a set of libraries for interacting with the ExLibris Aleph ILS.

## Exlibris::Aleph::Patron
Exlibris::Aleph::Patron provides access to the Aleph Patron REST API.

### Example of Exlibris::Aleph::Patron in action
patron =
Exlibris::Aleph::Patron.
new(patron_id: "S0M31D", rest_url: "http://aleph.institution.edu")
patron.address # Returns a Hash of the of patron's address
patron.loans # Returns an Array of institution Hashes, each containing an Array of the patron's loans for that institution
patron.renew_loans # Renews all loans
patron.renew_loans("ADM5000000001") # Renews loan of item 00000001 in ADM50
patron.place_hold("ADM50", "SBLIB", "00000001", "00000001", {:pickup_location => "SBLIB"}) # Places hold on the specified item for pickup at SBLIB

## Exlibris::Aleph::Record
Provides access to the Aleph Record REST API.

### Example of Exlibris::Aleph::Record in action
record =
Exlibris::Aleph::Record.
new(bib_library: "ADM50", record_id: "00000001", rest_url: "http://aleph.institution.edu")
record.bib # Returns a MARC::Record with bibliographic metadata
record.holdings # Returns and Array of MARC::Records respresenting the record's holdings
record.items # Returns and Array of Hashes representing the record's items

## Exlibris::Aleph.configure
Exlibris::Aleph can be configured at startup in an initializer.

# Placed this in an initializer.
Exlibris::Aleph.configure { |c|
c.base_url = "http://aleph.institution.edu"
c.tab_path = "/mnt/aleph_tab"
c.adms = ["ADM50", "ADM51"]
}

It can also read from a yaml file.

# Placed this in an initializer.
Exlibris::Aleph.configure { |c|
config.load_yaml File.expand_path("#{File.dirname(__FILE__)}/../config/aleph.yml", __FILE__)
}

## Exlibris::Aleph::TabHelper
Exlibris::Aleph::TabHelper provides a way to access the various tab settings for patrons, patron\_permissions, items, item_permission (both by item status and by item processing status), collections and pickup locations. It also provides convenience methods for common tasks like getting the pickup location for a given combination of item status, item process status and borrower status or getting an item's web text. Support a

### Example of Exlibris::Aleph::TabHelper in action
# Placed this in an initializer.
Exlibris::Aleph.configure { |c|
c.tab_path = "/mnt/aleph_tab"
c.adms = ["ADM50", "ADM51"]
}

# Rake task to refresh the config yml files
rake exlibris:aleph:refresh

# Get an instance of TabHelper
helper = Exlibris::Aleph::TabHelper.instance
helper.sub_library_text("SBLIB") # Returns display text for the give code
helper.sub_library_adm("SBLIB") # Returns ADM for the give code
helper.item_pickup_locations({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :bor_status => "51"}) # Returns the pickup locations for the given parameters
helper.collection_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :collection_code => "MAIN"}) # Returns the collection display text for the give parameters
helper.item_web_text({:adm_library_code => "ADM50", :item_process_status => "Item Process Status"}) # Returns the web text for the given parameters
helper.item_web_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :item_process_status_code => "DP"}) # Returns the web text for the given parameters

### Configure irrelevant sub libraries for TabHelper
To configure the gem to ignore sub libraries pulled from Aleph but not relevant to working with permissions call the following setter with an array of sub library Aleph codes.

# Place this in an initializer to replace the current irrelevant sub libraries.
Exlibris::Aleph.configure { |c|
c.irrelevant_sub_libraries = ["IRRLIB1", "IRRLIB2"]
}

## Exlibris::Aleph::BorAuth
Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.

### Example of Exlibris::Aleph::BorAuth in action
bor_auth =
Exlibris::Aleph::BorAuth.
new("http://aleph.institution.edu", "ADM50", "SBLIB", "N", "S0M31D", "V3R1F1C@T10N")
permissions = bor_auth.permissions # Return a Hash of permissions based on the Exlibris::Aleph::BorAuth instance

67 changes: 0 additions & 67 deletions README.rdoc

This file was deleted.

6 changes: 2 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end




Bundler::GemHelper.install_tasks

require 'rake/testtask'
Expand All @@ -34,5 +31,6 @@ Rake::TestTask.new(:test) do |t|
t.verbose = false
end


task :default => :test

require 'exlibris-aleph'
19 changes: 12 additions & 7 deletions exlibris-aleph.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ Gem::Specification.new do |s|
s.summary = "Library to work with Exlibris' Aleph ILS."
s.description = "Library to handle Exlibris' Aleph ILS."

s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]

s.add_dependency "rails", "~> 3.2.0"
s.add_dependency "nokogiri"
s.add_dependency "httparty"

s.add_development_dependency "vcr"
s.add_development_dependency "webmock"
s.add_dependency "rake", "~> 10.0.3"
s.add_dependency "require_all", "~> 1.2.1"
s.add_dependency "nokogiri", "~> 1.5.6"
s.add_dependency "httparty", "~> 0.10.2"
# Leverage ActiveSupport core extensions
s.add_dependency "activesupport", "~> 3.2.12"
# ActiveSupport core extensions use Builder
s.add_dependency "builder", "~> 3.2.0"
s.add_dependency "marc", "~> 0.5.0"
s.add_development_dependency "vcr", "~> 2.4.0"
s.add_development_dependency "webmock", "~> 1.9.0"
end
29 changes: 8 additions & 21 deletions lib/exlibris-aleph.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
PATH = File.dirname(__FILE__) + "/exlibris/aleph/"
[
'config/config_base',
'config/config_by_sub_library',
'config/pc_tab_exp_field_extended',
'config/tab15_by_item_process_status',
'config/tab15_by_item_status',
'config/tab31',
'config/tab37',
'config/tab40',
'config/tab_sub_library',
'config/tab_www_item_desc',
'tab_helper',
'rest',
'record',
'patron',
'bor_auth'
].each do |library|
require PATH + library
end
require PATH + 'railtie' if defined?(Rails)
# Leverage ActiveSupport core extensions
require 'active_support/core_ext'
require 'active_support/builder'
require 'marc'
require "require_all"
require_all "#{File.dirname(__FILE__)}/exlibris/"
# Install tasks
Exlibris::Aleph::TaskInstaller.install_tasks
13 changes: 13 additions & 0 deletions lib/exlibris/aleph.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Exlibris
module Aleph
class << self
def configure
yield config
end

def config
@config ||= Config
end
end
end
end
28 changes: 28 additions & 0 deletions lib/exlibris/aleph/abstract.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module Exlibris
module Aleph
#
# If a class is abstract, it can't be instantiated.
#
module Abstract
def self.included(klass)
klass.class_eval do
extend ClassAttributes
end
end

module ClassAttributes
def abstract
@abstract ||= false
end
alias :abstract? :abstract

attr_writer :abstract
protected :abstract=
end

def initialize *args
raise NotImplementedError.new("Cannot instantiate #{self.class.name}. It is abstract") if self.class.abstract?
end
end
end
end
45 changes: 0 additions & 45 deletions lib/exlibris/aleph/bor_auth.rb

This file was deleted.

Loading

0 comments on commit c2904d7

Please sign in to comment.