berkeley_library-location 4.1.0 → 4.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38e532bc61a09117863f2ac3583ec26735685d03b9a22ece2cc55a32490cc31e
4
- data.tar.gz: 3cdec6c95056bdc388716b4153d46a6ea1e7dfd529fe18dc9660de32068bb55b
3
+ metadata.gz: a6dde9a8798f652024e00893fac655ad39c401ec14df226aa6b67c52d22d2527
4
+ data.tar.gz: dc766bed8dedfe4e1f46fa2c9fd9ffe9f20a114815813e7d265d4c0bcd27dd4c
5
5
  SHA512:
6
- metadata.gz: 1883e646eab5646d0dcde57e88477d758b52939ab2b0f0033e7aecf1184c7a342ac0c339060cd2ead515ccdcd7005d84df6f6700cb0095955e4d817c9ca28fe7
7
- data.tar.gz: fb64c8aa2204c0a60d36ae504d96c5e2e946e71517d4b9e11584f48f91b0bc3339dcece2e4f906145c866a124fe260117ba1849a87244eccb89bf3f7401aeed3
6
+ metadata.gz: 437efa3af98fe1fad98146917f1ab05e8470a4eacd70f50aa72ddda3e58ddaea236e6fe3c71e1a44a3a5f242b3564806917ba60b3b7e015cc707cb50561374d8
7
+ data.tar.gz: 123e84b09716817c7691bab9279e0908bc0e99b6fd6502c556f8df096bd028794ea6a3289f29b785d276be028b726e01d7905db62be7a3d230a22d420f441175
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 4.2.0 (2026-01-06)
2
+
3
+ - Rename RLF to SLF (NRLF -> SLFN, SRLF -> SLFS)
4
+ - Added bypass to skip SSL verification ONLY when recording new VCR cassettes
5
+
1
6
  # 4.1.0 (2025-01-10)
2
7
 
3
8
  - 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 nrlf?
17
- @has_nrlf ||= wc_symbols.intersection(WorldCat::Symbols::NRLF).any?
16
+ def slfn?
17
+ @has_slfn ||= wc_symbols.intersection(WorldCat::Symbols::SLFN).any?
18
18
  end
19
19
 
20
- def srlf?
21
- @has_srlf ||= wc_symbols.intersection(WorldCat::Symbols::SRLF).any?
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.1.0'.freeze
10
+ VERSION = '4.2.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
- url = oclc_token_url
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
- NRLF = %w[ZAP ZAPSP].freeze
6
- SRLF = %w[HH0 ZAS ZASSP].freeze
7
- RLF = (NRLF + SRLF).freeze
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 = (RLF + UC).freeze
10
+ ALL = (SLF + UC).freeze
11
11
 
12
12
  class << self
13
13
  include Symbols
@@ -7,22 +7,22 @@ module BerkeleyLibrary
7
7
  include Constants
8
8
  include BerkeleyLibrary::Logging
9
9
 
10
- COL_NRLF = 'NRLF'.freeze
11
- COL_SRLF = 'SRLF'.freeze
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
- V_NRLF = 'nrlf'.freeze
19
- V_SRLF = 'srlf'.freeze
18
+ V_SLFN = 'slfn'.freeze
19
+ V_SLFS = 'slfs'.freeze
20
20
 
21
- attr_reader :ss, :rlf, :uc, :hathi_trust
21
+ attr_reader :ss, :slf, :uc, :hathi_trust
22
22
 
23
- def initialize(ss, rlf: true, uc: true, hathi_trust: true)
23
+ def initialize(ss, slf: true, uc: true, hathi_trust: true)
24
24
  @ss = ss
25
- @rlf = rlf
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 rlf || uc
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
- write_rlf(r_index, result) if rlf
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 rlf
55
- nrlf_col_index
56
- srlf_col_index
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 write_rlf(r_index, result)
70
- ss.set_value_at(r_index, nrlf_col_index, V_NRLF) if result.nrlf?
71
- ss.set_value_at(r_index, srlf_col_index, V_SRLF) if result.srlf?
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 nrlf_col_index
103
- @nrlf_col_index ||= ss.ensure_column!(COL_NRLF)
102
+ def slfn_col_index
103
+ @slfn_col_index ||= ss.ensure_column!(COL_SLFN)
104
104
  end
105
105
 
106
- def srlf_col_index
107
- @srlf_col_index ||= ss.ensure_column!(COL_SRLF)
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.1.0
4
+ version: 4.2.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: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2026-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: berkeley_library-logging