libholdings 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +99 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/libholdings.rb +26 -0
- data/lib/libholdings/version.rb +3 -0
- data/libholdings.gemspec +27 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 35d0a68a85b8e5ab82e49b397fd44a50b8c5e44d
|
4
|
+
data.tar.gz: bd924e804a7c88a7943e5747e7b6d0c1f7015755
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e1fb3daddffa75ab1208d21f21eb6c591d2d5867637a6886e0791fae33fd1dac02a9921b6fcba83dfb431ea3efed5ea965d7b1773818fcc7acb0637e5eea0df6
|
7
|
+
data.tar.gz: 5516989e23e75f9f03474505cee248146c0222973b817c8139be96f9225f816d3ec5165d06e201104a91b8e8deff182743dfbbc7c591a464d0ca2e3093e27791
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/.idea
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# Libholdings
|
2
|
+
|
3
|
+
This gem uses the Z39.50 library ruby-zoom to get item holdings information from an ILS.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'libholdings'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install libholdings
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'libholdings'
|
26
|
+
|
27
|
+
r = Libholdings::Request.new
|
28
|
+
r.server = 'miami.alma.exlibrisgroup.com'
|
29
|
+
r.port = 1921
|
30
|
+
r.database_name = '01UOML_INST'
|
31
|
+
r.record_id = '9910311107102976'
|
32
|
+
|
33
|
+
holdings = Libholdings::info(r)
|
34
|
+
```
|
35
|
+
|
36
|
+
You'll get back a hash with the holdings information:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
{
|
40
|
+
"holdings" => {
|
41
|
+
"holding" => [{
|
42
|
+
"encodingLevel" => "3", "localLocation" => "Richter Library", "shelvingLocation" => "Special Format Microfilm Monograph", "callNumber" => "Mfilm 7397", "volumes" => {
|
43
|
+
"volume" => {
|
44
|
+
"enumeration" => " ", "chronology" => " "
|
45
|
+
}
|
46
|
+
}, "circulations" => {
|
47
|
+
"circulation" => {
|
48
|
+
"availableNow" => {
|
49
|
+
"value" => "1"
|
50
|
+
}, "renewable" => {
|
51
|
+
"value" => "0"
|
52
|
+
}, "onHold" => {
|
53
|
+
"value" => "0"
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}, {
|
58
|
+
"encodingLevel" => "3", "localLocation" => "Special Collections", "shelvingLocation" => "Microform", "callNumber" => "Mfilm 7397", "volumes" => {
|
59
|
+
"volume" => {
|
60
|
+
"enumeration" => " ", "chronology" => " "
|
61
|
+
}
|
62
|
+
}, "circulations" => {
|
63
|
+
"circulation" => {
|
64
|
+
"availableNow" => {
|
65
|
+
"value" => "1"
|
66
|
+
}, "renewable" => {
|
67
|
+
"value" => "0"
|
68
|
+
}, "onHold" => {
|
69
|
+
"value" => "0"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}]
|
74
|
+
}
|
75
|
+
}
|
76
|
+
```
|
77
|
+
|
78
|
+
If there isn't any information for the item you are searching for you'll get a standard response:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
{
|
82
|
+
"holdings" => {
|
83
|
+
"holding" => {
|
84
|
+
"localLocation" => "Unknown", "callNumber" => "Unknown ", "publicNote" => "DUE"
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
```
|
89
|
+
|
90
|
+
# Tests
|
91
|
+
To run the tests:
|
92
|
+
|
93
|
+
```bash
|
94
|
+
rake test
|
95
|
+
```
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "libholdings"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/libholdings.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "libholdings/version"
|
2
|
+
require "zoom"
|
3
|
+
require "nokogiri"
|
4
|
+
require "active_support/all"
|
5
|
+
module Libholdings
|
6
|
+
|
7
|
+
class Request
|
8
|
+
attr_accessor :server, :port, :database_name, :record_id
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.info(request)
|
12
|
+
ZOOM::Connection.open(request.server, request.port) do |conn|
|
13
|
+
conn.database_name = request.database_name
|
14
|
+
conn.preferred_record_syntax = 'OPAC'
|
15
|
+
begin
|
16
|
+
rset = conn.search('@attr 1=1007 ' + request.record_id)
|
17
|
+
xml_from_catalog = Nokogiri::XML(rset[0].xml)
|
18
|
+
item_info = Hash.from_xml(xml_from_catalog.xpath('//holdings').to_s)
|
19
|
+
return item_info
|
20
|
+
rescue
|
21
|
+
item_info = {"holdings" => {"holding" => {"localLocation" => "Unknown", "callNumber" => "Unknown ", "publicNote" => "DUE"}}}
|
22
|
+
return item_info
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/libholdings.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'libholdings/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "libholdings"
|
8
|
+
spec.version = Libholdings::VERSION
|
9
|
+
spec.licenses = ["Apache-2.0"]
|
10
|
+
spec.authors = ["Jamie Little"]
|
11
|
+
spec.email = ["j.little@miami.edu"]
|
12
|
+
spec.summary = "A gem for getting item holdings data from a z39.50 server"
|
13
|
+
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "zoom"
|
25
|
+
spec.add_runtime_dependency "nokogiri"
|
26
|
+
spec.add_runtime_dependency "activesupport"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libholdings
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jamie Little
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: zoom
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- j.little@miami.edu
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- bin/console
|
110
|
+
- bin/setup
|
111
|
+
- lib/libholdings.rb
|
112
|
+
- lib/libholdings/version.rb
|
113
|
+
- libholdings.gemspec
|
114
|
+
homepage:
|
115
|
+
licenses:
|
116
|
+
- Apache-2.0
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 2.5.1
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: A gem for getting item holdings data from a z39.50 server
|
138
|
+
test_files: []
|