sul_orcid_client 0.8.0 → 0.8.1

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: a9f8c0cdbbd579e4e9922b2225c2780d8822b398e937ee1012d48dca1b00ad94
4
- data.tar.gz: edb6936a029080f50ea8de31b2ea57f70a2f26ffe1c00570dd4283087ebaf5d1
3
+ metadata.gz: d56e2ed40130ba946c812505997aebef2e719e3abc6ad2ec735537a1bfc642f0
4
+ data.tar.gz: d6dd2cc0d5dd9e0292d9664a96287291e8b16207b4ffceede078248c32ad76d5
5
5
  SHA512:
6
- metadata.gz: 7b760b6a8c634233fa2eb71ed7c812226a2f948eaab2e32a5f9104df736bf50f733cad45c395b73d9997f4d95c1adbd0f7e28cb94fe581b63e89a6c9572057c0
7
- data.tar.gz: 78991a512207404b5a3d456c5f3149f091a522c17b4bea4b656d20b2c33d8a182454b4a2fd003e734c0559b46d93e09273409480c26fecc7d60e66d18b4a7590
6
+ metadata.gz: 5f5196a28d70167f6baadad4d5a0672180adbf7bf1173ce517edb1499328f58d7404208105e059cae43da1b6a0048e377b1085c4e5eda5e801ce46c87cc4fee4
7
+ data.tar.gz: b859878d682b3d7ebc591d65391efdc1bceb3cd2646bad4f9cb65ddb7b7a1261209d58388e251209554c24235cae67ab683a1e939e8ef1d130bba4844fadbea1
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-capybara
3
3
  - rubocop-factory_bot
4
4
  - rubocop-performance
@@ -52,11 +52,11 @@ FactoryBot/ConsistentParenthesesStyle: # new in 2.14
52
52
  Enabled: true
53
53
  FactoryBot/SyntaxMethods: # new in 2.7
54
54
  Enabled: true
55
- RSpec/Rails/AvoidSetupHook: # new in 2.4
55
+ RSpecRails/AvoidSetupHook: # new in 2.4
56
56
  Enabled: true
57
- RSpec/Rails/HaveHttpStatus: # new in 2.12
57
+ RSpecRails/HaveHttpStatus: # new in 2.12
58
58
  Enabled: true
59
- RSpec/Rails/InferredSpecType: # new in 2.14
59
+ RSpecRails/InferredSpecType: # new in 2.14
60
60
  Enabled: true
61
61
 
62
62
  RSpec/MultipleExpectations:
@@ -89,9 +89,9 @@ RSpec/RedundantAround: # new in 2.19
89
89
  Enabled: true
90
90
  RSpec/SkipBlockInsideExample: # new in 2.19
91
91
  Enabled: true
92
- RSpec/Rails/MinitestAssertions: # new in 2.17
92
+ RSpecRails/MinitestAssertions: # new in 2.17
93
93
  Enabled: true
94
- RSpec/Rails/TravelAround: # new in 2.19
94
+ RSpecRails/TravelAround: # new in 2.19
95
95
  Enabled: true
96
96
 
97
97
  Gemspec/DeprecatedAttributeAssignment: # new in 1.30
@@ -178,6 +178,11 @@ Metrics/CollectionLiteralLength: # new in 1.47
178
178
  Enabled: true
179
179
  Naming/BlockForwarding: # new in 1.24
180
180
  Enabled: true
181
+ Naming/PredicateMethod: # new in 1.76
182
+ Enabled: true
183
+ AllowedMethods:
184
+ - call
185
+ - update_work
181
186
  Security/CompoundHash: # new in 1.28
182
187
  Enabled: true
183
188
  Security/IoMethods: # new in 1.22
@@ -354,5 +359,138 @@ RSpec/SpecFilePathFormat: # new in 2.24
354
359
  Enabled: true
355
360
  RSpec/SpecFilePathSuffix: # new in 2.24
356
361
  Enabled: true
357
- RSpec/Rails/NegationBeValid: # new in 2.23
362
+ RSpecRails/NegationBeValid: # new in 2.23
363
+ Enabled: true
364
+
365
+ Gemspec/AddRuntimeDependency: # new in 1.65
366
+ Enabled: true
367
+ Gemspec/AttributeAssignment: # new in 1.77
368
+ Enabled: true
369
+ Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
370
+ Enabled: true
371
+ Lint/ArrayLiteralInRegexp: # new in 1.71
372
+ Enabled: true
373
+ Lint/ConstantReassignment: # new in 1.70
374
+ Enabled: true
375
+ Lint/CopDirectiveSyntax: # new in 1.72
376
+ Enabled: true
377
+ Lint/DataDefineOverride: # new in 1.85
378
+ Enabled: true
379
+ Lint/DuplicateSetElement: # new in 1.67
380
+ Enabled: true
381
+ Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
382
+ Enabled: true
383
+ Lint/NumericOperationWithConstantResult: # new in 1.69
384
+ Enabled: true
385
+ Lint/RedundantTypeConversion: # new in 1.72
386
+ Enabled: true
387
+ Lint/SharedMutableDefault: # new in 1.70
388
+ Enabled: true
389
+ Lint/SuppressedExceptionInNumberConversion: # new in 1.72
390
+ Enabled: true
391
+ Lint/UnescapedBracketInRegexp: # new in 1.68
392
+ Enabled: true
393
+ Lint/UnreachablePatternBranch: # new in 1.85
394
+ Enabled: true
395
+ Lint/UselessConstantScoping: # new in 1.72
396
+ Enabled: true
397
+ Lint/UselessDefaultValueArgument: # new in 1.76
398
+ Enabled: true
399
+ Lint/UselessDefined: # new in 1.69
400
+ Enabled: true
401
+ Lint/UselessNumericOperation: # new in 1.66
402
+ Enabled: true
403
+ Lint/UselessOr: # new in 1.76
404
+ Enabled: true
405
+ Style/AmbiguousEndlessMethodDefinition: # new in 1.68
406
+ Enabled: true
407
+ Style/ArrayIntersectWithSingleElement: # new in 1.81
408
+ Enabled: true
409
+ Style/BitwisePredicate: # new in 1.68
410
+ Enabled: true
411
+ Style/CollectionQuerying: # new in 1.77
412
+ Enabled: true
413
+ Style/CombinableDefined: # new in 1.68
414
+ Enabled: true
415
+ Style/ComparableBetween: # new in 1.74
416
+ Enabled: true
417
+ Style/DigChain: # new in 1.69
418
+ Enabled: true
419
+ Style/EmptyClassDefinition: # new in 1.84
420
+ Enabled: true
421
+ Style/EmptyStringInsideInterpolation: # new in 1.76
422
+ Enabled: true
423
+ Style/FileNull: # new in 1.69
424
+ Enabled: true
425
+ Style/FileOpen: # new in 1.85
426
+ Enabled: true
427
+ Style/FileTouch: # new in 1.69
428
+ Enabled: true
429
+ Style/HashFetchChain: # new in 1.75
430
+ Enabled: true
431
+ Style/HashSlice: # new in 1.71
432
+ Enabled: true
433
+ Style/ItAssignment: # new in 1.70
434
+ Enabled: true
435
+ Style/ItBlockParameter: # new in 1.75
436
+ Enabled: true
437
+ Style/KeywordArgumentsMerging: # new in 1.68
438
+ Enabled: true
439
+ Style/MapIntoArray: # new in 1.63
440
+ Enabled: true
441
+ Style/MapJoin: # new in 1.85
442
+ Enabled: true
443
+ Style/ModuleMemberExistenceCheck: # new in 1.82
444
+ Enabled: true
445
+ Style/NegativeArrayIndex: # new in 1.84
446
+ Enabled: true
447
+ Style/OneClassPerFile: # new in 1.85
448
+ Enabled: true
449
+ Style/PartitionInsteadOfDoubleSelect: # new in 1.85
450
+ Enabled: true
451
+ Style/PredicateWithKind: # new in 1.85
452
+ Enabled: true
453
+ Style/ReduceToHash: # new in 1.85
454
+ Enabled: true
455
+ Style/RedundantArrayFlatten: # new in 1.76
456
+ Enabled: true
457
+ Style/RedundantFormat: # new in 1.72
458
+ Enabled: true
459
+ Style/RedundantInterpolationUnfreeze: # new in 1.66
460
+ Enabled: true
461
+ Style/RedundantMinMaxBy: # new in 1.85
462
+ Enabled: true
463
+ Style/RedundantStructKeywordInit: # new in 1.85
464
+ Enabled: true
465
+ Style/ReverseFind: # new in 1.84
466
+ Enabled: true
467
+ Style/SafeNavigationChainLength: # new in 1.68
468
+ Enabled: true
469
+ Style/SelectByKind: # new in 1.85
470
+ Enabled: true
471
+ Style/SelectByRange: # new in 1.85
472
+ Enabled: true
473
+ Style/SendWithLiteralMethodName: # new in 1.64
474
+ Enabled: true
475
+ Style/SuperArguments: # new in 1.64
476
+ Enabled: true
477
+ Style/TallyMethod: # new in 1.85
478
+ Enabled: true
479
+ Capybara/FindAllFirst: # new in 2.22
480
+ Enabled: true
481
+ Capybara/NegationMatcherAfterVisit: # new in 2.22
482
+ Enabled: true
483
+ FactoryBot/ExcessiveCreateList: # new in 2.25
484
+ Enabled: true
485
+ Performance/StringBytesize: # new in 1.23
486
+ Enabled: true
487
+ Performance/ZipWithoutBlock: # new in 1.24
488
+ Enabled: true
489
+ RSpec/IncludeExamples: # new in 3.6
490
+ Enabled: true
491
+ RSpec/LeakyLocalVariable: # new in 3.8
492
+ Enabled: true
493
+ RSpec/Output: # new in 3.9
494
+ Enabled: true
495
+ RSpecRails/HttpStatusNameConsistency: # new in 2.32
358
496
  Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sul_orcid_client (0.8.0)
