uc3-dmp-id 0.0.48 → 0.0.50

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: f184f47843a41741118c64764999e2e63e66bf8092c8052d00f75bf7b5a04063
4
- data.tar.gz: 44b5cafd4ef3f6043a4b1873d66fa3f9b9dde2f328203b8dd0c5537a042a245c
3
+ metadata.gz: be8e880666031df3010f048c10afe83dbd614d7a5e51015f53fc67964a1519f5
4
+ data.tar.gz: d765faf0c263d97c09ee30a0b64aa176e9968fbe1b4eb065b273d3a1aacfc6f5
5
5
  SHA512:
6
- metadata.gz: b6923c6148a6b347efbf00955d7aaafb810edbc42c38818191a9e440faaf648555753fc271a47f520d6ef489a135b5b9d65b468311c24da9feb22e7aa256660b
7
- data.tar.gz: 0d54dc2c84c8a74dc0edf02a88971939fd307940837a0edd9ec1fae4144c3dcf5675e89dcb9b9cf08a2a6072eb44cae9bb14ad82e6343ea0b4676e0904f3970c
6
+ metadata.gz: 422f3912f9fa3eda4fa33a989e898378f3afb6080c8191c7ae43de6edea116b6f3aed0859b1825eddf09582416b5c5f69b51175a330846d3fed8fddcb197a380
7
+ data.tar.gz: a819663b7e7bbe5be506a71b83d94a337dd3699c5f3cde9378f6b5bf2323dda56cca4e9b170c0d81d36e840d4939d556fd064a8329d1e820f62a743e47397176
@@ -29,12 +29,12 @@ module Uc3DmpId
29
29
 
30
30
  # TODO: Swap this out with the Finder search once the Dynamo indexes are working
31
31
  # Try to find it first and Fail if found
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
+ 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?
35
35
 
36
36
  client = Uc3DmpDynamo::Client.new(debug: debug)
37
- p_key = _preregister_dmp_id(client: client, json: json, debug: debug)
37
+ p_key = _preregister_dmp_id(client: client, provenance: provenance, json: json, debug: debug)
38
38
  raise CreatorError, MSG_UNABLE_TO_MINT if p_key.nil?
39
39
 
40
40
  # Add the DMPHub specific attributes and then save
@@ -52,12 +52,21 @@ module Uc3DmpId
52
52
 
53
53
  private
54
54
 
55
- def _preregister_dmp_id(client:, json:, debug: false)
55
+ def _preregister_dmp_id(client:, provenance:, json:, debug: false)
56
56
  # Use the specified DMP ID if the provenance has permission
57
57
  existing = json.fetch('dmp_id', {})
58
58
  id = existing['identifier'].gsub(%r{https?://}, Helper::PK_DMP_PREFIX) if existing.is_a?(Hash) &&
59
59
  !existing['identifier'].nil?
60
- return id if !id.nil? && existing['type'].downcase == 'doi' && !Finder.exists?(client: client, p_key: id)
60
+
61
+ puts "_preregister_dmp_id:"
62
+ puts provenance
63
+ puts json
64
+ puts id
65
+
66
+ return id if !id.nil? &&
67
+ existing.fetch('type', 'other').to_s.downcase == 'doi' &&
68
+ provenance.fetch('seedingWithLiveDmpIds', false).to_s.downcase == 'true' &&
69
+ !Finder.exists?(client: client, p_key: id)
61
70
 
62
71
  dmp_id = ''
63
72
  counter = 0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.48'
4
+ VERSION = '0.0.50'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.48
4
+ version: 0.0.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-08 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json