uc3-dmp-id 0.0.87 → 0.0.89

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: 5157b046943c0704a73d9b1c203dd7f88489a31c22dc0711f857b8b1c2320290
4
- data.tar.gz: 7d0d5d498654e4203b37537c760f61c20bc0647ba785193fc253b745cfd21287
3
+ metadata.gz: 060e5579b7df045a30beb6431b0954b19e8542b42e1dacc933c9f0f025d521a8
4
+ data.tar.gz: b784e85e55401583d782363b0b9d99f23839db175aac2e4ccfa498b5c98481c7
5
5
  SHA512:
6
- metadata.gz: 3030a6a421a5e5e1e461b5861cc802e6f3851a0759c6783fac640978a6af755cad965728a7e5b77ca6f31d17e7069e087a2fb6ea7563a10ed3f49a036911c3c6
7
- data.tar.gz: 0a41e25fc8b3f9eff0d19620de10a953e0c062472508b3f048d7796dd7ed4d6f91458907f3ee16417d55bca2f9c2a77ae5732a820260f5e5cd883ab3f381f320
6
+ metadata.gz: 3bc49726eb20d814984f6bd3585510f7d45b5dd00479cc95933f6ade4e5ca2b77a191d18377b05af0d3303b3ba19f7cedb54a85abb11d77ea45a712305c0816b
7
+ data.tar.gz: 1c6048b78d7b9c38b16433e93b3bc64df70ccfcecda64e6cc4f223ce7253bde6868b9d53834c0d3e7e17fc46cac1569acaf76a1588bf3c5a38fb2e76154f6d72
@@ -24,19 +24,16 @@ 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
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: annotated)
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 = versioner.new_version(p_key: p_key, dmp: annotated)
33
+ new_version = Versioner.new_version(provenance: provenance, p_key: p_key, client: client, debug: debug,
34
+ dmp: dmp, latest_version: existing)
38
35
 
39
- puts 'DMP after splicing all changes:'
36
+ puts 'New version:'
40
37
  puts new_version
41
38
 
42
39
  raise UpdaterError, MSG_DMP_UNABLE_TO_VERSION if new_version.nil?
@@ -84,12 +81,8 @@ puts new_version
84
81
  # Validate the incoming JSON first
85
82
  errs = Validator.validate(mode: 'author', json: json)
86
83
  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
84
  # Fail if the provenance is not defined
91
85
  return [MSG_DMP_FORBIDDEN] unless provenance.is_a?(Hash) && !provenance['PK'].nil?
92
-
93
86
  # Verify that the JSON is for the same DMP in the PK
94
87
  dmp_id = json['dmp'].fetch('dmp_id', {})
95
88
  return [MSG_DMP_FORBIDDEN] unless Helper.dmp_id_to_pk(json: dmp_id) == p_key
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.87'
4
+ VERSION = '0.0.89'
5
5
  end
@@ -29,7 +29,7 @@ module Uc3DmpId
29
29
  # - Saving the new `VERSION=yyyy-mm-ddThh:mm:ss+zz:zz` item
30
30
  # - Splicing in the current changes onto the existing `VERSION#latest` item
31
31
  # - Returning the spliced `VERSION#latest` back to this method
32
- def new_version(provenance:, p_key:, client: nil, dmp:, latest_version: {})
32
+ def new_version(provenance:, p_key:, client: nil, dmp:, latest_version: {}, debug: false)
33
33
  return nil unless p_key.is_a?(String) && !p_key.strip.empty? && _versionable?(dmp: dmp)
34
34
 
35
35
  client = Uc3DmpDynamo::Client.new(debug: debug) if client.nil?
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.87
4
+ version: 0.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley