pennmarc 1.2.14 → 1.2.19

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: e25cd42397f1b6d4da3dcef75c21eba21de3fdeefa61fcc99496665e03069f46
4
- data.tar.gz: f393d5264264be23afc4ca02d0053fbc0ee6aef9a59505c3e366f7c1619c6e34
3
+ metadata.gz: 000b00c70e9c8d7e21a755f490a167aab853654d6c709cf53081607e9053ead2
4
+ data.tar.gz: 17fcc4f50b4fd28843e318e63a152759fec88d0efc4b3ccb8af2aabfb8ab7e1d
5
5
  SHA512:
6
- metadata.gz: b4b734468602dab1e0ad2ecdcd818ad454fe6c2a85274070e733756f3ad1224df793acf2ad94bc63c2b3a707bba3ec7bb40525972e18c9bcdeed941dd822fc80
7
- data.tar.gz: 3622b464b9f48c8523548833ba9d3bb97bf129feb27880f44e19629569ef41172ed655e1d21a64d25b8f222404a6382ce95986604389c3414849602112bcd6c4
6
+ metadata.gz: '009d28e75c876d7d83d2a3834d494cb24eee0ce00ef6d172ce1f16e858af2aba23f0c65837a46907a2ae3c3d71237711789553604614a9a470fae79fae47e0a2'
7
+ data.tar.gz: 38a430b6eb4bbbdad006d57175dce8c830ef3cf0e1a3732a096e313bb08803e3b178e023fe7da2e5be84ee1a420bd28b527e77583cfed41420034e86acc4210d
data/.pipeline.yml CHANGED
@@ -1,8 +1,11 @@
1
1
  include:
2
- - project: "devops/gitlab/ci-templates/general"
3
- file:
4
- - ".install_hashicorp_vault.yml"
5
- - ".vault_jwt_auth.yml"
2
+ - component: gitlab.library.upenn.edu/devops/gitlab/components/general/install_hashicorp_vault@~latest
3
+ - component: gitlab.library.upenn.edu/devops/gitlab/components/general/vault_jwt_auth@~latest
4
+ inputs:
5
+ vault_addr: ${VAULT_ADDR}
6
+ vault_auth_path: ${VAULT_AUTH_PATH}
7
+ vault_auth_role: ${VAULT_AUTH_ROLE}
8
+
6
9
  - project: "devops/gitlab/ci-templates/ruby"
7
10
  ref: "sans-dind"
8
11
  file:
@@ -38,18 +41,20 @@ rubocop_app_test:
38
41
  gem_publication:
39
42
  stage: deploy
40
43
  image: ruby:3.2.2
44
+ extends:
45
+ - .vault_jwt_auth
41
46
  variables:
42
47
  GEMSPEC_FILE: "${CI_PROJECT_NAME}.gemspec"
43
48
  before_script:
44
49
  - !reference [.install_hashicorp_vault, before_script]
45
50
  - !reference [.vault_jwt_auth, before_script]
51
+ script:
46
52
  - export GEM_HOST_API_KEY="$(vault kv get -field=rubygems_api_key ${VAULT_KV_ENDPOINT}${ENVIRONMENT})"
47
53
  - |
48
54
  gem -v