4
+ sul_orcid_client (0.8.1)
5
5
  activesupport (>= 4.2)
6
6
  cocina-models (~> 0.90)
7
7
  faraday
@@ -12,28 +12,28 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (8.0.2.1)
15
+ activesupport (8.1.2)
16
16
  base64
17
- benchmark (>= 0.3)
18
17
  bigdecimal
19
18
  concurrent-ruby (~> 1.0, >= 1.3.1)
20
19
  connection_pool (>= 2.2.5)
21
20
  drb
22
21
  i18n (>= 1.6, < 2)
22
+ json
23
23
  logger (>= 1.4.2)
24
24
  minitest (>= 5.1)
25
25
  securerandom (>= 0.3)
26
26
  tzinfo (~> 2.0, >= 2.0.5)
27
27
  uri (>= 0.13.1)
28
- addressable (2.8.7)
29
- public_suffix (>= 2.0.2, < 7.0)
28
+ addressable (2.8.9)
29
+ public_suffix (>= 2.0.2, < 8.0)
30
30
  ast (2.4.3)
31
31
  attr_extras (7.1.0)
32
32
  base64 (0.3.0)
33
- benchmark (0.4.1)
34
- bigdecimal (3.2.3)
35
- byebug (12.0.0)
36
- cocina-models (0.106.0)
33
+ bigdecimal (4.0.1)
34
+ byebug (13.0.0)
35
+ reline (>= 0.6.0)
36
+ cocina-models (0.116.0)
37
37
  activesupport
38
38
  deprecation
39
39
  dry-struct (~> 1.0)
@@ -41,15 +41,15 @@ GEM
41
41
  edtf
42
42
  equivalent-xml
43
43
  i18n
44
+ json_schemer (~> 2.0)
44
45
  jsonpath
45
46
  nokogiri
46
- openapi_parser (~> 1.0)
47
47
  super_diff
48
48
  thor
49
49
  zeitwerk (~> 2.1)
50
- concurrent-ruby (1.3.5)
51
- connection_pool (2.5.4)
52
- crack (1.0.0)
50
+ concurrent-ruby (1.3.6)
51
+ connection_pool (3.0.2)
52
+ crack (1.0.1)
53
53
  bigdecimal
54
54
  rexml
55
55
  deprecation (1.1.0)
@@ -57,23 +57,23 @@ GEM
57
57
  diff-lcs (1.6.2)
58
58
  docile (1.4.1)
59
59
  drb (2.2.3)
60
- dry-core (1.1.0)
60
+ dry-core (1.2.0)
61
61
  concurrent-ruby (~> 1.0)
62
62
  logger
63
63
  zeitwerk (~> 2.6)
64
- dry-inflector (1.2.0)
64
+ dry-inflector (1.3.1)
65
65
  dry-logic (1.6.0)
