cocina-models 0.108.2 → 0.108.3

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: 591a295c29fd91ae7619a635403d6e1c0dcc0aca4b329f62e12f0f9eb10399e7
4
- data.tar.gz: 971731836904292e3db7a54122823476a74e44dbc3eef67230fa4382f51c73d8
3
+ metadata.gz: 4ac0ee1d7ed8ae53486e4b711aa05db3d73b2390a8083f9f1597f111ebbe3c9c
4
+ data.tar.gz: 33583ad6d49089fba2434b8924302cf9c3f4ee18150100e56db61d2bc36e3972
5
5
  SHA512:
6
- metadata.gz: 50802b14fd29c231c0c883b03820ebf2be0cec2cd72ecc6992f35205821253dd84582383a19d2895e5df5db2bc7d17eabc317f9c2308a77e1cb75d1697eff352
7
- data.tar.gz: 9abf3d779130d8eef574e995c382aedba1e592eb04db04a14fc57df939946fc099857137c786b06d2e5a8db9b801946b7f1b6016af6ca9d235699a539b96d16c
6
+ metadata.gz: f57738f86a52485a98f8a6f6793a026a2a5e38d42e4cfd4c444891a3d1d115331e93d3e839d9e406550f07cd78db405111c91cb9701e5bc85b24eefb9cb7c8cd
7
+ data.tar.gz: 12de4f311c73204458f59af08db308bf83c7949b72378a3c4a044590c943a494db19a98f072e4691946dbd44ae1e0ba58174ae8fdcae1745ae688d0b9447022c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocina-models (0.108.2)
4
+ cocina-models (0.108.3)
5
5
  activesupport
6
6
  deprecation
7
7
  dry-struct (~> 1.0)
@@ -77,7 +77,7 @@ GEM
77
77
  activesupport (>= 3.0, < 9.0)
78
78
  equivalent-xml (0.6.0)
79
79
  nokogiri (>= 1.4.3)
80
- erb (5.1.3)
80
+ erb (6.0.0)
81
81
  i18n (1.14.7)
82
82
  concurrent-ruby (~> 1.0)
83
83
  ice_nine (0.11.2)
@@ -86,7 +86,7 @@ GEM
86
86
  pp (>= 0.6.0)
87
87
  rdoc (>= 4.0.0)
88
88
  reline (>= 0.4.2)
89
- json (2.15.2)
89
+ json (2.16.0)
90
90
  json_schema (0.21.0)
91
91
  jsonpath (1.1.5)
92
92
  multi_json
@@ -94,7 +94,7 @@ GEM
94
94
  lint_roller (1.1.0)
95
95
  logger (1.7.0)
96
96
  mini_portile2 (2.8.9)
97
- minitest (5.26.0)
97
+ minitest (5.26.1)
98
98
  multi_json (1.17.0)
99
99
  nokogiri (1.18.10)
100
100
  mini_portile2 (~> 2.8.2)
@@ -123,7 +123,7 @@ GEM
123
123
  psych (>= 4.0.0)
124
124
  tsort
125
125
  regexp_parser (2.11.3)
126
- reline (0.6.2)
126
+ reline (0.6.3)
127
127
  io-console (~> 0.5)
128
128
  rspec (3.13.2)
129
129
  rspec-core (~> 3.13.0)
@@ -151,15 +151,15 @@ GEM
151
151
  rubocop-ast (>= 1.47.1, < 2.0)
152
152
  ruby-progressbar (~> 1.7)
153
153
  unicode-display_width (>= 2.4.0, < 4.0)
154
- rubocop-ast (1.47.1)
154
+ rubocop-ast (1.48.0)
155
155
  parser (>= 3.3.7.2)
156
156
  prism (~> 1.4)
157
157
  rubocop-rake (0.7.1)
158
158
  lint_roller (~> 1.1)
159
159
  rubocop (>= 1.72.1)
160
- rubocop-rspec (3.7.0)
160
+ rubocop-rspec (3.8.0)
161
161
  lint_roller (~> 1.1)
162
- rubocop (~> 1.72, >= 1.72.1)
162
+ rubocop (~> 1.81)
163
163
  ruby-progressbar (1.13.0)
164
164
  securerandom (0.4.1)
165
165
  simplecov (0.22.0)
@@ -168,7 +168,7 @@ GEM
168
168
  simplecov_json_formatter (~> 0.1)
169
169
  simplecov-html (0.13.2)
170
170
  simplecov_json_formatter (0.1.4)
171
- stringio (3.1.7)
171
+ stringio (3.1.8)
172
172
  super_diff (0.17.0)
173
173
  attr_extras (>= 6.2.4)
174
174
  diff-lcs
@@ -180,7 +180,7 @@ GEM
180
180
  unicode-display_width (3.2.0)
181
181
  unicode-emoji (~> 4.1)
182
182
  unicode-emoji (4.1.0)
183
- uri (1.1.0)
183
+ uri (1.1.1)
184
184
  zeitwerk (2.7.3)
185
185
 
186
186
  PLATFORMS
@@ -6,6 +6,8 @@ module Cocina
6
6
  module FromMods
7
7
  # Builds cocina identifier
8
8
  class IdentifierBuilder
9
+ ORCID_PREFIX = 'https://orcid.org/'
10
+
9
11
  # @param [Nokogiri::XML::Element] identifier_element identifier element
10
12
  # @return [Hash] a hash that can be mapped to a cocina model
11
13
  def self.build_from_identifier(identifier_element:)
@@ -40,7 +42,7 @@ module Cocina
40
42
  attrs[:uri] = identifier_element.text
41
43
  else
42
44
  attrs[:type] = cocina_type
43
- attrs[:value] = identifier_element.text
45
+ attrs[:value] = value
44
46
  attrs[:source] = build_source
45
47
  end
46
48
  attrs[:status] = 'invalid' if identifier_element['invalid'] == 'yes'
@@ -54,16 +56,29 @@ module Cocina
54
56
  def types_for(type)
55
57
  return ['uri', 'uri', IdentifierType::STANDARD_IDENTIFIER_SCHEMES] if type == 'uri'
56
58
 
59
+ type = 'orcid' if orcid?
60
+
57
61
  IdentifierType.cocina_type_for_mods_type(type)
58
62
  end
59
63
 
64
+ def value
65
+ value = identifier_element.text
66
+ return value.delete_prefix(ORCID_PREFIX) if orcid?
67
+
68
+ value
69
+ end
70
+
60
71
  def build_source
61
72
  {
62
- uri: identifier_element['typeURI']
73
+ uri: orcid? ? 'https://orcid.org' : identifier_element['typeURI']
63
74
  }.tap do |props|
64
75
  props[:code] = mods_type unless props[:uri]
65
76
  end.compact.presence
66
77
  end
78
+
79
+ def orcid?
80
+ identifier_element.text.starts_with?(ORCID_PREFIX)
81
+ end
67
82
  end
68
83
  end
69
84
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Cocina
4
4
  module Models
5
- VERSION = '0.108.2'
5
+ VERSION = '0.108.3'
6
6
  end
7
7
  end