sul_orcid_client 0.6.0 → 0.8.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: c69ff816dc3d9337266431f30425887794ef50077d5e66efa667b47c337704b6
4
- data.tar.gz: c3b186808e1c8fa4f1ebda219f9b23fc313dfea14e87eec7025f10609d96a221
3
+ metadata.gz: a9f8c0cdbbd579e4e9922b2225c2780d8822b398e937ee1012d48dca1b00ad94
4
+ data.tar.gz: edb6936a029080f50ea8de31b2ea57f70a2f26ffe1c00570dd4283087ebaf5d1
5
5
  SHA512:
6
- metadata.gz: c87d4cef98681e21bd0f3cc170f90dd3a4160f3e6162e32d9d5eff9bafe320688aeb45305402b1b364f4b167dd16c4cc08f9afeedfadb993a6058fa44a1cbb79
7
- data.tar.gz: c6034b1e4f487acadce12faa1c296206faa9fdc5bcde86bf981dfd050f4e825f927947ef24683417fbf22c7a84af28e46cf2fa71d3df953c1231f840bd19e1b3
6
+ metadata.gz: 7b760b6a8c634233fa2eb71ed7c812226a2f948eaab2e32a5f9104df736bf50f733cad45c395b73d9997f4d95c1adbd0f7e28cb94fe581b63e89a6c9572057c0
7
+ data.tar.gz: 78991a512207404b5a3d456c5f3149f091a522c17b4bea4b656d20b2c33d8a182454b4a2fd003e734c0559b46d93e09273409480c26fecc7d60e66d18b4a7590
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sul_orcid_client (0.6.0)
4
+ sul_orcid_client (0.8.0)
5
5
  activesupport (>= 4.2)
6
6
  cocina-models (~> 0.90)
7
7
  faraday
@@ -12,7 +12,7 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (8.0.2)
15
+ activesupport (8.0.2.1)
16
16
  base64
17
17
  benchmark (>= 0.3)
18
18
  bigdecimal
@@ -31,9 +31,9 @@ GEM
31
31
  attr_extras (7.1.0)
32
32
  base64 (0.3.0)
33
33
  benchmark (0.4.1)
34
- bigdecimal (3.2.2)
34
+ bigdecimal (3.2.3)
35
35
  byebug (12.0.0)
36
- cocina-models (0.104.1)
36
+ cocina-models (0.106.0)
37
37
  activesupport
38
38
  deprecation
39
39
  dry-struct (~> 1.0)
@@ -48,7 +48,7 @@ GEM
48
48
  thor
49
49
  zeitwerk (~> 2.1)
50
50
  concurrent-ruby (1.3.5)
51
- connection_pool (2.5.3)
51
+ connection_pool (2.5.4)
52
52
  crack (1.0.0)
53
53
  bigdecimal
54
54
  rexml
@@ -83,7 +83,7 @@ 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.1)
86
+ faraday (2.13.4)
87
87
  faraday-net_http (>= 2.0, < 3.5)
88
88
  json
89
89
  logger
@@ -91,12 +91,12 @@ GEM
91
91
  net-http (>= 0.5.0)
92
92
  faraday-retry (2.3.2)
93
93
  faraday (~> 2.0)
94
- hashdiff (1.2.0)
94
+ hashdiff (1.2.1)
95
95
  hashie (5.0.0)
96
96
  i18n (1.14.7)
97
97
  concurrent-ruby (~> 1.0)
98
98
  ice_nine (0.11.2)
99
- json (2.12.2)
99
+ json (2.14.1)
100
100
  jsonpath (1.1.5)
101
101
  multi_json
102
102
  jwt (3.1.2)
@@ -105,41 +105,41 @@ GEM
105
105
  lint_roller (1.1.0)
106
106
  logger (1.7.0)
107
107
  minitest (5.25.5)
108
- multi_json (1.15.0)
108
+ multi_json (1.17.0)
109
109
  multi_xml (0.7.2)
110
110
  bigdecimal (~> 3.1)
111
111
  net-http (0.6.0)
112
112
  uri
113
- nokogiri (1.18.8-arm64-darwin)
113
+ nokogiri (1.18.10-arm64-darwin)
114
114
  racc (~> 1.4)
115
- nokogiri (1.18.8-x86_64-darwin)
115
+ nokogiri (1.18.10-x86_64-darwin)
116
116
  racc (~> 1.4)
117
- nokogiri (1.18.8-x86_64-linux-gnu)
117
+ nokogiri (1.18.10-x86_64-linux-gnu)
118
118
  racc (~> 1.4)
119
- oauth2 (2.0.12)
119
+ oauth2 (2.0.17)
120
120
  faraday (>= 0.17.3, < 4.0)
121
121
  jwt (>= 1.0, < 4.0)
122
122
  logger (~> 1.2)
123
123
  multi_xml (~> 0.5)
124
124
  rack (>= 1.2, < 4)
125
125
  snaky_hash (~> 2.0, >= 2.0.3)
126
- version_gem (>= 1.1.8, < 3)
126
+ version_gem (~> 1.1, >= 1.1.9)
127
127
  openapi_parser (1.0.0)
128
128
  optimist (3.2.1)
129
129
  parallel (1.27.0)
130
- parser (3.3.8.0)
130
+ parser (3.3.9.0)
131
131
  ast (~> 2.4.1)
132
132
  racc
133
133
  patience_diff (1.2.0)
134
134
  optimist (~> 3.0)
135
- prism (1.4.0)
135
+ prism (1.5.1)
136
136
  public_suffix (6.0.2)
137
137
  racc (1.8.1)
138
- rack (3.1.16)
138
+ rack (3.2.1)
139
139
  rainbow (3.1.1)
140
140
  rake (13.3.0)
141
- regexp_parser (2.10.0)
142
- rexml (3.4.1)
141
+ regexp_parser (2.11.3)
142
+ rexml (3.4.4)
143
143
  rspec (3.13.1)
144
144
  rspec-core (~> 3.13.0)
145
145
  rspec-expectations (~> 3.13.0)
@@ -152,8 +152,8 @@ GEM
152
152
  rspec-mocks (3.13.5)
153
153
  diff-lcs (>= 1.2.0, < 2.0)
154
154
  rspec-support (~> 3.13.0)
155
- rspec-support (3.13.4)
156
- rubocop (1.77.0)
155
+ rspec-support (3.13.6)
156
+ rubocop (1.80.2)
157
157
  json (~> 2.3)
158
158
  language_server-protocol (~> 3.17.0.2)
159
159
  lint_roller (~> 1.1.0)
@@ -161,10 +161,10 @@ GEM
161
161
  parser (>= 3.3.0.2)
162
162
  rainbow (>= 2.2.2, < 4.0)
163
163
  regexp_parser (>= 2.9.3, < 3.0)
164
- rubocop-ast (>= 1.45.1, < 2.0)
164
+ rubocop-ast (>= 1.46.0, < 2.0)
165
165
  ruby-progressbar (~> 1.7)
166
166
  unicode-display_width (>= 2.4.0, < 4.0)
167
- rubocop-ast (1.45.1)
167
+ rubocop-ast (1.47.1)
168
168
  parser (>= 3.3.7.2)
169
169
  prism (~> 1.4)
170
170
  rubocop-capybara (2.22.1)
@@ -173,11 +173,11 @@ GEM
173
173
  rubocop-factory_bot (2.27.1)
174
174
  lint_roller (~> 1.1)
175
175
  rubocop (~> 1.72, >= 1.72.1)
176
- rubocop-performance (1.25.0)
176
+ rubocop-performance (1.26.0)
177
177
  lint_roller (~> 1.1)
178
178
  rubocop (>= 1.75.0, < 2.0)
179
- rubocop-ast (>= 1.38.0, < 2.0)
180
- rubocop-rspec (3.6.0)
179
+ rubocop-ast (>= 1.44.0, < 2.0)
180
+ rubocop-rspec (3.7.0)
181
181
  lint_roller (~> 1.1)
182
182
  rubocop (~> 1.72, >= 1.72.1)
183
183
  rubocop-rspec_rails (2.31.0)
@@ -190,7 +190,7 @@ GEM
190
190
  docile (~> 1.1)
191
191
  simplecov-html (~> 0.11)
192
192
  simplecov_json_formatter (~> 0.1)
193
- simplecov-html (0.13.1)
193
+ simplecov-html (0.13.2)
194
194
  simplecov_json_formatter (0.1.4)
195
195
  snaky_hash (2.0.3)
196
196
  hashie (>= 0.1.0, < 6)
@@ -199,16 +199,16 @@ GEM
199
199
  attr_extras (>= 6.2.4)
200
200
  diff-lcs
201
201
  patience_diff
202
- thor (1.3.2)
202
+ thor (1.4.0)
203
203
  tzinfo (2.0.6)
204
204
  concurrent-ruby (~> 1.0)
205
- unicode-display_width (3.1.4)
206
- unicode-emoji (~> 4.0, >= 4.0.4)
207
- unicode-emoji (4.0.4)
205
+ unicode-display_width (3.2.0)
206
+ unicode-emoji (~> 4.1)
207
+ unicode-emoji (4.1.0)
208
208
  uri (1.0.3)
209
209
  vcr (6.3.1)
210
210
  base64
