uc3-dmp-id 0.0.40 → 0.0.42

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: 16e0d5fad73a2b02661468888f39eb9931dcfa3a41d6f4b1c3c4b9caac5270b7
4
- data.tar.gz: a76046c80b46aaab3705af222eeca787d7f821766057c9d18982a9b64fb1b105
3
+ metadata.gz: a0fef469bbcc71541818da66343150f5f8d836da7fea95e584814676504fc0ab
4
+ data.tar.gz: d33e5f4b658a3cc10af320a43712c39dc8876e94d463ca610b1c35f3845c8781
5
5
  SHA512:
6
- metadata.gz: 43bc65f4d35e2efea4e77e1cbea24ca4d15f9968a73a01cb3aac39c043ba42512422ec1481f97f9f7a57dc40145ef55b0a4db5371a45871730ff44897e6dc321
7
- data.tar.gz: bf07e780828b16f0cafea980538510c15a8b8c725afb19d4459d4428ab9d424fdd843493d65f4986a335e1c9b37a9c6381ce91fca593c24a78ff7885a017001d
6
+ metadata.gz: e2b2393f62e7a78df241ef998107817fe569c0de4362ca2e2451a471bb8e029717acad65dc48a4c12840885060110f750864d14a2d9ffaf3bd34f1eb78c59a05
7
+ data.tar.gz: 76b1ad4c83ebceccea8fdb0932615dfd930b306bfd604d240a39d42b21ffbcb694c17455d1596393f7ff71a00700c2b82c488d31739a07eca340d86c966b2c13
@@ -19,16 +19,19 @@ module Uc3DmpId
19
19
  raise DeleterError, MSG_DMP_FORBIDDEN unless provenance.is_a?(Hash) && !provenance['PK'].nil?
20
20
 
21
21
  # Validate the incoming JSON first
22
- errs = Validator.validate(mode: 'author', json: Helper.parse_json(json: json))
22
+ json = Helper.parse_json(json: json)
23
+ errs = Validator.validate(mode: 'author', json: json)
23
24
  raise CreatorError, errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
24
25
 
25
26
  # Fail if the provenance or owner affiliation are not defined
26
27
  raise CreatorError, MSG_NO_PROVENANCE_OWNER if provenance.nil? || owner_org.nil?
27
28
  raise CreatorError, MSG_NO_OWNER_ORG unless owner_org.is_a?(String) && !owner_org.strip.empty?
28
29
 
30
+ # TODO: Swap this out with the Finder search once the Dynamo indexes are working
29
31
  # Try to find it first and Fail if found
30
- result = Finder.by_json(json: json, debug: debug)
31
- raise CreatorError, Uc3DmpId::MSG_DMP_EXISTS if result.is_a?(Hash)
32
+ # result = Finder.by_json(json: json, debug: debug)
33
+ # raise CreatorError, Uc3DmpId::MSG_DMP_EXISTS if result.is_a?(Hash)
34
+ raise CreatorError, Uc3DmpId::MSG_DMP_EXISTS unless json['PK'].nil?
32
35
 
33
36
  p_key = _preregister_dmp_id(json: json, debug: debug)
34
37
  raise CreatorError, MSG_UNABLE_TO_MINT if p_key.nil?
@@ -54,7 +57,7 @@ module Uc3DmpId
54
57
  existing = json.fetch('dmp_id', {})
55
58
  id = existing['identifier'].gsub(%r{https?://}, Helper::PK_DMP_PREFIX) if existing.is_a?(Hash) &&
56
59
  !existing['identifier'].nil?
57
- return id if existing['type'].downcase == 'doi' && !id.nil? && !Finder.exists?(p_key: id)
60
+ return id if !id.nil? && existing['type'].downcase == 'doi' && !Finder.exists?(p_key: id)
58
61
 
59
62
  dmp_id = ''
60
63
  counter = 0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.40'
4
+ VERSION = '0.0.42'
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.40
4
+ version: 0.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley