uc3-dmp-id 0.0.81 → 0.0.82
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/updater.rb +3 -4
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b007856ad5a2979b663ac9bca26022d13aa08c854d36db99f6b5073f3d96c914
|
4
|
+
data.tar.gz: 96b951823afd6c995b824ce8047792a5e90b56fc9f6636a0a33c20ce05101796
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25266f1a148076550a27e53813b5ee074e6379505d894715532d6945cfb299ce6aa1002fa1a3fc02490429421db7256e10459bcc791d2115134d56aa18e7988d
|
7
|
+
data.tar.gz: 54102b178db027bd0e496cdc1ee703e3180d2a1a020a20da113dc919f1479bb15311c50c892198ae8d47a8de5473e5d636d98e6903c28c8c8c12ee548d898a03
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -13,7 +13,6 @@ module Uc3DmpId
|
|
13
13
|
raise UpdaterError, MSG_DMP_INVALID_DMP_ID unless p_key.is_a?(String) && !p_key.strip.empty?
|
14
14
|
|
15
15
|
dmp = Helper.parse_json(json: json)
|
16
|
-
dmp = dmp['dmp'].nil? ? dmp : dmp['dmp']
|
17
16
|
p_key = Helper.append_pk_prefix(p_key: p_key)
|
18
17
|
errs = _updateable?(provenance: provenance, p_key: p_key, json: dmp)
|
19
18
|
|
@@ -34,7 +33,7 @@ puts annotated
|
|
34
33
|
raise UpdaterError, MSG_NO_CHANGE if Helper.eql?(dmp_a: existing, dmp_b: annotated)
|
35
34
|
|
36
35
|
# Generate a new version of the DMP. This involves versioning the current latest version
|
37
|
-
new_version = versioner.new_version(p_key: p_key, dmp:
|
36
|
+
new_version = versioner.new_version(p_key: p_key, dmp: annotated)
|
38
37
|
|
39
38
|
puts 'DMP after splicing all changes:'
|
40
39
|
puts new_version
|
@@ -85,13 +84,13 @@ puts new_version
|
|
85
84
|
errs = Validator.validate(mode: 'author', json: json)
|
86
85
|
return errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
|
87
86
|
|
88
|
-
puts "Provenance: #{provenance['PK']}, DMP_ID to PK #{Helper.dmp_id_to_pk(json: json.fetch('dmp_id', {}))} == P_KEY: #{p_key}"
|
87
|
+
puts "Provenance: #{provenance['PK']}, DMP_ID to PK #{Helper.dmp_id_to_pk(json: json['dmp'].fetch('dmp_id', {}))} == P_KEY: #{p_key}"
|
89
88
|
|
90
89
|
# Fail if the provenance is not defined
|
91
90
|
return [MSG_DMP_FORBIDDEN] unless provenance.is_a?(Hash) && !provenance['PK'].nil?
|
92
91
|
|
93
92
|
# Verify that the JSON is for the same DMP in the PK
|
94
|
-
dmp_id = json.fetch('dmp_id', {})
|
93
|
+
dmp_id = json['dmp'].fetch('dmp_id', {})
|
95
94
|
return [MSG_DMP_FORBIDDEN] unless Helper.dmp_id_to_pk(json: dmp_id) == p_key
|
96
95
|
# Make sure they're not trying to update a historical copy of the DMP
|
97
96
|
return [MSG_DMP_NO_HISTORICALS] if json['SK'] != Helper::DMP_LATEST_VERSION
|
data/lib/uc3-dmp-id/version.rb
CHANGED