sul_orcid_client 0.2.0 → 0.3.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 +1 -1
- data/lib/sul_orcid_client/cocina_support.rb +27 -0
- data/lib/sul_orcid_client/contributor_mapper.rb +7 -11
- data/lib/sul_orcid_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a962456d9d06f989b7fe1fa4a95922ee3bfab33234baa35f6192398380016dc1
|
4
|
+
data.tar.gz: 7a2b53f1c0fc01c27748e6ec226f6ca271a2f356e78f3f5ac45fc9e920758fa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d41466f03921824b3325bfec46018a0874bca2f01f8e7609171cbf90f0b077c428806b61483b66158699bafbf2ad2eb4afd1d24e5613bbbef7a477c011359a3
|
7
|
+
data.tar.gz: 1fbe6359f523713b2c851c85e249e4b55b4436c4092b4f9b239059750fa6c83507385352d92b78c943c5d8117537904b928c864c13c5b83fef1b24ae150190e7
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
class SulOrcidClient
|
2
|
+
# Helper methods for working with Orcid in Cocina
|
3
|
+
class CocinaSupport
|
4
|
+
# @param [Cocina::Models::Contributor] contributor to check
|
5
|
+
# @return [Boolean] true unless the contributor has a citation status of false
|
6
|
+
def self.cited?(contributor)
|
7
|
+
contributor.note.none? { |note| note.type == "citation status" && note.value == "false" }
|
8
|
+
end
|
9
|
+
|
10
|
+
# @param [Cocina::Models::Contributor] contributor to check
|
11
|
+
# @return [String, nil] orcid id including host if present
|
12
|
+
def self.orcidid(contributor)
|
13
|
+
identifier = contributor.identifier.find { |identifier| identifier.type == "ORCID" }
|
14
|
+
return unless identifier
|
15
|
+
|
16
|
+
URI.join(identifier.source.uri, identifier.value).to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param [Cocina::Models::Description] description containing contributors to check
|
20
|
+
# @return [Array<String>] orcid ids including host if present
|
21
|
+
# Note that non-cited contributors are excluded.
|
22
|
+
def self.cited_orcidids(description)
|
23
|
+
cited_contributors = description.contributor.select { |contributor| cited?(contributor) }
|
24
|
+
cited_contributors.map { |contributor| orcidid(contributor) }.compact
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -12,7 +12,7 @@ class SulOrcidClient
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def map
|
15
|
-
return unless cited?
|
15
|
+
return unless CocinaSupport.cited?(contributor)
|
16
16
|
|
17
17
|
{
|
18
18
|
"credit-name": map_credit_name,
|
@@ -25,10 +25,6 @@ class SulOrcidClient
|
|
25
25
|
|
26
26
|
attr_reader :contributor
|
27
27
|
|
28
|
-
def cited?
|
29
|
-
contributor.note.none? { |note| note.type == "citation status" && note.value == "false" }
|
30
|
-
end
|
31
|
-
|
32
28
|
def map_credit_name
|
33
29
|
value = if contributor.name.first&.structuredValue.present?
|
34
30
|
name_from_structured_value(contributor.name.first.structuredValue)
|
@@ -68,12 +64,12 @@ class SulOrcidClient
|
|
68
64
|
end
|
69
65
|
|
70
66
|
MARC_RELATOR_MAP = {
|
71
|
-
"aut" => "
|
72
|
-
"cmp" => "
|
73
|
-
"ctb" => "
|
74
|
-
"cre" => "
|
75
|
-
"edt" => "
|
76
|
-
"rth" => "
|
67
|
+
"aut" => "author",
|
68
|
+
"cmp" => "author",
|
69
|
+
"ctb" => "author",
|
70
|
+
"cre" => "author",
|
71
|
+
"edt" => "editor",
|
72
|
+
"rth" => "principal-investigator"
|
77
73
|
}
|
78
74
|
|
79
75
|
def map_role
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Mangiafico
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-07-
|
12
|
+
date: 2023-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- README.md
|
218
218
|
- Rakefile
|
219
219
|
- lib/sul_orcid_client.rb
|
220
|
+
- lib/sul_orcid_client/cocina_support.rb
|
220
221
|
- lib/sul_orcid_client/contributor_mapper.rb
|
221
222
|
- lib/sul_orcid_client/version.rb
|
222
223
|
- lib/sul_orcid_client/work_mapper.rb
|