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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf23236a56983b63050eefbc4a1b94eb435c44a3c7e47e060f7a95e880ed0d3b
4
- data.tar.gz: 483b42d03c8e3e0ae8cf88222ca099c3690bcff4e943245c372408fc3382d141
3
+ metadata.gz: ad5eee8e5a991f6fe45a85fbd7b634b5cf924c8114f652abedd0a5e4c1028dd5
4
+ data.tar.gz: ee2620f6ef00c6059768af9288b27d7bd1569bb0620b11ba60db4c48c480ff01
5
5
  SHA512:
6
- metadata.gz: 6b4a5b5f7fdc3853892a4c71a2c285f40b41624b4e68caacfc95affefb05024d8e29ff0e36f54f421519594a5ec55f41cbf7c9261e9402f51dd8e3c43a3638ac
7
- data.tar.gz: 1fd451e5b41c1fe381d08630c28f7fda267cdb1000fbdb0125ac5b6ff37b50c0881a3d91335fb72471a1d2d9471b4ef097be45c18f9c892aedcfc2c041d97196
6
+ metadata.gz: 2ef754d68697705e5204d2a7ac2e5fd85363687207cc821c6de4769918716575cd0f4933f82661f0f913714c95fb6d61294165c977ddc741fe8da297afc7c765
7
+ data.tar.gz: bff0476cb5047e85b0549e1c7d44bcf4c9d76a5ab47cbdac3648abdeb392065be9c8bf7976440aa75eccf1f1ee081cc9478c7722dbf9ec7b65d3ef26485123da
@@ -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
@@ -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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.20'
4
+ VERSION = '0.1.22'
5
5
  end
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.20
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-17 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json