66
66
  bigdecimal
67
67
  concurrent-ruby (~> 1.0)
68
68
  dry-core (~> 1.1)
69
69
  zeitwerk (~> 2.6)
70
- dry-struct (1.8.0)
70
+ dry-struct (1.8.1)
71
71
  dry-core (~> 1.1)
72
72
  dry-types (~> 1.8, >= 1.8.2)
73
73
  ice_nine (~> 0.11)
74
74
  zeitwerk (~> 2.6)
75
- dry-types (1.8.3)
76
- bigdecimal (~> 3.0)
75
+ dry-types (1.9.1)
76
+ bigdecimal (>= 3.0)
77
77
  concurrent-ruby (~> 1.0)
78
78
  dry-core (~> 1.0)
79
79
  dry-inflector (~> 1.0)
@@ -83,20 +83,31 @@ GEM
83
83
  activesupport (>= 3.0, < 9.0)
84
84
  equivalent-xml (0.6.0)
85
85
  nokogiri (>= 1.4.3)
86
- faraday (2.13.4)
86
+ faraday (2.14.1)
87
87
  faraday-net_http (>= 2.0, < 3.5)
88
88
  json
89
89
  logger
90
- faraday-net_http (3.4.1)
91
- net-http (>= 0.5.0)
92
- faraday-retry (2.3.2)
90
+ faraday-net_http (3.4.2)
91
+ net-http (~> 0.5)
92
+ faraday-retry (2.4.0)
93
93
  faraday (~> 2.0)
94
+ hana (1.3.7)
94
95
  hashdiff (1.2.1)
95
- hashie (5.0.0)
96
- i18n (1.14.7)
96
+ hashie (5.1.0)
97
+ logger
98
+ i18n (1.14.8)
97
99
  concurrent-ruby (~> 1.0)
98
100
  ice_nine (0.11.2)
99
- json (2.14.1)
101
+ io-console (0.8.2)
102
+ json (2.19.2)
103
+ json-schema (6.2.0)
104
+ addressable (~> 2.8)
105
+ bigdecimal (>= 3.1, < 5)
106
+ json_schemer (2.5.0)
107
+ bigdecimal
108
+ hana (~> 1.3)
109
+ regexp_parser (~> 2.0)
110
+ simpleidn (~> 0.2)
100
111
  jsonpath (1.1.5)
101
112
  multi_json
102
113
  jwt (3.1.2)
@@ -104,19 +115,23 @@ GEM
104
115
  language_server-protocol (3.17.0.5)
105
116
  lint_roller (1.1.0)
106
117
  logger (1.7.0)
107
- minitest (5.25.5)
108
- multi_json (1.17.0)
109
- multi_xml (0.7.2)
110
- bigdecimal (~> 3.1)
111
- net-http (0.6.0)
112
- uri
113
- nokogiri (1.18.10-arm64-darwin)
118
+ mcp (0.9.0)
119
+ json-schema (>= 4.1)
120
+ minitest (6.0.2)
121
+ drb (~> 2.0)
122
+ prism (~> 1.5)
123
+ multi_json (1.19.1)
124
+ multi_xml (0.8.1)
125
+ bigdecimal (>= 3.1, < 5)
126
+ net-http (0.9.1)
127
+ uri (>= 0.11.1)
128
+ nokogiri (1.19.2-arm64-darwin)
114
129
  racc (~> 1.4)
115
- nokogiri (1.18.10-x86_64-darwin)
130
+ nokogiri (1.19.2-x86_64-darwin)
116
131
  racc (~> 1.4)
117
- nokogiri (1.18.10-x86_64-linux-gnu)
132
+ nokogiri (1.19.2-x86_64-linux-gnu)
118
133
  racc (~> 1.4)
119
- oauth2 (2.0.17)
134
+ oauth2 (2.0.18)
120
135
  faraday (>= 0.17.3, < 4.0)
121
136
  jwt (>= 1.0, < 4.0)
122
137
  logger (~> 1.2)
@@ -124,63 +139,65 @@ GEM
124
139
  rack (>= 1.2, < 4)
125
140
  snaky_hash (~> 2.0, >= 2.0.3)
126
141
  version_gem (~> 1.1, >= 1.1.9)
127
- openapi_parser (1.0.0)
128
142
  optimist (3.2.1)
129
143
  parallel (1.27.0)
