berkeley_library-location 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +12 -0
- data/lib/berkeley_library/location/location_result.rb +4 -4
- data/lib/berkeley_library/location/module_info.rb +1 -1
- data/lib/berkeley_library/location/world_cat/oclc_auth.rb +18 -10
- data/lib/berkeley_library/location/world_cat/symbols.rb +4 -4
- data/lib/berkeley_library/location/xlsx_reader.rb +2 -0
- data/lib/berkeley_library/location/xlsx_writer.rb +19 -19
- metadata +22 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5b728d789ffd4c43c031e74e6e529994c5da2f0c68091f7d2dcca48c7cb92b63
|
|
4
|
+
data.tar.gz: ecbfee1a9349510009ff7d9a8700e71a3c31633ca362475b9910ff25ca5fb1aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 84b9c151fbe29c5f11902bb8c0c8aa9d5495e55fdd5da873fc0445a6750896b4d6ae2360674cdece0fc8f7dd24d7c6597c2a388cde3c265216acf52ea07a6f96
|
|
7
|
+
data.tar.gz: 6bef93e48408b413c96d10ed43c59d63a38691668bd4f96f7e9ebbc126a6c3c28c1cd532214c0e3c41dfed5823a09e0565bb9b68cc03d9cbc9aae3ff8b3e16c3
|
data/CHANGES.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# 4.3.0 (2026-03-17)
|
|
2
|
+
|
|
3
|
+
- Convert fload to int in spreadsheet if oclc number is a float
|
|
4
|
+
- bump ruby version to 3.3
|
|
5
|
+
- bump nokogiri to 1.19.1
|
|
6
|
+
- bump rubocop to 1.75.0
|
|
7
|
+
|
|
8
|
+
# 4.2.0 (2026-01-06)
|
|
9
|
+
|
|
10
|
+
- Rename RLF to SLF (NRLF -> SLFN, SRLF -> SLFS)
|
|
11
|
+
- Added bypass to skip SSL verification ONLY when recording new VCR cassettes
|
|
12
|
+
|
|
1
13
|
# 4.1.0 (2025-01-10)
|
|
2
14
|
|
|
3
15
|
- Fixed token refresh function and test
|
|
@@ -13,12 +13,12 @@ module BerkeleyLibrary
|
|
|
13
13
|
@ht_error = ht_error
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def
|
|
17
|
-
@
|
|
16
|
+
def slfn?
|
|
17
|
+
@has_slfn ||= wc_symbols.intersection(WorldCat::Symbols::SLFN).any?
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def
|
|
21
|
-
@
|
|
20
|
+
def slfs?
|
|
21
|
+
@has_slfs ||= wc_symbols.intersection(WorldCat::Symbols::SLFS).any?
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def uc_symbols
|
|
@@ -7,7 +7,7 @@ module BerkeleyLibrary
|
|
|
7
7
|
SUMMARY = 'Locaton-related utilities for the UC Berkeley Library'.freeze
|
|
8
8
|
DESCRIPTION = 'A collection of location-related utilities for the UC Berkeley Library'.freeze
|
|
9
9
|
LICENSE = 'MIT'.freeze
|
|
10
|
-
VERSION = '4.
|
|
10
|
+
VERSION = '4.3.0'.freeze
|
|
11
11
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/location'.freeze
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -17,16 +17,7 @@ module BerkeleyLibrary
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def fetch_token
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
http = Net::HTTP.new(url.host, url.port)
|
|
23
|
-
http.use_ssl = url.scheme == 'https'
|
|
24
|
-
|
|
25
|
-
request = Net::HTTP::Post.new(url.request_uri)
|
|
26
|
-
request.basic_auth(Config.api_key, Config.api_secret)
|
|
27
|
-
request['Accept'] = 'application/json'
|
|
28
|
-
response = http.request(request)
|
|
29
|
-
|
|
20
|
+
response = http_request(oclc_token_url)
|
|
30
21
|
JSON.parse(response.body, symbolize_names: true)
|
|
31
22
|
end
|
|
32
23
|
|
|
@@ -42,6 +33,23 @@ module BerkeleyLibrary
|
|
|
42
33
|
|
|
43
34
|
private
|
|
44
35
|
|
|
36
|
+
def http_request(url)
|
|
37
|
+
http = build_http(url)
|
|
38
|
+
request = Net::HTTP::Post.new(url.request_uri)
|
|
39
|
+
request.basic_auth(Config.api_key, Config.api_secret)
|
|
40
|
+
request['Accept'] = 'application/json'
|
|
41
|
+
http.request(request)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def build_http(url)
|
|
45
|
+
http = Net::HTTP.new(url.host, url.port)
|
|
46
|
+
http.use_ssl = url.scheme == 'https'
|
|
47
|
+
|
|
48
|
+
# Skip SSL verification ONLY when recording new VCR cassettes
|
|
49
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if ENV['RE_RECORD_VCR'] == 'true'
|
|
50
|
+
http
|
|
51
|
+
end
|
|
52
|
+
|
|
45
53
|
def token_params
|
|
46
54
|
{
|
|
47
55
|
grant_type: 'client_credentials',
|
|
@@ -2,12 +2,12 @@ module BerkeleyLibrary
|
|
|
2
2
|
module Location
|
|
3
3
|
module WorldCat
|
|
4
4
|
module Symbols
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
SLFN = %w[ZAP ZAPSP].freeze
|
|
6
|
+
SLFS = %w[HH0 ZAS ZASSP].freeze
|
|
7
|
+
SLF = (SLFN + SLFS).freeze
|
|
8
8
|
|
|
9
9
|
UC = %w[CLU CRU CUI CUN CUS CUT CUV CUX CUY CUZ MERUC].freeze
|
|
10
|
-
ALL = (
|
|
10
|
+
ALL = (SLF + UC).freeze
|
|
11
11
|
|
|
12
12
|
class << self
|
|
13
13
|
include Symbols
|
|
@@ -19,6 +19,8 @@ module BerkeleyLibrary
|
|
|
19
19
|
return to_enum(:each_oclc_number) unless block_given?
|
|
20
20
|
|
|
21
21
|
ss.each_value(oclc_col_index, include_header: false) do |v|
|
|
22
|
+
# convert to integer if oclc number is a float in the spreadsheet
|
|
23
|
+
v = v.to_i if v.is_a?(Float)
|
|
22
24
|
next if (v_str = v.to_s).strip == ''
|
|
23
25
|
|
|
24
26
|
yield v_str
|
|
@@ -7,22 +7,22 @@ module BerkeleyLibrary
|
|
|
7
7
|
include Constants
|
|
8
8
|
include BerkeleyLibrary::Logging
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
COL_SLFN = 'SLFN'.freeze
|
|
11
|
+
COL_SLFS = 'SLFS'.freeze
|
|
12
12
|
COL_OTHER_UC = 'Other UC'.freeze
|
|
13
13
|
COL_WC_ERROR = 'WorldCat Error'.freeze
|
|
14
14
|
|
|
15
15
|
COL_HATHI_TRUST = 'Hathi Trust'.freeze
|
|
16
16
|
COL_HATHI_TRUST_ERROR = "#{COL_HATHI_TRUST} Error".freeze
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
V_SLFN = 'slfn'.freeze
|
|
19
|
+
V_SLFS = 'slfs'.freeze
|
|
20
20
|
|
|
21
|
-
attr_reader :ss, :
|
|
21
|
+
attr_reader :ss, :slf, :uc, :hathi_trust
|
|
22
22
|
|
|
23
|
-
def initialize(ss,
|
|
23
|
+
def initialize(ss, slf: true, uc: true, hathi_trust: true)
|
|
24
24
|
@ss = ss
|
|
25
|
-
@
|
|
25
|
+
@slf = slf
|
|
26
26
|
@uc = uc
|
|
27
27
|
@hathi_trust = hathi_trust
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ module BerkeleyLibrary
|
|
|
32
32
|
def <<(result)
|
|
33
33
|
r_indices = row_indices_for(result.oclc_number)
|
|
34
34
|
r_indices.each do |idx|
|
|
35
|
-
write_wc_cols(idx, result) if
|
|
35
|
+
write_wc_cols(idx, result) if slf || uc
|
|
36
36
|
write_ht_cols(idx, result) if hathi_trust
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -41,7 +41,7 @@ module BerkeleyLibrary
|
|
|
41
41
|
|
|
42
42
|
def write_wc_cols(r_index, result)
|
|
43
43
|
write_wc_error(r_index, result)
|
|
44
|
-
|
|
44
|
+
write_slf(r_index, result) if slf
|
|
45
45
|
write_uc(r_index, result) if uc
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -51,9 +51,9 @@ module BerkeleyLibrary
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def ensure_columns!
|
|
54
|
-
if
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if slf
|
|
55
|
+
slfn_col_index
|
|
56
|
+
slfs_col_index
|
|
57
57
|
end
|
|
58
58
|
uc_col_index if uc
|
|
59
59
|
ht_col_index if hathi_trust
|
|
@@ -66,9 +66,9 @@ module BerkeleyLibrary
|
|
|
66
66
|
raise ArgumentError, "Unknown OCLC number: #{oclc_number}"
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def
|
|
70
|
-
ss.set_value_at(r_index,
|
|
71
|
-
ss.set_value_at(r_index,
|
|
69
|
+
def write_slf(r_index, result)
|
|
70
|
+
ss.set_value_at(r_index, slfn_col_index, V_SLFN) if result.slfn?
|
|
71
|
+
ss.set_value_at(r_index, slfs_col_index, V_SLFS) if result.slfs?
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def write_uc(r_index, result)
|
|
@@ -99,12 +99,12 @@ module BerkeleyLibrary
|
|
|
99
99
|
@oclc_col_index ||= ss.find_column_index_by_header!(OCLC_COL_HEADER)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
def
|
|
103
|
-
@
|
|
102
|
+
def slfn_col_index
|
|
103
|
+
@slfn_col_index ||= ss.ensure_column!(COL_SLFN)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
def
|
|
107
|
-
@
|
|
106
|
+
def slfs_col_index
|
|
107
|
+
@slfs_col_index ||= ss.ensure_column!(COL_SLFS)
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
def uc_col_index
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: berkeley_library-location
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- UC Berkeley Library IT
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: berkeley_library-logging
|
|
@@ -72,6 +72,20 @@ dependencies:
|
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: 1.0.2
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: nokogiri
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 1.19.1
|
|
82
|
+
type: :runtime
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 1.19.1
|
|
75
89
|
- !ruby/object:Gem::Dependency
|
|
76
90
|
name: rest-client
|
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -188,16 +202,16 @@ dependencies:
|
|
|
188
202
|
name: rubocop
|
|
189
203
|
requirement: !ruby/object:Gem::Requirement
|
|
190
204
|
requirements:
|
|
191
|
-
- -
|
|
205
|
+
- - "~>"
|
|
192
206
|
- !ruby/object:Gem::Version
|
|
193
|
-
version:
|
|
207
|
+
version: 1.75.0
|
|
194
208
|
type: :development
|
|
195
209
|
prerelease: false
|
|
196
210
|
version_requirements: !ruby/object:Gem::Requirement
|
|
197
211
|
requirements:
|
|
198
|
-
- -
|
|
212
|
+
- - "~>"
|
|
199
213
|
- !ruby/object:Gem::Version
|
|
200
|
-
version:
|
|
214
|
+
version: 1.75.0
|
|
201
215
|
- !ruby/object:Gem::Dependency
|
|
202
216
|
name: rubocop-rake
|
|
203
217
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -328,14 +342,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
328
342
|
requirements:
|
|
329
343
|
- - ">="
|
|
330
344
|
- !ruby/object:Gem::Version
|
|
331
|
-
version: 3.
|
|
345
|
+
version: 3.3.0
|
|
332
346
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
333
347
|
requirements:
|
|
334
348
|
- - ">="
|
|
335
349
|
- !ruby/object:Gem::Version
|
|
336
350
|
version: '0'
|
|
337
351
|
requirements: []
|
|
338
|
-
rubygems_version: 3.
|
|
352
|
+
rubygems_version: 3.5.22
|
|
339
353
|
signing_key:
|
|
340
354
|
specification_version: 4
|
|
341
355
|
summary: Locaton-related utilities for the UC Berkeley Library
|