uc3-dmp-id 0.1.20 → 0.1.22
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/finder.rb +13 -0
- data/lib/uc3-dmp-id/helper.rb +1 -0
- data/lib/uc3-dmp-id/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: ad5eee8e5a991f6fe45a85fbd7b634b5cf924c8114f652abedd0a5e4c1028dd5
|
4
|
+
data.tar.gz: ee2620f6ef00c6059768af9288b27d7bd1569bb0620b11ba60db4c48c480ff01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ef754d68697705e5204d2a7ac2e5fd85363687207cc821c6de4769918716575cd0f4933f82661f0f913714c95fb6d61294165c977ddc741fe8da297afc7c765
|
7
|
+
data.tar.gz: bff0476cb5047e85b0549e1c7d44bcf4c9d76a5ab47cbdac3648abdeb392065be9c8bf7976440aa75eccf1f1ee081cc9478c7722dbf9ec7b65d3ef26485123da
|
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/helper.rb
CHANGED
@@ -238,6 +238,7 @@ module Uc3DmpId
|
|
238
238
|
cleansed = {}
|
239
239
|
allowable = %w[dmphub_modifications dmphub_versions]
|
240
240
|
json.each_key do |key|
|
241
|
+
next if key.to_s == 'mbox'
|
241
242
|
next if (key.to_s.start_with?('dmphub') && !allowable.include?(key)) || %w[PK SK].include?(key.to_s)
|
242
243
|
|
243
244
|
obj = json[key]
|
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.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Riley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|