uc3-dmp-id 0.1.19 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/creator.rb +4 -2
- data/lib/uc3-dmp-id/finder.rb +13 -0
- data/lib/uc3-dmp-id/version.rb +1 -1
- 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: f674498812ad6dd609d31d6cdec534b1e00699af069c22ab475a4de40958d234
|
4
|
+
data.tar.gz: '039213d29f4d89c3694379090e828fa5a338776072f8e4dc58b8d8e564a9fd7d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 511f125ca791f22e29cc066c1cc5e3085fd09e94d9a6b2243c9d6d3851e114ad1f30e11e975392bfd768662375d6dd5ac53f56774877a69025099ccf37d3ef88
|
7
|
+
data.tar.gz: cf6c213442cfbc5e9d1efc71393850f3111570f62f90a462bffc4eac90f11016c6e465f01d5ed64fe41a5ed798a9c2c155001b9865ea2052f3e7d7cd1c57b77c
|
data/lib/uc3-dmp-id/creator.rb
CHANGED
@@ -44,8 +44,10 @@ module Uc3DmpId
|
|
44
44
|
|
45
45
|
# Set the :created and :modified timestamps
|
46
46
|
now = Time.now.utc.iso8601
|
47
|
-
|
48
|
-
|
47
|
+
seeding = provenance.fetch('seedingWithLiveDmpIds', false).to_s.downcase == 'true'
|
48
|
+
# Do not overwrite the created/modified timestamps if we are seeding!
|
49
|
+
annotated['created'] = now unless seeding
|
50
|
+
annotated['modified'] = now unless seeding
|
49
51
|
|
50
52
|
# Create the item
|
51
53
|
resp = client.put_item(json: annotated, logger:)
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -76,6 +76,7 @@ module Uc3DmpId
|
|
76
76
|
return nil if dmp['dmp']['PK'].nil?
|
77
77
|
|
78
78
|
dmp = Versioner.append_versions(p_key: dmp['dmp']['PK'], dmp:, client:, logger:) if cleanse
|
79
|
+
dmp = _remove_narrative_if_private(json: dmp)
|
79
80
|
cleanse ? Helper.cleanse_dmp_json(json: dmp) : dmp
|
80
81
|
end
|
81
82
|
# rubocop:enable Metrics/AbcSize
|
@@ -207,10 +208,22 @@ module Uc3DmpId
|
|
207
208
|
next if item.nil?
|
208
209
|
|
209
210
|
dmp = item['dmp'].nil? ? JSON.parse({ dmp: item }.to_json) : item
|
211
|
+
dmp = _remove_narrative_if_private(json: dmp)
|
210
212
|
Helper.cleanse_dmp_json(json: dmp)
|
211
213
|
end
|
212
214
|
results.compact.uniq
|
213
215
|
end
|
216
|
+
|
217
|
+
# Remove the download URL if the DMP is private
|
218
|
+
def _remove_narrative_if_private(json:)
|
219
|
+
privacy_mode = json['dmp'].fetch('dmproadmap_privacy', 'private')&.downcase&.strip
|
220
|
+
return json if privacy_mode == 'public' || json['dmp'].fetch('dmproadmap_related_identifiers', []).empty?
|
221
|
+
|
222
|
+
json['dmp']['dmproadmap_related_identifiers'] = json['dmp']['dmproadmap_related_identifiers'].reject do |id|
|
223
|
+
id['descriptor'] == 'is_metadata_for' && id['work_type'] == 'output_management_plan'
|
224
|
+
end
|
225
|
+
json
|
226
|
+
end
|
214
227
|
end
|
215
228
|
end
|
216
229
|
end
|
data/lib/uc3-dmp-id/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uc3-dmp-id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
|
-
rubygems_version: 3.4.
|
153
|
+
rubygems_version: 3.4.22
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: DMPTool gem that provides support for DMP ID records
|