49
55
  rm -f ./*.gem
50
56
  [ -f "${GEMSPEC_FILE}" ] || (echo "No ${GEMSPEC_FILE} file found!" && exit 1)
51
57
  - '[ -n "${GEM_HOST_API_KEY}" ] || (echo "GEM_HOST_API_KEY is not set!" && exit 1)'
52
- script:
53
58
  - GEM_FILE=$(echo "${CI_PROJECT_NAME}-${CI_COMMIT_TAG:1}.gem")
54
59
  - |
55
60
  gem build "${GEMSPEC_FILE}"
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # MARC encoding level
4
- # See: https://www.oclc.org/bibformats/en/fixedfield/elvl.html
5
- # Not sure how this is used
3
+ # MARC {https://www.oclc.org/bibformats/en/fixedfield/elvl.html encoding level values} and a means of ranking them.
4
+ # See the `EncodingRank` helper for usage.
6
5
  module PennMARC
7
6
  module EncodingLevel
8
- # Official MARC codes (https://www.loc.gov/marc/bibliographic/bdleader.html)
7
+ # {https://www.loc.gov/marc/bibliographic/bdleader.html Official MARC codes}
9
8
  FULL = ' '
10
9
  FULL_NOT_EXAMINED = '1'
11
10
  UNFULL_NOT_EXAMINED = '2'
@@ -17,7 +16,8 @@ module PennMARC
17
16
  UNKNOWN = 'u'
18
17
  NOT_APPLICABLE = 'z'
19
18
 
20
- # OCLC extension codes (https://www.oclc.org/bibformats/en/fixedfield/elvl.html)
19
+ # {https://www.oclc.org/bibformats/en/fixedfield/elvl.html OCLC extension codes}. These are deprecated but still
20
+ # found in our records.
21
21
  OCLC_FULL = 'I'
22
22
  OCLC_MINIMAL = 'K'
23
23
  OCLC_BATCH_LEGACY = 'L'
@@ -27,9 +27,9 @@ module PennMARC
27
27
  RANK = {
28
28
  # top 4 (per nelsonrr), do not differentiate among "good" records
29
29
  FULL => 0,
30
- FULL_NOT_EXAMINED => 0, # 1
31
- OCLC_FULL => 0, # 2
32
- CORE => 0, # 3
30
+ FULL_NOT_EXAMINED => 0,
31
+ OCLC_FULL => 0,
32
+ CORE => 0,
33
33
  UNFULL_NOT_EXAMINED => 4,
34
34
  ABBREVIATED => 5,
35
35
  PRELIMINARY => 6,
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PennMARC
4
+ # Extract encoding level and provide an opinionated rating of the encoding level
5
+ class EncodingRank < Helper
6
+ class << self
7
+ LEADER_POSITION = 17
8
+
9
+ # Return a value corresponding to the {https://www.oclc.org/bibformats/en/fixedfield/elvl.html encoding level}
10
+ # from the MARC leader. Lower numbers indicate a higher level of description. See {PennMARC::EncodingLevel} for
11
+ # hash that determines the ranking. We still consider some "legacy" OCLC non-numeric codes here, though they are
12
+ # no longer recommended for use by OCLC. If an invalid value is found, nil is returned.
13
+ # @param [MARC::Record] record
14
+ # @return [Integer, nil]
15
+ def sort(record:)
16
+ EncodingLevel::RANK[
17
+ record.leader[LEADER_POSITION]
18
+ ]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../encoding_level'
3
4
  require_relative '../enriched'
4
5
  require_relative '../mappers'
5
6
  require_relative '../util'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PennMARC
4
- VERSION = '1.2.14'
4
+ VERSION = '1.2.19'
5
5
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe 'PennMARC::EncodingRank' do
4
+ let(:helper) { PennMARC::EncodingRank }
5
+
6
+ describe '.sort' do
7
+ let(:record) { marc_record leader: leader }
8
+ let(:result) { helper.sort record: record }
9
+ let(:leader) { " #{level} " }
10
+
11
+ context 'with an empty value' do
12
+ let(:level) { PennMARC::EncodingLevel::FULL }
13
+
14
+ it 'returns 0' do
15
+ expect(result).to eq 0
16
+ end
17
+ end
18
+
19
+ context 'with an official MARC code present' do
20
+ let(:level) { PennMARC::EncodingLevel::MINIMAL }
21
+
22
+ it 'returns 7' do
23
+ expect(result).to eq 7
24
+ end
25
+ end
26
+
27
+ context 'with an OCLC extension code' do
28
+ let(:level) { PennMARC::EncodingLevel::OCLC_BATCH }
29
+
30
+ it 'returns 9' do
31
+ expect(result).to eq 9
32
+ end
33
+ end
34
+
35
+ context 'with an unhandled value' do
36
+ let(:level) { 'T' }
37
+
38
+ it 'returns nil' do
39
+ expect(result).to be_nil
40
+ end
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pennmarc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.14
4
+ version: 1.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Kanning
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2025-05-19 00:00:00.000000000 Z
15
+ date: 2025-06-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -114,6 +114,7 @@ files:
114
114
  - lib/pennmarc/helpers/database.rb
115
115
  - lib/pennmarc/helpers/date.rb
116
116
  - lib/pennmarc/helpers/edition.rb
117
+ - lib/pennmarc/helpers/encoding_rank.rb
117
118
  - lib/pennmarc/helpers/format.rb
118
119
  - lib/pennmarc/helpers/genre.rb
119
120
  - lib/pennmarc/helpers/helper.rb
@@ -155,6 +156,7 @@ files:
155
156
  - spec/lib/pennmarc/helpers/database_spec.rb
156
157
  - spec/lib/pennmarc/helpers/date_spec.rb
157
158
  - spec/lib/pennmarc/helpers/edition_spec.rb
159
+ - spec/lib/pennmarc/helpers/encoding_rank_spec.rb
158
160
  - spec/lib/pennmarc/helpers/format_spec.rb
159
161
  - spec/lib/pennmarc/helpers/genre_spec.rb
160
162
  - spec/lib/pennmarc/helpers/identifer_spec.rb