uc3-dmp-id 0.0.54 → 0.0.56

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: f16fd79bdbb0c94a57e6e59aa268d6ae8f6dc94a5431ec2bf8fc3352f34486c2
4
- data.tar.gz: 6903af14944f71a66f9c6121786937e407294b8252ec16a2c61f81086b45e0c5
3
+ metadata.gz: f1aafa930278b99e50df087691c0bacc305af75bf449b67e64e82e8031e2711d
4
+ data.tar.gz: 8f81d11cf31acb8afcea0adb1171b03f8c39f88cb1471125dc34c95f8faedd92
5
5
  SHA512:
6
- metadata.gz: 1a2633ef6cc7a06537be8d2f74aeeb5b1e7b6bec17049ded6ff2ad24f03d28835e3700d3f53f641582851212afa8b1c36946d1b31fd1f79dd63e6b45d27079a2
7
- data.tar.gz: 05b05a9ab69c961c5fb77d42a4084bccd99745c1b843a40363fedbec5522d40478227bc60f49295854e8a7579f716768f20836e00d3334d831810458c8d5cbdc
6
+ metadata.gz: 2145330c697fdc2c9d3ebbd52a9cf4130725c9e9e1a9bab724758198b90e6f9f5c897442c1244d26848fa118269665891aefbc3f696a89a919eb9fcd629b100f
7
+ data.tar.gz: d7ba392936d2ab33b810455c4bb1ba530b346e1b618f22d311ec75eb0ab471b038def5ca0fe171d2f28950bab8327d176fd56bcd3e03e2265e3863e89cdbc0a3
@@ -49,9 +49,6 @@ module Uc3DmpId
49
49
  # Don't continue if nothing has changed!
50
50
  raise UpdaterError, MSG_DMP_NOT_FOUND if dmp.nil?
51
51
 
52
- puts "attach_narrative: dmp: #{dmp.class.name}, p_key: #{p_key}, prov: #{provenance['PK']}"
53
- puts dmp
54
-
55
52
  errs = _updateable?(provenance: provenance, p_key: p_key, json: dmp)
56
53
  raise UpdaterError, errs if errs.is_a?(Array) && errs.any?
57
54
 
@@ -60,6 +57,9 @@ module Uc3DmpId
60
57
  annotated['dmproadmap_related_identifiers'] = [] if annotated['dmproadmap_related_identifiers'].nil?
61
58
  annotated << { descriptor: 'is_metadata_for', work_type: 'output_management_plan', type: 'url', identifier: url }
62
59
 
60
+ puts "Attached:"
61
+ puts annotated
62
+
63
63
  # Save the changes as the new latest version
64
64
  resp = client.put_item(json: annotated, debug: debug)
65
65
  raise UpdaterError, MSG_DMP_UNABLE_TO_VERSION if resp.nil?
@@ -72,9 +72,12 @@ module Uc3DmpId
72
72
  # Check if the DMP ID is updateable by the provenance
73
73
  def _updateable?(provenance:, p_key:, json:)
74
74
  # Validate the incoming JSON first
75
- errs = Validator.validate(mode: 'author', json: json)&.fetch('dmp', {})
75
+ errs = Validator.validate(mode: 'author', json: json)
76
76
  return errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
77
77
 
78
+ puts "Prov: #{provenance['PK']}, PK IN: #{p_key}, DMP ID: #{json.fetch('dmp_id', {})['identifier']}, PK: #{json['PK']}"
79
+ puts "Processed DMP ID: '#{Helper.dmp_id_to_pk(json: dmp_id)}' == '#{p_key}'"
80
+
78
81
  # Fail if the provenance is not defined
79
82
  return [MSG_DMP_FORBIDDEN] unless provenance.is_a?(Hash) && !provenance['PK'].nil?
80
83
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.54'
4
+ VERSION = '0.0.56'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.54
4
+ version: 0.0.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley