sul_orcid_client 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +53 -38
- data/README.md +4 -4
- data/lib/sul_orcid_client/cocina_support.rb +9 -1
- data/lib/sul_orcid_client/version.rb +1 -1
- data/lib/sul_orcid_client.rb +4 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1cb74cbce1d27862da0f058974e0ca4233e5e8cbcaa956ce5682be779206bb0
|
4
|
+
data.tar.gz: 71e80c4c62957681faf99df97cc843e34d83c3c450b1cb7471b2d39ad347adce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09f5190810198153c3f5a6726113f8d57cfa1942ead9a38aa43c392c5b42ec7f7403a228c35f4e04a79a0e18696916b066900f7faf33429abda23eeeeb8c955e'
|
7
|
+
data.tar.gz: 016d439926b46f5098a659fed9a90b1fe4f4fb699b8edee598861d4bdf04f3f791d2144785c642d4c4fa657213dcf87da5b49d867c986f451d5e23d7cca2b522
|
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.4.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
6
|
cocina-models (~> 0.90)
|
7
7
|
faraday
|
@@ -12,40 +12,51 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (7.
|
15
|
+
activesupport (7.1.2)
|
16
|
+
base64
|
17
|
+
bigdecimal
|
16
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
|
+
connection_pool (>= 2.2.5)
|
20
|
+
drb
|
17
21
|
i18n (>= 1.6, < 2)
|
18
22
|
minitest (>= 5.1)
|
23
|
+
mutex_m
|
19
24
|
tzinfo (~> 2.0)
|
20
|
-
addressable (2.8.
|
25
|
+
addressable (2.8.5)
|
21
26
|
public_suffix (>= 2.0.2, < 6.0)
|
22
27
|
ast (2.4.2)
|
23
28
|
attr_extras (7.1.0)
|
29
|
+
base64 (0.2.0)
|
30
|
+
bigdecimal (3.1.4)
|
24
31
|
byebug (11.1.3)
|
25
|
-
cocina-models (0.
|
32
|
+
cocina-models (0.93.0)
|
26
33
|
activesupport
|
27
34
|
deprecation
|
28
35
|
dry-struct (~> 1.0)
|
29
36
|
dry-types (~> 1.1)
|
30
37
|
edtf
|
31
38
|
equivalent-xml
|
39
|
+
i18n
|
32
40
|
jsonpath
|
33
41
|
nokogiri
|
34
42
|
openapi3_parser
|
35
|
-
openapi_parser (
|
43
|
+
openapi_parser (~> 1.0)
|
36
44
|
rss
|
37
45
|
super_diff
|
38
46
|
thor
|
39
47
|
zeitwerk (~> 2.1)
|
40
|
-
commonmarker (0.23.
|
48
|
+
commonmarker (0.23.10)
|
41
49
|
concurrent-ruby (1.2.2)
|
50
|
+
connection_pool (2.4.1)
|
42
51
|
crack (0.4.5)
|
43
52
|
rexml
|
44
53
|
deprecation (1.1.0)
|
45
54
|
activesupport
|
46
55
|
diff-lcs (1.5.0)
|
47
56
|
docile (1.4.0)
|
48
|
-
|
57
|
+
drb (2.2.0)
|
58
|
+
ruby2_keywords
|
59
|
+
dry-core (1.0.1)
|
49
60
|
concurrent-ruby (~> 1.0)
|
50
61
|
zeitwerk (~> 2.6)
|
51
62
|
dry-inflector (1.0.0)
|
@@ -68,7 +79,8 @@ GEM
|
|
68
79
|
activesupport (>= 3.0, < 8.0)
|
69
80
|
equivalent-xml (0.6.0)
|
70
81
|
nokogiri (>= 1.4.3)
|
71
|
-
faraday (2.7.
|
82
|
+
faraday (2.7.11)
|
83
|
+
base64
|
72
84
|
faraday-net_http (>= 2.0, < 3.1)
|
73
85
|
ruby2_keywords (>= 0.0.4)
|
74
86
|
faraday-net_http (3.0.2)
|
@@ -80,17 +92,18 @@ GEM
|
|
80
92
|
concurrent-ruby (~> 1.0)
|
81
93
|
ice_nine (0.11.2)
|
82
94
|
json (2.6.3)
|
83
|
-
jsonpath (1.1.
|
95
|
+
jsonpath (1.1.5)
|
84
96
|
multi_json
|
85
97
|
jwt (2.7.1)
|
86
98
|
language_server-protocol (3.17.0.3)
|
87
99
|
lint_roller (1.1.0)
|
88
|
-
minitest (5.
|
100
|
+
minitest (5.20.0)
|
89
101
|
multi_json (1.15.0)
|
90
102
|
multi_xml (0.6.0)
|
91
|
-
|
103
|
+
mutex_m (0.2.0)
|
104
|
+
nokogiri (1.15.4-x86_64-darwin)
|
92
105
|
racc (~> 1.4)
|
93
|
-
nokogiri (1.15.
|
106
|
+
nokogiri (1.15.4-x86_64-linux)
|
94
107
|
racc (~> 1.4)
|
95
108
|
oauth2 (2.0.9)
|
96
109
|
faraday (>= 0.17.3, < 3.0)
|
@@ -101,21 +114,21 @@ GEM
|
|
101
114
|
version_gem (~> 1.1)
|
102
115
|
openapi3_parser (0.9.2)
|
103
116
|
commonmarker (~> 0.17)
|
104
|
-
openapi_parser (0.
|
105
|
-
optimist (3.0
|
117
|
+
openapi_parser (1.0.0)
|
118
|
+
optimist (3.1.0)
|
106
119
|
parallel (1.23.0)
|
107
|
-
parser (3.2.2.
|
120
|
+
parser (3.2.2.4)
|
108
121
|
ast (~> 2.4.1)
|
109
122
|
racc
|
110
123
|
patience_diff (1.2.0)
|
111
124
|
optimist (~> 3.0)
|
112
125
|
public_suffix (5.0.3)
|
113
|
-
racc (1.7.
|
126
|
+
racc (1.7.3)
|
114
127
|
rack (3.0.8)
|
115
128
|
rainbow (3.1.1)
|
116
|
-
rake (13.0
|
117
|
-
regexp_parser (2.8.
|
118
|
-
rexml (3.2.
|
129
|
+
rake (13.1.0)
|
130
|
+
regexp_parser (2.8.2)
|
131
|
+
rexml (3.2.6)
|
119
132
|
rspec (3.12.0)
|
120
133
|
rspec-core (~> 3.12.0)
|
121
134
|
rspec-expectations (~> 3.12.0)
|
@@ -129,29 +142,30 @@ GEM
|
|
129
142
|
diff-lcs (>= 1.2.0, < 2.0)
|
130
143
|
rspec-support (~> 3.12.0)
|
131
144
|
rspec-support (3.12.1)
|
132
|
-
rss (0.
|
145
|
+
rss (0.3.0)
|
133
146
|
rexml
|
134
|
-
rubocop (1.
|
147
|
+
rubocop (1.57.2)
|
135
148
|
json (~> 2.3)
|
149
|
+
language_server-protocol (>= 3.17.0)
|
136
150
|
parallel (~> 1.10)
|
137
|
-
parser (>= 3.2.2.
|
151
|
+
parser (>= 3.2.2.4)
|
138
152
|
rainbow (>= 2.2.2, < 4.0)
|
139
153
|
regexp_parser (>= 1.8, < 3.0)
|
140
154
|
rexml (>= 3.2.5, < 4.0)
|
141
|
-
rubocop-ast (>= 1.28.
|
155
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
142
156
|
ruby-progressbar (~> 1.7)
|
143
157
|
unicode-display_width (>= 2.4.0, < 3.0)
|
144
|
-
rubocop-ast (1.
|
158
|
+
rubocop-ast (1.30.0)
|
145
159
|
parser (>= 3.2.1.0)
|
146
|
-
rubocop-capybara (2.
|
160
|
+
rubocop-capybara (2.19.0)
|
147
161
|
rubocop (~> 1.41)
|
148
|
-
rubocop-factory_bot (2.
|
162
|
+
rubocop-factory_bot (2.24.0)
|
149
163
|
rubocop (~> 1.33)
|
150
|
-
rubocop-performance (1.
|
164
|
+
rubocop-performance (1.19.1)
|
151
165
|
rubocop (>= 1.7.0, < 2.0)
|
152
166
|
rubocop-ast (>= 0.4.0)
|
153
|
-
rubocop-rspec (2.
|
154
|
-
rubocop (~> 1.
|
167
|
+
rubocop-rspec (2.25.0)
|
168
|
+
rubocop (~> 1.40)
|
155
169
|
rubocop-capybara (~> 2.17)
|
156
170
|
rubocop-factory_bot (~> 2.22)
|
157
171
|
ruby-progressbar (1.13.0)
|
@@ -165,35 +179,36 @@ GEM
|
|
165
179
|
snaky_hash (2.0.1)
|
166
180
|
hashie
|
167
181
|
version_gem (~> 1.1, >= 1.1.1)
|
168
|
-
standard (1.
|
182
|
+
standard (1.32.0)
|
169
183
|
language_server-protocol (~> 3.17.0.2)
|
170
184
|
lint_roller (~> 1.0)
|
171
|
-
rubocop (~> 1.
|
185
|
+
rubocop (~> 1.57.2)
|
172
186
|
standard-custom (~> 1.0.0)
|
173
|
-
standard-performance (~> 1.
|
187
|
+
standard-performance (~> 1.2)
|
174
188
|
standard-custom (1.0.2)
|
175
189
|
lint_roller (~> 1.0)
|
176
190
|
rubocop (~> 1.50)
|
177
|
-
standard-performance (1.
|
191
|
+
standard-performance (1.2.1)
|
178
192
|
lint_roller (~> 1.1)
|
179
|
-
rubocop-performance (~> 1.
|
193
|
+
rubocop-performance (~> 1.19.1)
|
180
194
|
super_diff (0.10.0)
|
181
195
|
attr_extras (>= 6.2.4)
|
182
196
|
diff-lcs
|
183
197
|
patience_diff
|
184
|
-
thor (1.
|
198
|
+
thor (1.3.0)
|
185
199
|
tzinfo (2.0.6)
|
186
200
|
concurrent-ruby (~> 1.0)
|
187
|
-
unicode-display_width (2.
|
201
|
+
unicode-display_width (2.5.0)
|
188
202
|
vcr (6.2.0)
|
189
203
|
version_gem (1.1.3)
|
190
|
-
webmock (3.
|
204
|
+
webmock (3.19.1)
|
191
205
|
addressable (>= 2.8.0)
|
192
206
|
crack (>= 0.3.2)
|
193
207
|
hashdiff (>= 0.4.0, < 2.0.0)
|
194
|
-
zeitwerk (2.6.
|
208
|
+
zeitwerk (2.6.12)
|
195
209
|
|
196
210
|
PLATFORMS
|
211
|
+
x86_64-darwin-19
|
197
212
|
x86_64-darwin-22
|
198
213
|
x86_64-linux
|
199
214
|
|
data/README.md
CHANGED
@@ -29,8 +29,8 @@ require "sul_orcid_client"
|
|
29
29
|
client = SulOrcidClient.configure(
|
30
30
|
client_id: Settings.orcid.client_id,
|
31
31
|
client_secret: Settings.orcid.client_secret,
|
32
|
-
base_url: Settings.orcid.base_url
|
33
|
-
base_public_url: Settings.orcid.base_public_url
|
32
|
+
base_url: Settings.orcid.base_url,
|
33
|
+
base_public_url: Settings.orcid.base_public_url,
|
34
34
|
base_auth_url: Settings.orcid.base_auth_url
|
35
35
|
)
|
36
36
|
client.fetch_works(orcidid: 'https://sandbox.orcid.org/0000-0002-7262-6251')
|
@@ -46,8 +46,8 @@ to be sure configuration has already occurred, e.g.:
|
|
46
46
|
SulOrcidClient.configure(
|
47
47
|
client_id: Settings.orcid.client_id,
|
48
48
|
client_secret: Settings.orcid.client_secret,
|
49
|
-
base_url: Settings.orcid.base_url
|
50
|
-
base_public_url: Settings.orcid.base_public_url
|
49
|
+
base_url: Settings.orcid.base_url,
|
50
|
+
base_public_url: Settings.orcid.base_public_url,
|
51
51
|
base_auth_url: Settings.orcid.base_auth_url
|
52
52
|
)
|
53
53
|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
class SulOrcidClient
|
2
2
|
# Helper methods for working with Orcid in Cocina
|
3
|
+
# NOTE: there is similar code in dor_indexing_app which fetches
|
4
|
+
# ORCIDs out of cocina. Consider consolidating at some point or keeping in sync.
|
5
|
+
# see https://github.com/sul-dlss/dor_indexing_app/blob/main/app/services/orcid_builder.rb
|
6
|
+
# and https://github.com/sul-dlss/dor_indexing_app/issues/1022
|
3
7
|
class CocinaSupport
|
4
8
|
# @param [Cocina::Models::Contributor] contributor to check
|
5
9
|
# @return [Boolean] true unless the contributor has a citation status of false
|
@@ -13,7 +17,11 @@ class SulOrcidClient
|
|
13
17
|
identifier = contributor.identifier.find { |identifier| identifier.type == "ORCID" }
|
14
18
|
return unless identifier
|
15
19
|
|
16
|
-
URI
|
20
|
+
# some records have the full ORCID URI in the data, just return it if so, e.g. druid:gf852zt8324
|
21
|
+
return identifier.uri if identifier.uri
|
22
|
+
return identifier.value if identifier.value.start_with?("https://orcid.org/")
|
23
|
+
|
24
|
+
URI.join("https://orcid.org/", identifier.value).to_s
|
17
25
|
end
|
18
26
|
|
19
27
|
# @param [Cocina::Models::Description] description containing contributors to check
|
data/lib/sul_orcid_client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "active_support
|
4
|
-
require "active_support/core_ext
|
3
|
+
require "active_support"
|
4
|
+
require "active_support/core_ext"
|
5
5
|
|
6
6
|
require "faraday"
|
7
7
|
require "faraday/retry"
|
@@ -136,6 +136,8 @@ class SulOrcidClient
|
|
136
136
|
work.merge({"put-code" => put_code}).to_json,
|
137
137
|
"Content-Type" => "application/vnd.orcid+json")
|
138
138
|
|
139
|
+
raise "ORCID.org API returned #{response.status} when updating #{put_code} for #{orcidid}. The author may have previously deleted this work from their ORCID profile." if response.status == 404
|
140
|
+
|
139
141
|
raise "ORCID.org API returned #{response.status} when updating #{put_code} for #{orcidid}" unless response.status == 200
|
140
142
|
true
|
141
143
|
end
|
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.4.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-
|
12
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
- !ruby/object:Gem::Version
|
245
245
|
version: '0'
|
246
246
|
requirements: []
|
247
|
-
rubygems_version: 3.4.
|
247
|
+
rubygems_version: 3.4.21
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: Interface for interacting with the ORCID API.
|