uc3-dmp-id 0.0.81 → 0.0.83

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: a5cfc6c3d13bb4d5245abcef1ad55a340f866ae63a11374bff55ec1ea976fa0a
4
- data.tar.gz: fc1084accea4f2a55677a83657e28bd5733b8fee518e90f44fa040738fb48a46
3
+ metadata.gz: a77779d6dd23f1c3d3cb8271e4623f584590fba3a86f233be7cb2e421cdc5320
4
+ data.tar.gz: 8d43e6f5e5fc7c1612133c4a2d8f95dc7d6005bab3aca577cc1373fcf33af1fb
5
5
  SHA512:
6
- metadata.gz: e522c602ba745a0f06e5e7c858758c13053b8bdd79564f7dc2ba0223a92ed383db887fb95ba76426d9f058109109cbf4ce053cbc466423e8c67b3f4288cf079a
7
- data.tar.gz: b6246a0c62f810d5a629d2e60bc32aae767881e6dc5284aaf0351c2a419c83366fe2f8e49f79b337ccd402c2cc73d7390e7cb6b5e04c46229bc57d321a922910
6
+ metadata.gz: 18c8561f3dec28a96bdc0ea321b819d6b67f72c755a1828476adad82444cba992ffd928191e9161e7b9c1ae1f1b1b71d353e3c05548f75fcf6dcc951941078e8
7
+ data.tar.gz: 1eb10265cc9fa080aa0f81550446ef22f5fd3f4907c1c0ffee82a9400d74717c5ed3603218b1bf76eccab2c1d0ff56cc51a11c487096c1676af07f102225b571
@@ -90,7 +90,7 @@ module Uc3DmpId
90
90
  dmp_id = format_dmp_id(value: json['identifier'].to_s)
91
91
  return nil if dmp_id.nil? || dmp_id == ''
92
92
 
93
- append_pk_prefix(p_key: dmp_id)
93
+ append_pk_prefix(p_key: dmp_id.gsub(%r{https?://}, ''))
94
94
  end
95
95
 
96
96
  # Derive the DMP ID by removing the :PK prefix
@@ -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: json)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.81'
4
+ VERSION = '0.0.83'
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.81
4
+ version: 0.0.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley