dmp-dynamo_adapter 0.2.7 → 0.2.8
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/dmp/dmp_id_handler.rb +0 -21
- data/lib/dmp/dynamo_adapter.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: 1fde969438aa9681c5213d60e441b3187de1ed2141c7b244419ba47a007d39fc
|
|
4
|
+
data.tar.gz: a4a9722f607edf91644043c4adbcb3af7bfe81f33d254da104a0223a27fd6c40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ba67f79d6cdf0b4d29f416301e88b8b4453f85b7381a82280f5389dde4c12bb5446e59bdd21290d04203dbcdaefc73f08c1bd8ffd5221b945a19e514e4f1c2b
|
|
7
|
+
data.tar.gz: 8c2a12ccd6b1049a12f254a6ae5f634c63aa2c3b82870778fd541482d6888cd720426ac6cb213d72b6fb3605ad38a3b948abf7393f63b90cc3898fa72f60966e
|
data/lib/dmp/dmp_id_handler.rb
CHANGED
|
@@ -13,27 +13,6 @@ module Dmp
|
|
|
13
13
|
ENV['DMP_ID_BASE_URL'].end_with?('/') ? ENV['DMP_ID_BASE_URL'] : "#{ENV['DMP_ID_BASE_URL']}/"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# Preassign a DMP ID that will leater be sent to the DOI minting authority (EZID)
|
|
17
|
-
def preregister_dmp_id
|
|
18
|
-
dmp_id = ''
|
|
19
|
-
counter = 0
|
|
20
|
-
|
|
21
|
-
p 'PREREGISTER DMP ID:'
|
|
22
|
-
|
|
23
|
-
while dmp_id == '' && counter <= 10
|
|
24
|
-
prefix = "#{ENV['DMP_ID_SHOULDER']}.#{SecureRandom.hex(4).upcase}"
|
|
25
|
-
result = Dmp::DynamoAdapter.find_by_pk(
|
|
26
|
-
p_key: Dmp::MetadataHandler.append_pk_prefix(dmp: dmp_id)
|
|
27
|
-
)
|
|
28
|
-
dmp_id = prefix unless result[:status] != 404
|
|
29
|
-
counter += 1
|
|
30
|
-
end
|
|
31
|
-
# Something went wrong and it was unable to identify a unique id
|
|
32
|
-
return nil if counter >= 10
|
|
33
|
-
|
|
34
|
-
"#{Dmp::MetadataHandler::PK_DMP_PREFIX}#{dmp_id_base_url}#{dmp_id}"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
16
|
# Format the DMP ID in the way we want it
|
|
38
17
|
def format_dmp_id(value:)
|
|
39
18
|
dmp_id = value.match(DOI_REGEX).to_s
|
data/lib/dmp/dynamo_adapter.rb
CHANGED
|
@@ -304,7 +304,7 @@ p 'PREREGISTER DMP ID:'
|
|
|
304
304
|
# Something went wrong and it was unable to identify a unique id
|
|
305
305
|
return nil if counter >= 10
|
|
306
306
|
|
|
307
|
-
"#{Dmp::MetadataHandler::PK_DMP_PREFIX}#{dmp_id_base_url}#{dmp_id}"
|
|
307
|
+
"#{Dmp::MetadataHandler::PK_DMP_PREFIX}#{Dmp::DmpIdHandler.dmp_id_base_url}#{dmp_id}"
|
|
308
308
|
end
|
|
309
309
|
|
|
310
310
|
# Convert the latest version into a historical version
|