berkeley_library-alma 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/alma.iml +10 -10
- data/CHANGES.md +7 -0
- data/bin/alma-mms-lookup +1 -3
- data/lib/berkeley_library/alma/barcode.rb +33 -0
- data/lib/berkeley_library/alma/module_info.rb +1 -1
- data/lib/berkeley_library/alma/record_id.rb +3 -0
- data/spec/data/C084093187-sru.xml +299 -0
- data/spec/data/{b11082434-sru.xml → b110824349-sru.xml} +0 -0
- data/spec/lib/berkeley_library/alma/barcode_spec.rb +67 -0
- data/spec/lib/berkeley_library/alma/bib_number_spec.rb +2 -1
- data/spec/lib/berkeley_library/alma/mms_id_spec.rb +3 -3
- data/spec/spec_helper.rb +6 -15
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a46868b570b1ebae5581407ffa071c63ea95a2d1c31d0a422fa89f2dd359df
|
4
|
+
data.tar.gz: 5e1106e53a671ffa3ae695cdb8ebff1b61c5f965642fbc66d8e95fd0affaabd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 801e395bcffaa40afa629c8449b0d9e2c3d2ee31751b6f09698e3531eb96db9b5c45cdb5794ea74aee1665e67c6713190161b0a6f064f20eceec5c0275ab1756
|
7
|
+
data.tar.gz: 1636e32d6c5cff6ecf7c5d4ac923463905190fb2a221a7c37b8a05da9c294d31a0790ee0d955e0b956f32ff37ba1594bf80a5f172db80d62a76baadc8d24f474
|
data/.idea/alma.iml
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-util (v0.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
25
25
|
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
26
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
27
27
|
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
28
28
|
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
29
29
|
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
@@ -38,7 +38,7 @@
|
|
38
38
|
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
39
39
|
<orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
40
40
|
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.9.
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.9.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
42
42
|
<orderEntry type="library" scope="PROVIDED" name="lograge (v0.11.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
43
43
|
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.13.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
44
44
|
<orderEntry type="library" scope="PROVIDED" name="marc (v1.1.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
@@ -66,16 +66,16 @@
|
|
66
66
|
<orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
67
67
|
<orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
68
68
|
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.5) [gem]" level="application" />
|
69
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.
|
70
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.
|
71
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.
|
72
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.
|
73
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
70
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
71
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
72
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
74
74
|
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
75
75
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.15.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
76
76
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
77
77
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
78
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-marc-spec (v0.1.
|
78
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-marc-spec (v0.1.3, RVM: ruby-2.7.5) [gem]" level="application" />
|
79
79
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
80
80
|
<orderEntry type="library" scope="PROVIDED" name="scrub_rb (v1.0.1, RVM: ruby-2.7.5) [gem]" level="application" />
|
81
81
|
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, RVM: ruby-2.7.5) [gem]" level="application" />
|
@@ -91,7 +91,7 @@
|
|
91
91
|
<orderEntry type="library" scope="PROVIDED" name="webmock (v3.14.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
92
92
|
<orderEntry type="library" scope="PROVIDED" name="webrick (v1.7.0, RVM: ruby-2.7.5) [gem]" level="application" />
|
93
93
|
<orderEntry type="library" scope="PROVIDED" name="yard (v0.9.27, RVM: ruby-2.7.5) [gem]" level="application" />
|
94
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.
|
94
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.5) [gem]" level="application" />
|
95
95
|
</component>
|
96
96
|
<component name="RModuleSettingsStorage">
|
97
97
|
<LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
|
@@ -108,7 +108,7 @@
|
|
108
108
|
</RakeTaskImpl>
|
109
109
|
<RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
|
110
110
|
<RakeTaskImpl description="Run tests, check test coverage, check code style, check for vulnerabilities, build gem" fullCommand="default" id="default" />
|
111
|
-
<RakeTaskImpl description="Build berkeley_library-alma.gemspec as berkeley_library-alma-0.0.
|
111
|
+
<RakeTaskImpl description="Build berkeley_library-alma.gemspec as berkeley_library-alma-0.0.3.gem" fullCommand="gem" id="gem" />
|
112
112
|
<RakeTaskImpl description="Run RuboCop with auto-correct, and output results to console" fullCommand="ra" id="ra" />
|
113
113
|
<RakeTaskImpl description="Run rubocop with HTML output" fullCommand="rubocop" id="rubocop" />
|
114
114
|
<RakeTaskImpl id="rubocop">
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.0.4 (15 February 2022)
|
2
|
+
|
3
|
+
- adds `BarCode` subclass of `RecordId`, to look up bibliographic records by
|
4
|
+
item barcode. Note that since barcodes have no consistent format, `BarCode`
|
5
|
+
objects need to be constructed deliberately with `BarCode#new`, not with
|
6
|
+
`RecordId#parse`.
|
7
|
+
|
1
8
|
# 0.0.3 (3 February 2022)
|
2
9
|
|
3
10
|
- use `local_field_996` instead of `other_system_number` when making SRU queries
|
data/bin/alma-mms-lookup
CHANGED
@@ -25,9 +25,7 @@ require 'berkeley_library/alma'
|
|
25
25
|
# Configuration
|
26
26
|
|
27
27
|
# Configure Alma URLs etc.
|
28
|
-
BerkeleyLibrary::Alma.
|
29
|
-
Config.default!
|
30
|
-
end
|
28
|
+
BerkeleyLibrary::Alma::Config.default!
|
31
29
|
|
32
30
|
# Set log level
|
33
31
|
BerkeleyLibrary::Logging.logger.level = Logger::Severity::WARN
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'berkeley_library/alma/record_id'
|
2
|
+
|
3
|
+
module BerkeleyLibrary
|
4
|
+
module Alma
|
5
|
+
# {RecordId} subclass representing an item barcode.
|
6
|
+
class BarCode
|
7
|
+
include RecordId
|
8
|
+
|
9
|
+
attr_reader :barcode
|
10
|
+
|
11
|
+
# Initialize a barcode. Since we purchase barcodes of varied formats and accept vendor
|
12
|
+
# barcodes as well we are only validating whether it's a string or not.
|
13
|
+
def initialize(barcode)
|
14
|
+
string?(barcode)
|
15
|
+
@barcode = barcode
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the SRU query value for this Barcode.
|
19
|
+
#
|
20
|
+
# @return [String] the Barcode query value
|
21
|
+
def sru_query_value
|
22
|
+
"alma.barcode=#{@barcode}"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def string?(barcode)
|
28
|
+
raise ArgumentError, "Barcode must be a string: #{barcode.inspect}" unless barcode.is_a?(String)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -7,7 +7,7 @@ module BerkeleyLibrary
|
|
7
7
|
SUMMARY = 'Alma/Primo utilities for the UC Berkeley Library'.freeze
|
8
8
|
DESCRIPTION = 'A gem providing Alma/Primo-related utility code for the UC Berkeley Library'.freeze
|
9
9
|
LICENSE = 'MIT'.freeze
|
10
|
-
VERSION = '0.0.
|
10
|
+
VERSION = '0.0.4'.freeze
|
11
11
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/alma'.freeze
|
12
12
|
end
|
13
13
|
end
|
@@ -22,6 +22,9 @@ module BerkeleyLibrary
|
|
22
22
|
# also accepts a {RecordId} and simply returns it, so it can be used in
|
23
23
|
# situations where it may not be clear whether the ID has already been parsed.
|
24
24
|
#
|
25
|
+
# **Note:** Use the {BarCode} class for barcodes, which don't have a consistent
|
26
|
+
# format and hence can't be auto-detected.
|
27
|
+
#
|
25
28
|
# @param id [String, RecordId] the ID to parse
|
26
29
|
# @return [RecordId, nil] an {MMSID} or {BibNumber}, depending on the type of ID,
|
27
30
|
# or `nil` if the specified `id` is neither an MMS ID nor a bib number
|
@@ -0,0 +1,299 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?><searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/">
|
2
|
+
<version>1.2</version>
|
3
|
+
<numberOfRecords>1</numberOfRecords>
|
4
|
+
<records>
|
5
|
+
<record>
|
6
|
+
<recordSchema>marcxml</recordSchema>
|
7
|
+
<recordPacking>xml</recordPacking>
|
8
|
+
<recordData>
|
9
|
+
<record xmlns="http://www.loc.gov/MARC21/slim">
|
10
|
+
<leader>03480cgm a2200781Mi 4500</leader>
|
11
|
+
<controlfield tag="001">991039354509706532</controlfield>
|
12
|
+
<controlfield tag="005">20210615124013.0</controlfield>
|
13
|
+
<controlfield tag="007">vd cvaizs</controlfield>
|
14
|
+
<controlfield tag="008">050601p19971996quc135 vleng d</controlfield>
|
15
|
+
<datafield ind1="1" ind2=" " tag="024">
|
16
|
+
<subfield code="a">774212007033</subfield>
|
17
|
+
</datafield>
|
18
|
+
<datafield ind1="4" ind2="2" tag="028">
|
19
|
+
<subfield code="a">20070</subfield>
|
20
|
+
<subfield code="b">Seville Pictures</subfield>
|
21
|
+
</datafield>
|
22
|
+
<datafield ind1=" " ind2=" " tag="035">
|
23
|
+
<subfield code="a">(OCoLC)613118288</subfield>
|
24
|
+
<subfield code="z">(OCoLC)800045975</subfield>
|
25
|
+
<subfield code="z">(OCoLC)811619021</subfield>
|
26
|
+
</datafield>
|
27
|
+
<datafield ind1=" " ind2=" " tag="035">
|
28
|
+
<subfield code="a">(CLU)8266514-ucladb-Voyager</subfield>
|
29
|
+
</datafield>
|
30
|
+
<datafield ind1=" " ind2=" " tag="035">
|
31
|
+
<subfield code="a">(EXLNZ-01UCS_NETWORK)9912724001006531</subfield>
|
32
|
+
</datafield>
|
33
|
+
<datafield ind1=" " ind2=" " tag="040">
|
34
|
+
<subfield code="a">W2U</subfield>
|
35
|
+
<subfield code="b">eng</subfield>
|
36
|
+
<subfield code="c">W2U</subfield>
|
37
|
+
<subfield code="d">OCLCF</subfield>
|
38
|
+
<subfield code="d">OCLCO</subfield>
|
39
|
+
<subfield code="d">TOH</subfield>
|
40
|
+
<subfield code="d">GK8</subfield>
|
41
|
+
<subfield code="d">OCL</subfield>
|
42
|
+
<subfield code="d">OCLCQ</subfield>
|
43
|
+
<subfield code="d">OCLCO</subfield>
|
44
|
+
<subfield code="e">rda</subfield>
|
45
|
+
<subfield code="d">CDS</subfield>
|
46
|
+
<subfield code="d">OCLCA</subfield>
|
47
|
+
</datafield>
|
48
|
+
<datafield ind1="1" ind2=" " tag="041">
|
49
|
+
<subfield code="a">eng</subfield>
|
50
|
+
<subfield code="a">fre</subfield>
|
51
|
+
</datafield>
|
52
|
+
<datafield ind1=" " ind2=" " tag="043">
|
53
|
+
<subfield code="a">n-us---</subfield>
|
54
|
+
</datafield>
|
55
|
+
<datafield ind1=" " ind2=" " tag="044">
|
56
|
+
<subfield code="a">quc</subfield>
|
57
|
+
<subfield code="a">xxu</subfield>
|
58
|
+
<subfield code="a">fr</subfield>
|
59
|
+
</datafield>
|
60
|
+
<datafield ind1=" " ind2=" " tag="046">
|
61
|
+
<subfield code="k">1996</subfield>
|
62
|
+
</datafield>
|
63
|
+
<datafield ind1="1" ind2="4" tag="050">
|
64
|
+
<subfield code="a">PN1997</subfield>
|
65
|
+
<subfield code="b">.L735 1997</subfield>
|
66
|
+
</datafield>
|
67
|
+
<datafield ind1=" " ind2=" " tag="090">
|
68
|
+
<subfield code="b">DVD 3916</subfield>
|
69
|
+
<subfield code="9">LOCAL</subfield>
|
70
|
+
</datafield>
|
71
|
+
<datafield ind1="0" ind2="0" tag="245">
|
72
|
+
<subfield code="a">Lost highway /</subfield>
|
73
|
+
<subfield code="c">October Films presents a CIBY 2000/Asymmetrical production ; a David Lynch film ; produced by Deepak Nayar, Tom Sternberg, Mahy Sweeney ; written by David Lynch & Barry Gifford ; directed by David Lynch.</subfield>
|
74
|
+
</datafield>
|
75
|
+
<datafield ind1=" " ind2=" " tag="257">
|
76
|
+
<subfield code="a">United States</subfield>
|
77
|
+
<subfield code="a">France</subfield>
|
78
|
+
<subfield code="2">naf</subfield>
|
79
|
+
</datafield>
|
80
|
+
<datafield ind1=" " ind2="1" tag="264">
|
81
|
+
<subfield code="a">[Montreal] :</subfield>
|
82
|
+
<subfield code="b">Seville Pictures,</subfield>
|
83
|
+
<subfield code="c">1997.</subfield>
|
84
|
+
</datafield>
|
85
|
+
<datafield ind1=" " ind2=" " tag="300">
|
86
|
+
<subfield code="a">1 videodisc (135 min.) :</subfield>
|
87
|
+
<subfield code="b">sound, color ;</subfield>
|
88
|
+
<subfield code="c">4 3/4 in.</subfield>
|
89
|
+
</datafield>
|
90
|
+
<datafield ind1=" " ind2=" " tag="336">
|
91
|
+
<subfield code="a">two-dimensional moving image</subfield>
|
92
|
+
<subfield code="b">tdi</subfield>
|
93
|
+
<subfield code="2">rdacontent</subfield>
|
94
|
+
</datafield>
|
95
|
+
<datafield ind1=" " ind2=" " tag="337">
|
96
|
+
<subfield code="a">video</subfield>
|
97
|
+
<subfield code="b">v</subfield>
|
98
|
+
<subfield code="2">rdamedia</subfield>
|
99
|
+
</datafield>
|
100
|
+
<datafield ind1=" " ind2=" " tag="338">
|
101
|
+
<subfield code="a">videodisc</subfield>
|
102
|
+
<subfield code="b">vd</subfield>
|
103
|
+
<subfield code="2">rdacarrier</subfield>
|
104
|
+
</datafield>
|
105
|
+
<datafield ind1=" " ind2=" " tag="344">
|
106
|
+
<subfield code="a">digital</subfield>
|
107
|
+
<subfield code="b">optical</subfield>
|
108
|
+
<subfield code="g">stereo</subfield>
|
109
|
+
</datafield>
|
110
|
+
<datafield ind1=" " ind2=" " tag="346">
|
111
|
+
<subfield code="b">NTSC</subfield>
|
112
|
+
</datafield>
|
113
|
+
<datafield ind1=" " ind2=" " tag="347">
|
114
|
+
<subfield code="a">video file</subfield>
|
115
|
+
<subfield code="b">DVD video</subfield>
|
116
|
+
<subfield code="e">Region 1</subfield>
|
117
|
+
<subfield code="2">rda</subfield>
|
118
|
+
</datafield>
|
119
|
+
<datafield ind1=" " ind2=" " tag="380">
|
120
|
+
<subfield code="a">Motion picture</subfield>
|
121
|
+
</datafield>
|
122
|
+
<datafield ind1=" " ind2=" " tag="500">
|
123
|
+
<subfield code="a">Pan and scan version.</subfield>
|
124
|
+
</datafield>
|
125
|
+
<datafield ind1=" " ind2=" " tag="500">
|
126
|
+
<subfield code="a">Special features include: theatrical trailer; interactive menus; scene selection.</subfield>
|
127
|
+
</datafield>
|
128
|
+
<datafield ind1=" " ind2=" " tag="500">
|
129
|
+
<subfield code="a">Originally released as a motion picture in 1996.</subfield>
|
130
|
+
</datafield>
|
131
|
+
<datafield ind1=" " ind2=" " tag="508">
|
132
|
+
<subfield code="a">Music, Angelo Badalamenti ; editor, Mary Sweeney ; director of photography, Peter Deming.</subfield>
|
133
|
+
</datafield>
|
134
|
+
<datafield ind1="1" ind2=" " tag="511">
|
135
|
+
<subfield code="a">Bill Pullman, Patricia Arquette, Balthazar Getty, Robert Blake, Natasha Gregson Wagner, Gary Busey, Robert Loggia.</subfield>
|
136
|
+
</datafield>
|
137
|
+
<datafield ind1=" " ind2=" " tag="520">
|
138
|
+
<subfield code="a">A successful jazz musician whose marriage is on the rocks, a man in black who threatens to expose him, a young mechanic with links to a mobster, and the mobster's moll are all riders on the lost highway, trapped in their worlds of desire, destiny and unknown destination where the truth is always a short way further down the road.</subfield>
|
139
|
+
</datafield>
|
140
|
+
<datafield ind1="8" ind2=" " tag="521">
|
141
|
+
<subfield code="a">Canadian home video rating: R.</subfield>
|
142
|
+
</datafield>
|
143
|
+
<datafield ind1=" " ind2=" " tag="538">
|
144
|
+
<subfield code="a">DVD, Dolby stereo; Region 1; NTSC.</subfield>
|
145
|
+
</datafield>
|
146
|
+
<datafield ind1=" " ind2=" " tag="546">
|
147
|
+
<subfield code="a">In English or dubbed French.</subfield>
|
148
|
+
</datafield>
|
149
|
+
<datafield ind1=" " ind2="0" tag="650">
|
150
|
+
<subfield code="a">Jazz musicians</subfield>
|
151
|
+
<subfield code="z">United States</subfield>
|
152
|
+
<subfield code="v">Drama.</subfield>
|
153
|
+
</datafield>
|
154
|
+
<datafield ind1=" " ind2="7" tag="650">
|
155
|
+
<subfield code="a">Jazz musicians.</subfield>
|
156
|
+
<subfield code="2">fast</subfield>
|
157
|
+
<subfield code="0">(OCoLC)fst00982205</subfield>
|
158
|
+
</datafield>
|
159
|
+
<datafield ind1=" " ind2="7" tag="651">
|
160
|
+
<subfield code="a">United States.</subfield>
|
161
|
+
<subfield code="2">fast</subfield>
|
162
|
+
<subfield code="0">(OCoLC)fst01204155</subfield>
|
163
|
+
</datafield>
|
164
|
+
<datafield ind1=" " ind2="7" tag="655">
|
165
|
+
<subfield code="a">Drama.</subfield>
|
166
|
+
<subfield code="2">fast</subfield>
|
167
|
+
<subfield code="0">(OCoLC)fst01423879</subfield>
|
168
|
+
</datafield>
|
169
|
+
<datafield ind1=" " ind2="7" tag="655">
|
170
|
+
<subfield code="a">Feature films.</subfield>
|
171
|
+
<subfield code="2">fast</subfield>
|
172
|
+
<subfield code="0">(OCoLC)fst01710384</subfield>
|
173
|
+
</datafield>
|
174
|
+
<datafield ind1=" " ind2="7" tag="655">
|
175
|
+
<subfield code="a">Fiction films.</subfield>
|
176
|
+
<subfield code="2">fast</subfield>
|
177
|
+
<subfield code="0">(OCoLC)fst01710264</subfield>
|
178
|
+
</datafield>
|
179
|
+
<datafield ind1=" " ind2="7" tag="655">
|
180
|
+
<subfield code="a">Feature films.</subfield>
|
181
|
+
<subfield code="2">lcgft</subfield>
|
182
|
+
</datafield>
|
183
|
+
<datafield ind1=" " ind2="7" tag="655">
|
184
|
+
<subfield code="a">Fiction films.</subfield>
|
185
|
+
<subfield code="2">lcgft</subfield>
|
186
|
+
</datafield>
|
187
|
+
<datafield ind1="1" ind2=" " tag="700">
|
188
|
+
<subfield code="a">Pullman, Bill,</subfield>
|
189
|
+
<subfield code="e">actor.</subfield>
|
190
|
+
</datafield>
|
191
|
+
<datafield ind1="1" ind2=" " tag="700">
|
192
|
+
<subfield code="a">Arquette, Patricia,</subfield>
|
193
|
+
<subfield code="d">1968-</subfield>
|
194
|
+
<subfield code="e">actor.</subfield>
|
195
|
+
</datafield>
|
196
|
+
<datafield ind1="1" ind2=" " tag="700">
|
197
|
+
<subfield code="a">Getty, Balthazar,</subfield>
|
198
|
+
<subfield code="e">actor.</subfield>
|
199
|
+
</datafield>
|
200
|
+
<datafield ind1="1" ind2=" " tag="700">
|
201
|
+
<subfield code="a">Blake, Robert,</subfield>
|
202
|
+
<subfield code="d">1933-</subfield>
|
203
|
+
<subfield code="e">actor.</subfield>
|
204
|
+
</datafield>
|
205
|
+
<datafield ind1="1" ind2=" " tag="700">
|
206
|
+
<subfield code="a">Wagner, Natasha Gregson,</subfield>
|
207
|
+
<subfield code="d">1970-</subfield>
|
208
|
+
<subfield code="e">actor.</subfield>
|
209
|
+
</datafield>
|
210
|
+
<datafield ind1="1" ind2=" " tag="700">
|
211
|
+
<subfield code="a">Busey, Gary,</subfield>
|
212
|
+
<subfield code="e">actor.</subfield>
|
213
|
+
</datafield>
|
214
|
+
<datafield ind1="1" ind2=" " tag="700">
|
215
|
+
<subfield code="a">Loggia, Robert,</subfield>
|
216
|
+
<subfield code="e">actor.</subfield>
|
217
|
+
</datafield>
|
218
|
+
<datafield ind1="1" ind2=" " tag="700">
|
219
|
+
<subfield code="a">Nayar, Deepak.</subfield>
|
220
|
+
<subfield code="e">film producer.</subfield>
|
221
|
+
</datafield>
|
222
|
+
<datafield ind1="1" ind2=" " tag="700">
|
223
|
+
<subfield code="a">Sternberg, Tom.</subfield>
|
224
|
+
<subfield code="e">film producer.</subfield>
|
225
|
+
</datafield>
|
226
|
+
<datafield ind1="1" ind2=" " tag="700">
|
227
|
+
<subfield code="a">Sweeney, Mahy.</subfield>
|
228
|
+
<subfield code="e">film produer</subfield>
|
229
|
+
</datafield>
|
230
|
+
<datafield ind1="1" ind2=" " tag="700">
|
231
|
+
<subfield code="a">Lynch, David,</subfield>
|
232
|
+
<subfield code="d">1946-</subfield>
|
233
|
+
<subfield code="e">screenwriter,</subfield>
|
234
|
+
<subfield code="e">director.</subfield>
|
235
|
+
</datafield>
|
236
|
+
<datafield ind1="1" ind2=" " tag="700">
|
237
|
+
<subfield code="a">Gifford, Barry,</subfield>
|
238
|
+
<subfield code="d">1946-</subfield>
|
239
|
+
<subfield code="e">screenwriter.</subfield>
|
240
|
+
</datafield>
|
241
|
+
<datafield ind1="2" ind2=" " tag="710">
|
242
|
+
<subfield code="a">Séville Pictures.</subfield>
|
243
|
+
</datafield>
|
244
|
+
<datafield ind1="2" ind2=" " tag="710">
|
245
|
+
<subfield code="a">Asymmetrical (Firm)</subfield>
|
246
|
+
</datafield>
|
247
|
+
<datafield ind1="2" ind2=" " tag="710">
|
248
|
+
<subfield code="a">CIBY 2000 (Firm)</subfield>
|
249
|
+
</datafield>
|
250
|
+
<datafield ind1="2" ind2=" " tag="710">
|
251
|
+
<subfield code="a">October Films.</subfield>
|
252
|
+
</datafield>
|
253
|
+
<datafield ind1="4" ind2="2" tag="956">
|
254
|
+
<subfield code="z">Credits from Internet Movie Database</subfield>
|
255
|
+
<subfield code="u">http://www.imdb.com/title/tt0116922/</subfield>
|
256
|
+
<subfield code="9">LOCAL</subfield>
|
257
|
+
</datafield>
|
258
|
+
<datafield ind1=" " ind2=" " tag="968">
|
259
|
+
<subfield code="a">Reclvl: f Addate: 050601 Addid: SMI Moddate: 090214 Modid: MRC</subfield>
|
260
|
+
<subfield code="9">LOCAL</subfield>
|
261
|
+
</datafield>
|
262
|
+
<datafield ind1=" " ind2=" " tag="996">
|
263
|
+
<subfield code="e">GLADN151847889</subfield>
|
264
|
+
<subfield code="9">LOCAL</subfield>
|
265
|
+
</datafield>
|
266
|
+
<datafield ind1=" " ind2=" " tag="996">
|
267
|
+
<subfield code="a">b111084751</subfield>
|
268
|
+
<subfield code="b">Updated: 06-14-21</subfield>
|
269
|
+
<subfield code="c">Created: 03-17-09</subfield>
|
270
|
+
<subfield code="d">CatDate: 06-01-05</subfield>
|
271
|
+
<subfield code="9">LOCAL</subfield>
|
272
|
+
</datafield>
|
273
|
+
<datafield ind1=" " ind2=" " tag="AVA">
|
274
|
+
<subfield code="0">991039354509706532</subfield>
|
275
|
+
<subfield code="8">22725145850006532</subfield>
|
276
|
+
<subfield code="a">01UCS_BER</subfield>
|
277
|
+
<subfield code="b">MRC</subfield>
|
278
|
+
<subfield code="c">Media Resources Center</subfield>
|
279
|
+
<subfield code="d">DVD 3916</subfield>
|
280
|
+
<subfield code="e">available</subfield>
|
281
|
+
<subfield code="f">1</subfield>
|
282
|
+
<subfield code="g">0</subfield>
|
283
|
+
<subfield code="i">UCB_Campus</subfield>
|
284
|
+
<subfield code="j">mc</subfield>
|
285
|
+
<subfield code="k">8</subfield>
|
286
|
+
<subfield code="p">1</subfield>
|
287
|
+
<subfield code="q">Media Resources Center</subfield>
|
288
|
+
</datafield>
|
289
|
+
</record>
|
290
|
+
</recordData>
|
291
|
+
<recordIdentifier>991039354509706532</recordIdentifier>
|
292
|
+
<recordPosition>1</recordPosition>
|
293
|
+
</record>
|
294
|
+
</records>
|
295
|
+
<extraResponseData xmlns:xb="http://www.exlibris.com/repository/search/xmlbeans/">
|
296
|
+
<xb:exact>true</xb:exact>
|
297
|
+
<xb:responseDate>2022-02-10T12:40:32-0800</xb:responseDate>
|
298
|
+
</extraResponseData>
|
299
|
+
</searchRetrieveResponse>
|
File without changes
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BerkeleyLibrary
|
4
|
+
module Alma
|
5
|
+
describe BarCode do
|
6
|
+
before(:each) do
|
7
|
+
BerkeleyLibrary::Alma.configure do
|
8
|
+
Config.alma_sru_host = 'berkeley.alma.exlibrisgroup.com'
|
9
|
+
Config.alma_institution_code = '01UCS_BER'
|
10
|
+
Config.alma_primo_host = 'search.library.berkeley.edu'
|
11
|
+
Config.alma_permalink_key = 'iqob43'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:each) do
|
16
|
+
BerkeleyLibrary::Alma::Config.send(:clear!)
|
17
|
+
end
|
18
|
+
|
19
|
+
describe :new do
|
20
|
+
bad_barcode = 1234
|
21
|
+
it "raises an error for input that's not an string" do
|
22
|
+
expect { BarCode.new(bad_barcode) }.to raise_error(ArgumentError), "#{bad_barcode}: No error raised for #{bad_barcode}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe :marc_record do
|
27
|
+
it 'returns the MARC record' do
|
28
|
+
barcode_id = 'C084093187'
|
29
|
+
stub_sru_request('alma.barcode', barcode_id)
|
30
|
+
|
31
|
+
barcode = BerkeleyLibrary::Alma::BarCode.new(barcode_id)
|
32
|
+
marc_record = barcode.get_marc_record
|
33
|
+
expect(marc_record).not_to be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns nil for an empty response' do
|
37
|
+
empty_sru_response = <<~XML.strip
|
38
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
39
|
+
<searchRetrieveResponse>
|
40
|
+
<version>1.2</version>
|
41
|
+
<numberOfRecords>0</numberOfRecords>
|
42
|
+
<records/>
|
43
|
+
</searchRetrieveResponse>
|
44
|
+
XML
|
45
|
+
|
46
|
+
barcode_id = '991054360089706532doesntexist'
|
47
|
+
sru_url = sru_url_for('alma.barcode', barcode_id)
|
48
|
+
stub_request(:get, sru_url).to_return(status: 200, body: empty_sru_response)
|
49
|
+
|
50
|
+
barcode = BarCode.new(barcode_id)
|
51
|
+
marc_record = barcode.get_marc_record
|
52
|
+
expect(marc_record).to be_nil
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'returns nil for an HTTP error response' do
|
56
|
+
barcode_id = '991054360089706532934j3h'
|
57
|
+
sru_url = sru_url_for('alma.barcode', barcode_id)
|
58
|
+
stub_request(:get, sru_url).to_return(status: 404)
|
59
|
+
|
60
|
+
barcode = BarCode.new(barcode_id)
|
61
|
+
marc_record = barcode.get_marc_record
|
62
|
+
expect(marc_record).to be_nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -90,7 +90,8 @@ module BerkeleyLibrary
|
|
90
90
|
describe :marc_record do
|
91
91
|
it 'returns the MARC record' do
|
92
92
|
raw_bib_number = 'b11082434'
|
93
|
-
|
93
|
+
full_bib_number = 'b110824349'
|
94
|
+
stub_sru_request('alma.local_field_996', full_bib_number)
|
94
95
|
|
95
96
|
bib_number = BibNumber.new(raw_bib_number)
|
96
97
|
marc_record = bib_number.get_marc_record
|
@@ -58,7 +58,7 @@ module BerkeleyLibrary
|
|
58
58
|
describe :marc_record do
|
59
59
|
it 'returns the MARC record' do
|
60
60
|
raw_mms_id = '991054360089706532'
|
61
|
-
stub_sru_request(raw_mms_id)
|
61
|
+
stub_sru_request('alma.mms_id', raw_mms_id)
|
62
62
|
|
63
63
|
mms_id = MMSID.new(raw_mms_id)
|
64
64
|
marc_record = mms_id.get_marc_record
|
@@ -77,7 +77,7 @@ module BerkeleyLibrary
|
|
77
77
|
XML
|
78
78
|
|
79
79
|
raw_mms_id = '991054360089706532'
|
80
|
-
sru_url = sru_url_for(raw_mms_id)
|
80
|
+
sru_url = sru_url_for('alma.mms_id', raw_mms_id)
|
81
81
|
stub_request(:get, sru_url).to_return(status: 200, body: empty_sru_response)
|
82
82
|
|
83
83
|
mms_id = MMSID.new(raw_mms_id)
|
@@ -87,7 +87,7 @@ module BerkeleyLibrary
|
|
87
87
|
|
88
88
|
it 'returns nil for an HTTP error response' do
|
89
89
|
raw_mms_id = '991054360089706532'
|
90
|
-
sru_url = sru_url_for(raw_mms_id)
|
90
|
+
sru_url = sru_url_for('alma.mms_id', raw_mms_id)
|
91
91
|
stub_request(:get, sru_url).to_return(status: 404)
|
92
92
|
|
93
93
|
mms_id = MMSID.new(raw_mms_id)
|
data/spec/spec_helper.rb
CHANGED
@@ -31,26 +31,17 @@ require 'berkeley_library/alma'
|
|
31
31
|
# ------------------------------------------------------------
|
32
32
|
# Utility methods
|
33
33
|
|
34
|
-
def sru_url_for(
|
35
|
-
|
36
|
-
|
37
|
-
if BerkeleyLibrary::Alma::Constants::ALMA_RECORD_RE =~ record_id
|
38
|
-
"#{sru_url_base}alma.mms_id%3D#{record_id}"
|
39
|
-
elsif BerkeleyLibrary::Alma::Constants::MILLENNIUM_RECORD_RE =~ record_id
|
40
|
-
full_bib_number = BerkeleyLibrary::Alma::BibNumber.new(record_id).to_s
|
41
|
-
"#{sru_url_base}alma.local_field_996%3D#{full_bib_number}"
|
42
|
-
else
|
43
|
-
raise ArgumentError, "Unknown record ID type: #{record_id}"
|
44
|
-
end
|
34
|
+
def sru_url_for(index, value)
|
35
|
+
"https://berkeley.alma.exlibrisgroup.com/view/sru/01UCS_BER?version=1.2&operation=searchRetrieve&query=#{index}%3D#{value}"
|
45
36
|
end
|
46
37
|
|
47
38
|
def sru_data_path_for(record_id)
|
48
39
|
"spec/data/#{record_id}-sru.xml"
|
49
40
|
end
|
50
41
|
|
51
|
-
def stub_sru_request(
|
52
|
-
|
53
|
-
marc_xml_path = sru_data_path_for(
|
42
|
+
def stub_sru_request(index, value)
|
43
|
+
sru_url_ = sru_url_for(index, value)
|
44
|
+
marc_xml_path = sru_data_path_for(value)
|
54
45
|
|
55
|
-
stub_request(:get,
|
46
|
+
stub_request(:get, sru_url_).to_return(status: 200, body: File.read(marc_xml_path))
|
56
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkeley_library-alma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: berkeley_library-logging
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- bin/alma-mms-lookup
|
270
270
|
- docker-compose.yml
|
271
271
|
- lib/berkeley_library/alma.rb
|
272
|
+
- lib/berkeley_library/alma/barcode.rb
|
272
273
|
- lib/berkeley_library/alma/bib_number.rb
|
273
274
|
- lib/berkeley_library/alma/config.rb
|
274
275
|
- lib/berkeley_library/alma/constants.rb
|
@@ -282,8 +283,10 @@ files:
|
|
282
283
|
- rakelib/spec.rake
|
283
284
|
- spec/.rubocop.yml
|
284
285
|
- spec/data/991054360089706532-sru.xml
|
285
|
-
- spec/data/
|
286
|
+
- spec/data/C084093187-sru.xml
|
287
|
+
- spec/data/b110824349-sru.xml
|
286
288
|
- spec/data/bibs_with_check_digits.txt
|
289
|
+
- spec/lib/berkeley_library/alma/barcode_spec.rb
|
287
290
|
- spec/lib/berkeley_library/alma/bib_number_spec.rb
|
288
291
|
- spec/lib/berkeley_library/alma/config_spec.rb
|
289
292
|
- spec/lib/berkeley_library/alma/mms_id_spec.rb
|
@@ -315,8 +318,10 @@ summary: Alma/Primo utilities for the UC Berkeley Library
|
|
315
318
|
test_files:
|
316
319
|
- spec/.rubocop.yml
|
317
320
|
- spec/data/991054360089706532-sru.xml
|
318
|
-
- spec/data/
|
321
|
+
- spec/data/C084093187-sru.xml
|
322
|
+
- spec/data/b110824349-sru.xml
|
319
323
|
- spec/data/bibs_with_check_digits.txt
|
324
|
+
- spec/lib/berkeley_library/alma/barcode_spec.rb
|
320
325
|
- spec/lib/berkeley_library/alma/bib_number_spec.rb
|
321
326
|
- spec/lib/berkeley_library/alma/config_spec.rb
|
322
327
|
- spec/lib/berkeley_library/alma/mms_id_spec.rb
|