sul_orcid_client 0.6.0 → 0.7.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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/sul_orcid_client/contributor_mapper.rb +5 -46
- data/lib/sul_orcid_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0b1ede02c640634f62eeeaecdc164ba772b6892cab517a3d33b3a1e6a880b8
|
4
|
+
data.tar.gz: 1e16d0da5a41b5af16c7388f84cb4fcf6384d7987ae73f5327e8e61cdc077b3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ec8a59ab3f5f8869d735eb56c04a5bf95eb4393fbd7441f3995d112e3dbb113ad532520d845406d8d2f44e1ef3675c660e566fc1794af725cd1c8f19f67bfb7
|
7
|
+
data.tar.gz: a200843b3089908ce16aae221972b002aa0d6f586f9463b069b44252deada3e93423cd4eafc0cfb77c0f169e74f746d6c48c312c84a467fa4b44a287704ab282
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sul_orcid_client (0.
|
4
|
+
sul_orcid_client (0.7.0)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
cocina-models (~> 0.90)
|
7
7
|
faraday
|
@@ -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.
|
86
|
+
faraday (2.13.2)
|
87
87
|
faraday-net_http (>= 2.0, < 3.5)
|
88
88
|
json
|
89
89
|
logger
|
@@ -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
|
-
|
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
|
-
|
59
|
-
|
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:
|
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
|
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.
|
4
|
+
version: 0.7.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-
|
11
|
+
date: 2025-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|