uc3-dmp-id 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/creator.rb +3 -2
- data/lib/uc3-dmp-id/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0fef469bbcc71541818da66343150f5f8d836da7fea95e584814676504fc0ab
|
4
|
+
data.tar.gz: d33e5f4b658a3cc10af320a43712c39dc8876e94d463ca610b1c35f3845c8781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2b2393f62e7a78df241ef998107817fe569c0de4362ca2e2451a471bb8e029717acad65dc48a4c12840885060110f750864d14a2d9ffaf3bd34f1eb78c59a05
|
7
|
+
data.tar.gz: 76b1ad4c83ebceccea8fdb0932615dfd930b306bfd604d240a39d42b21ffbcb694c17455d1596393f7ff71a00700c2b82c488d31739a07eca340d86c966b2c13
|
data/lib/uc3-dmp-id/creator.rb
CHANGED
@@ -19,7 +19,8 @@ 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
|
-
|
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
|
@@ -56,7 +57,7 @@ module Uc3DmpId
|
|
56
57
|
existing = json.fetch('dmp_id', {})
|
57
58
|
id = existing['identifier'].gsub(%r{https?://}, Helper::PK_DMP_PREFIX) if existing.is_a?(Hash) &&
|
58
59
|
!existing['identifier'].nil?
|
59
|
-
return id if existing['type'].downcase == 'doi' && !
|
60
|
+
return id if !id.nil? && existing['type'].downcase == 'doi' && !Finder.exists?(p_key: id)
|
60
61
|
|
61
62
|
dmp_id = ''
|
62
63
|
counter = 0
|
data/lib/uc3-dmp-id/version.rb
CHANGED