uc3-dmp-id 0.0.86 → 0.0.88
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 +4 -14
- 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: 7a80f485c08b9363c829a92644ed5e03dcb10adc185fc0d0bb054d0d9f79cfa0
|
4
|
+
data.tar.gz: 239562b558a5fa50b9dfa65fa9d6cfa4719ad161b051c3e53eaff2ba2f3363a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bba3bb098c384aff4c37a0816b2a968468677124b8ca2a2ce5338ed029d881ab6f2ce6e421dd4b6179d15c93dedbb284dd6903f152610726080cf53833a71797
|
7
|
+
data.tar.gz: 72c986c4fea24409cb96ac845888b1cf6b93c5feb6dbce1b9f6e87b1405f78e9735a43c36305aa0751aa83566ab4ad8cc9e8453074177c0f24212738bfcf0d80
|
data/lib/uc3-dmp-id/updater.rb
CHANGED
@@ -24,19 +24,15 @@ puts annotated
|
|
24
24
|
# fetch the existing latest version of the DMP ID
|
25
25
|
client = Uc3DmpDynamo::Client.new(debug: debug)
|
26
26
|
existing = Finder.by_pk(p_key: p_key, client: client, debug: debug)
|
27
|
-
|
28
|
-
puts 'EXISTING:'
|
29
|
-
puts existing
|
30
|
-
|
31
|
-
errs = _updateable?(provenance: provenance, p_key: p_key, json: existing)
|
27
|
+
errs = _updateable?(provenance: provenance, p_key: p_key, json: annotated)
|
32
28
|
raise UpdaterError, errs if errs.is_a?(Array) && errs.any?
|
33
29
|
# Don't continue if nothing has changed!
|
34
|
-
raise UpdaterError, MSG_NO_CHANGE if Helper.eql?(dmp_a: existing, dmp_b:
|
30
|
+
raise UpdaterError, MSG_NO_CHANGE if Helper.eql?(dmp_a: existing, dmp_b: dmp)
|
35
31
|
|
36
32
|
# Generate a new version of the DMP. This involves versioning the current latest version
|
37
|
-
new_version =
|
33
|
+
new_version = Versioner.new_version(p_key: p_key, dmp: annotated)
|
38
34
|
|
39
|
-
puts '
|
35
|
+
puts 'New version:'
|
40
36
|
puts new_version
|
41
37
|
|
42
38
|
raise UpdaterError, MSG_DMP_UNABLE_TO_VERSION if new_version.nil?
|
@@ -84,17 +80,11 @@ puts new_version
|
|
84
80
|
# Validate the incoming JSON first
|
85
81
|
errs = Validator.validate(mode: 'author', json: json)
|
86
82
|
return errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
|
87
|
-
|
88
|
-
puts "Provenance: #{provenance['PK']}, DMP_ID to PK #{Helper.dmp_id_to_pk(json: json['dmp'].fetch('dmp_id', {}))} == P_KEY: #{p_key}"
|
89
|
-
|
90
83
|
# Fail if the provenance is not defined
|
91
84
|
return [MSG_DMP_FORBIDDEN] unless provenance.is_a?(Hash) && !provenance['PK'].nil?
|
92
|
-
|
93
85
|
# Verify that the JSON is for the same DMP in the PK
|
94
86
|
dmp_id = json['dmp'].fetch('dmp_id', {})
|
95
87
|
return [MSG_DMP_FORBIDDEN] unless Helper.dmp_id_to_pk(json: dmp_id) == p_key
|
96
|
-
# Make sure they're not trying to update a historical copy of the DMP
|
97
|
-
return [MSG_DMP_NO_HISTORICALS] if json['SK'] != Helper::DMP_LATEST_VERSION
|
98
88
|
end
|
99
89
|
|
100
90
|
# Once the DMP has been updated, we need to register it's DMP ID and download any PDF if applicable
|
data/lib/uc3-dmp-id/version.rb
CHANGED