130
- parser (3.3.9.0)
144
+ parser (3.3.10.2)
131
145
  ast (~> 2.4.1)
132
146
  racc
133
147
  patience_diff (1.2.0)
134
148
  optimist (~> 3.0)
135
- prism (1.5.1)
136
- public_suffix (6.0.2)
149
+ prism (1.9.0)
150
+ public_suffix (7.0.5)
137
151
  racc (1.8.1)
138
- rack (3.2.1)
152
+ rack (3.2.5)
139
153
  rainbow (3.1.1)
140
- rake (13.3.0)
154
+ rake (13.3.1)
141
155
  regexp_parser (2.11.3)
156
+ reline (0.6.3)
157
+ io-console (~> 0.5)
142
158
  rexml (3.4.4)
143
- rspec (3.13.1)
159
+ rspec (3.13.2)
144
160
  rspec-core (~> 3.13.0)
145
161
  rspec-expectations (~> 3.13.0)
146
162
  rspec-mocks (~> 3.13.0)
147
- rspec-core (3.13.5)
163
+ rspec-core (3.13.6)
148
164
  rspec-support (~> 3.13.0)
149
165
  rspec-expectations (3.13.5)
150
166
  diff-lcs (>= 1.2.0, < 2.0)
151
167
  rspec-support (~> 3.13.0)
152
- rspec-mocks (3.13.5)
168
+ rspec-mocks (3.13.8)
153
169
  diff-lcs (>= 1.2.0, < 2.0)
154
170
  rspec-support (~> 3.13.0)
155
- rspec-support (3.13.6)
156
- rubocop (1.80.2)
171
+ rspec-support (3.13.7)
172
+ rubocop (1.85.1)
157
173
  json (~> 2.3)
158
174
  language_server-protocol (~> 3.17.0.2)
159
175
  lint_roller (~> 1.1.0)
176
+ mcp (~> 0.6)
160
177
  parallel (~> 1.10)
161
178
  parser (>= 3.3.0.2)
162
179
  rainbow (>= 2.2.2, < 4.0)
163
180
  regexp_parser (>= 2.9.3, < 3.0)
164
- rubocop-ast (>= 1.46.0, < 2.0)
181
+ rubocop-ast (>= 1.49.0, < 2.0)
165
182
  ruby-progressbar (~> 1.7)
166
183
  unicode-display_width (>= 2.4.0, < 4.0)
167
- rubocop-ast (1.47.1)
184
+ rubocop-ast (1.49.1)
168
185
  parser (>= 3.3.7.2)
169
- prism (~> 1.4)
186
+ prism (~> 1.7)
170
187
  rubocop-capybara (2.22.1)
171
188
  lint_roller (~> 1.1)
172
189
  rubocop (~> 1.72, >= 1.72.1)
173
- rubocop-factory_bot (2.27.1)
190
+ rubocop-factory_bot (2.28.0)
174
191
  lint_roller (~> 1.1)
175
192
  rubocop (~> 1.72, >= 1.72.1)
176
- rubocop-performance (1.26.0)
193
+ rubocop-performance (1.26.1)
177
194
  lint_roller (~> 1.1)
178
195
  rubocop (>= 1.75.0, < 2.0)
179
- rubocop-ast (>= 1.44.0, < 2.0)
180
- rubocop-rspec (3.7.0)
196
+ rubocop-ast (>= 1.47.1, < 2.0)
197
+ rubocop-rspec (3.9.0)
181
198
  lint_roller (~> 1.1)
182
- rubocop (~> 1.72, >= 1.72.1)
183
- rubocop-rspec_rails (2.31.0)
199
+ rubocop (~> 1.81)
200
+ rubocop-rspec_rails (2.32.0)
184
201
  lint_roller (~> 1.1)
185
202
  rubocop (~> 1.72, >= 1.72.1)
186
203
  rubocop-rspec (~> 3.5)
@@ -192,28 +209,28 @@ GEM
192
209
  simplecov_json_formatter (~> 0.1)
193
210
  simplecov-html (0.13.2)
194
211
  simplecov_json_formatter (0.1.4)
212
+ simpleidn (0.2.3)
195
213
  snaky_hash (2.0.3)
196
214
  hashie (>= 0.1.0, < 6)
197
215
  version_gem (>= 1.1.8, < 3)
198
- super_diff (0.16.0)
216
+ super_diff (0.18.0)
199
217
  attr_extras (>= 6.2.4)
200
218
  diff-lcs
201
219
  patience_diff
202
- thor (1.4.0)
220
+ thor (1.5.0)
203
221
  tzinfo (2.0.6)
204
222
  concurrent-ruby (~> 1.0)
205
223
  unicode-display_width (3.2.0)
206
224
  unicode-emoji (~> 4.1)
207
- unicode-emoji (4.1.0)
208
- uri (1.0.3)
209
- vcr (6.3.1)
210
- base64
225
+ unicode-emoji (4.2.0)
226
+ uri (1.1.1)
227
+ vcr (6.4.0)
211
228
  version_gem (1.1.9)
212
- webmock (3.25.1)
229
+ webmock (3.26.2)
213
230
  addressable (>= 2.8.0)
214
231
  crack (>= 0.3.2)
215
232
  hashdiff (>= 0.4.0, < 2.0.0)
216
- zeitwerk (2.7.3)
233
+ zeitwerk (2.7.5)
217
234
 
218
235
  PLATFORMS
219
236
  arm64-darwin-23
@@ -238,4 +255,4 @@ DEPENDENCIES
238
255
  webmock
239
256
 
240
257
  BUNDLED WITH
241
- 2.7.2
258
+ 4.0.8
@@ -5,20 +5,8 @@ class SulOrcidClient
5
5
  class CocinaSupport
6
6
  # @param [Cocina::Models::Contributor] contributor to check
7
7
  # @return [String, nil] orcid id including host if present
8
- # rubocop:disable Metrics/AbcSize
9
8
  def self.orcidid(contributor)
10
- identifier = contributor.identifier.find { |check_identifier| check_identifier.type == 'ORCID' }
11
- return unless identifier
12
-
13
- # some records have the full ORCID URI in the data, just return it if so, e.g. druid:gf852zt8324
14
- return identifier.uri if identifier.uri
15
- return identifier.value if identifier.value.start_with?('https://orcid.org/')
16
-
17
- # some records have just the ORCIDID without the URL prefix, add it if so, e.g. druid:tp865ng1792
18
- return URI.join('https://orcid.org/', identifier.value).to_s if identifier.source.uri.blank?
19
-
20
- URI.join(identifier.source.uri, identifier.value).to_s
9
+ contributor.identifier.find { |check_identifier| check_identifier.type == 'ORCID' }&.uri
21
10
  end
22
- # rubocop:enable Metrics/AbcSize
23
11
  end
24
12
  end
@@ -20,6 +20,16 @@ class SulOrcidClient
20
20
  }.compact
21
21
  end
22
22
 
23
+ MARC_RELATOR_MAP = {
24
+ 'aut' => 'author',
25
+ 'cmp' => 'author',
26
+ 'ctb' => 'author',
27
+ 'cre' => 'author',
28
+ 'edt' => 'editor',
29
+ 'rth' => 'principal-investigator'
30
+ }.freeze
31
+ private_constant :MARC_RELATOR_MAP
32
+
23
33
  private
24
34
 
25
35
  attr_reader :contributor
@@ -51,12 +61,12 @@ class SulOrcidClient
51
61
 
52
62
  # find and map an ORCID from a contributor.identifier
53
63
  def map_orcid
54
- identifier = contributor.identifier.find { |check_identifier| check_identifier.type == 'ORCID' }
55
- return unless identifier
64
+ uri = CocinaSupport.orcidid(contributor)
65
+ return unless uri
56
66
 
57
67
  {
58
- uri: URI.join(identifier.source.uri, identifier.value).to_s,
59
- path: identifier.value,
68
+ uri:,
69
+ path: uri.split('/').last,
60
70
  host: 'orcid.org'
61
71
  }
62
72
  end
@@ -67,15 +77,6 @@ class SulOrcidClient
67
77
  }.compact.presence
68
78
  end
69
79
 
70
- MARC_RELATOR_MAP = {
71
- 'aut' => 'author',
72
- 'cmp' => 'author',
73
- 'ctb' => 'author',
74
- 'cre' => 'author',
75
- 'edt' => 'editor',
76
- 'rth' => 'principal-investigator'
77
- }.freeze
78
-
79
80
  def map_role
80
81
  role = contributor.role.find do |check_role|