211
- version_gem (1.1.8)
211
+ version_gem (1.1.9)
212
212
  webmock (3.25.1)
213
213
  addressable (>= 2.8.0)
214
214
  crack (>= 0.3.2)
@@ -238,4 +238,4 @@ DEPENDENCIES
238
238
  webmock
239
239
 
240
240
  BUNDLED WITH
241
- 2.6.9
241
+ 2.7.2
@@ -38,7 +38,6 @@ class SulOrcidClient
38
38
  }
39
39
  end
40
40
 
41
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
42
41
  def name_from_structured_value(structured_value)
43
42
  forename = structured_value.find { |name_part| name_part.type == 'forename' }&.value
44
43
  surname = structured_value.find { |name_part| name_part.type == 'surname' }&.value
@@ -46,62 +45,22 @@ class SulOrcidClient
46
45
  if forename.present? || surname.present?
47
46
  [forename, surname].compact.join(' ')
48
47
  else
49
- # take first value for the Stanford University organization. Do not map the department/institute suborganization for now.
50
- structured_value.first&.value
48
+ structured_value.first.value
51
49
  end
52
50
  end
53
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
54
-
55
- IDENTIFIER_TYPES = %w[ORCID ROR].freeze
56
51
 
52
+ # find and map an ORCID from a contributor.identifier
57
53
  def map_orcid
58
- if contributor.name.first&.structuredValue.present?
59
- # there could be an identifier in the structuredValue if it has a suborganization
60
- if contributor.name.first.structuredValue.first&.identifier.present?
61
- orcid_from_structured_value
62
- else
63
- orcid_from_contributor
64
- end
65
- else
66
- orcid_from_contributor
67
- end
68
- end
69
-
70
- def identifier_from_structured_value(structured_value)
71
- structured_value.identifier.find { |identifier| IDENTIFIER_TYPES.include?(identifier.type) }
72
- end
73
-
74
- # the identifier in the structuredValue has the uri in a different properties than a top-level contributor.identifier
75
- def map_orcid_from_structured_value(identifier)
76
- {
77
- uri: identifier.uri || identifier.value,
78
- path: URI(identifier.uri).path.split('/').last,
79
- host: identifier.type == 'ORCID' ? 'orcid.org' : 'ror.org'
80
- }
81
- end
54
+ identifier = contributor.identifier.find { |check_identifier| check_identifier.type == 'ORCID' }
55
+ return unless identifier
82
56
 
83
- def map_orcid_from_contributor(identifier)
84
57
  {
85
58
  uri: URI.join(identifier.source.uri, identifier.value).to_s,
86
59
  path: identifier.value,
87
- host: identifier.type == 'ORCID' ? 'orcid.org' : 'ror.org'
60
+ host: 'orcid.org'
88
61
  }
89
62
  end
90
63
 
91
- # find and map an orcid from a contributor.identifier
92
- def orcid_from_contributor
93
- identifier = contributor.identifier.find { |check_identifier| IDENTIFIER_TYPES.include?(check_identifier.type) }
94
- return unless identifier
95
-
96
- map_orcid_from_contributor(identifier)
97
- end
98
-
99
- # find and map an orcid from a contributor.structuredValue.identifier
100
- def orcid_from_structured_value
101
- identifier = identifier_from_structured_value(contributor.name.first.structuredValue.first)
102
- map_orcid_from_structured_value(identifier)
103
- end
104
-
105
64
  def map_attributes
106
65
  {
107
66
  'contributor-role': map_role
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SulOrcidClient
4
- VERSION = '0.6.0'
4
+ VERSION = '0.8.0'
5
5
  end
@@ -44,7 +44,7 @@ class SulOrcidClient
44
44
  attr_reader :description, :doi
45
45
 
46
46
  def map_title
47
- title = description.title.first&.value
47
+ title = simple_title.presence || structured_title
48
48
  raise WorkMapperError, 'Title not mapped' unless title
49
49
 
50
50
  {
@@ -54,6 +54,20 @@ class SulOrcidClient
54
54
  }
55
55
  end
56
56
 
57
+ def simple_title
58
+ first_title&.value
59
+ end
60
+
61
+ def structured_title
62
+ return if first_title.structuredValue.blank?
63
+
64
+ first_title.structuredValue.find { |sv| sv.type == 'main title' }&.value
65
+ end
66
+
67
+ def first_title
68
+ description.title.first
69
+ end
70
+
57
71
  def map_short_description
58
72
  description.note.find { |note| note.type == 'abstract' }&.value
59
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sul_orcid_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
8
8
  - Justin Littman
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-07-07 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -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.6.2
293
+ rubygems_version: 3.7.0
294
294
  specification_version: 4
295
295
  summary: Interface for interacting with the ORCID API.
296
296
  test_files: []