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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0375f36323f6e846bd14ad18a345a0ef42cc29ad9255e26c926f4d18c0960515
4
- data.tar.gz: b9f5cf963f505420438731225b2663bf4d85dae6683386104d8466808588a804
3
+ metadata.gz: f674498812ad6dd609d31d6cdec534b1e00699af069c22ab475a4de40958d234
4
+ data.tar.gz: '039213d29f4d89c3694379090e828fa5a338776072f8e4dc58b8d8e564a9fd7d'
5
5
  SHA512:
6
- metadata.gz: 783bb2a9de8175a6c4cd57c879e6dc8a1ae0070e6e25bc344e3fbebb5791ca1cdb25718031c91d078fcba5a94f7e058cf84d4394e3bab0877d7b402a8109a95f
7
- data.tar.gz: b75ab3c52824b16fd8bd2452272b0defd5a2663e2a62980eb405e5f323089f26ac7e65f4aee2eae2cefacf3fb209e85ff00a391e4a32623e6abfd9ce70d48acb
6
+ metadata.gz: 511f125ca791f22e29cc066c1cc5e3085fd09e94d9a6b2243c9d6d3851e114ad1f30e11e975392bfd768662375d6dd5ac53f56774877a69025099ccf37d3ef88
7
+ data.tar.gz: cf6c213442cfbc5e9d1efc71393850f3111570f62f90a462bffc4eac90f11016c6e465f01d5ed64fe41a5ed798a9c2c155001b9865ea2052f3e7d7cd1c57b77c
@@ -44,8 +44,10 @@ module Uc3DmpId
44
44
 
45
45
  # Set the :created and :modified timestamps
46
46
  now = Time.now.utc.iso8601
47
- annotated['created'] = now
48
- annotated['modified'] = now
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:)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.19'
4
+ VERSION = '0.1.21'
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.19
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: 2023-11-09 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
@@ -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.10
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