81
82
  check_role.source&.code == 'marcrelator' && MARC_RELATOR_MAP.key?(check_role.code)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SulOrcidClient
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
@@ -11,6 +11,38 @@ class SulOrcidClient
11
11
  # Error raised by WorkMapper
12
12
  class WorkMapperError < StandardError; end
13
13
 
14
+ H2_TERM_MAP = {
15
+ 'Data' => 'data-set',
16
+ 'Software/Code' => 'software',
17
+ 'Article' => 'journal-article',
18
+ 'Book' => 'book',
19
+ 'Book chapter' => 'book-chapter',
20
+ 'Code' => 'software',
21
+ 'Conference session' => 'lecture-speech',
22
+ 'Course/instructional materials' => 'manual',
23
+ 'Database' => 'data-set',
24
+ 'Dramatic performance' => 'artistic-performance',
25
+ 'Geospatial data' => 'data-set',
26
+ 'Journal/periodical issue' => 'journal-issue',
27
+ 'Performance' => 'artistic-performance',
28
+ 'Poetry reading' => 'artistic-performance',
29
+ 'Poster' => 'conference-poster',
30
+ 'Preprint' => 'preprint',
31
+ 'Presentation recording' => 'lecture-speech',
32
+ 'Questionnaire' => 'research-technique',
33
+ 'Report' => 'report',
34
+ 'Software' => 'software',
35
+ 'Speech' => 'lecture-speech',
36
+ 'Statistical model' => 'research-technique',
37
+ 'Syllabus' => 'manual',
38
+ 'Tabular data' => 'data-set',
39
+ 'Technical report' => 'report',
40
+ 'Text corpus' => 'data-set',
41
+ 'Thesis' => 'dissertation-thesis',
42
+ 'Working paper' => 'working-paper'
43
+ }.freeze
44
+ private_constant :H2_TERM_MAP
45
+
14
46
  def self.map(description:, doi: nil)
15
47
  new(description:, doi:).map
16
48
  end
@@ -127,40 +159,11 @@ class SulOrcidClient
127
159
  end
128
160
 
129
161
  def event_value(type)
130
- description&.event&.find { |event| event.type == type }&.date&.first&.value
162
+ event = description&.event&.find { |description_event| description_event.type == type }
163
+ event_date = event&.date&.first
164
+ event_date&.value
131
165
  end
132
166
 
133
- H2_TERM_MAP = {
134
- 'Data' => 'data-set',
135
- 'Software/Code' => 'software',
136
- 'Article' => 'journal-article',
137
- 'Book' => 'book',
138
- 'Book chapter' => 'book-chapter',
139
- 'Code' => 'software',
140
- 'Conference session' => 'lecture-speech',
141
- 'Course/instructional materials' => 'manual',
142
- 'Database' => 'data-set',
143
- 'Dramatic performance' => 'artistic-performance',
144
- 'Geospatial data' => 'data-set',
145
- 'Journal/periodical issue' => 'journal-issue',
146
- 'Performance' => 'artistic-performance',
147
- 'Poetry reading' => 'artistic-performance',
148
- 'Poster' => 'conference-poster',
149
- 'Preprint' => 'preprint',
150
- 'Presentation recording' => 'lecture-speech',
151
- 'Questionnaire' => 'research-technique',
152
- 'Report' => 'report',
153
- 'Software' => 'software',
154
- 'Speech' => 'lecture-speech',
155
- 'Statistical model' => 'research-technique',
156
- 'Syllabus' => 'manual',
157
- 'Tabular data' => 'data-set',
158
- 'Technical report' => 'report',
159
- 'Text corpus' => 'data-set',
160
- 'Thesis' => 'dissertation-thesis',
161
- 'Working paper' => 'working-paper'
162
- }.freeze
163
-
164
167
  def map_type
165
168
  # See https://info.orcid.org/ufaqs/what-work-types-does-orcid-support/
166
169
  # For now, only mapping H2 terms; if there is not an H2 term, using "other".
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sul_orcid_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  - !ruby/object:Gem::Version
291
291
  version: '0'
292
292
  requirements: []
293
- rubygems_version: 3.7.0
293
+ rubygems_version: 4.0.6
294
294
  specification_version: 4
295
295
  summary: Interface for interacting with the ORCID API.
296
296
  test_files: []