uc3-dmp-id 0.0.17 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-id/finder.rb +5 -20
- 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: ba5ea607a46a54a678d88187f9aa1e1afb49b691a7586a01b8f22e1502771865
|
4
|
+
data.tar.gz: f24f181d33ae842057fdd2bc95002baa41cdc75040e37ce4904502ecbccf120f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769b2512b7d4b2d7a18b7a11863b8eb0b0870b3ab5d23301386830bfd9db9e9630f887670dfda30031b541ff968ec7b178248ab5ffe9308b7ec59e81a2321f21
|
7
|
+
data.tar.gz: bd200b2ad45a7a202a86ef2eeac50834b19ab4713bd200185f4fc8f663c9668a8d2afacfe3a5c6c54d5bae47efb556b39d9d75ff926abdc6966a42a7de169842
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -34,10 +34,6 @@ module Uc3DmpId
|
|
34
34
|
scan_index_forward: false
|
35
35
|
}
|
36
36
|
client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
|
37
|
-
|
38
|
-
puts "VERSION SEARCH:"
|
39
|
-
puts args
|
40
|
-
|
41
37
|
client.query(args: args, debug: debug)
|
42
38
|
end
|
43
39
|
|
@@ -83,7 +79,8 @@ puts resp
|
|
83
79
|
dmp = resp['dmp'].nil? ? JSON.parse({ dmp: resp }.to_json) : resp
|
84
80
|
return nil if dmp['dmp']['PK'].nil?
|
85
81
|
|
86
|
-
_append_versions(p_key: dmp['dmp']['PK'], dmp: dmp, client: client, debug: debug)
|
82
|
+
dmp = _append_versions(p_key: dmp['dmp']['PK'], dmp: dmp, client: client, debug: debug)
|
83
|
+
cleanse_dmp_json(json: dmp)
|
87
84
|
end
|
88
85
|
|
89
86
|
# Attempt to find the DMP item by the provenance system's identifier
|
@@ -121,29 +118,17 @@ puts resp
|
|
121
118
|
def _append_versions(p_key:, dmp:, client: nil, debug: false)
|
122
119
|
return dmp if p_key.nil? || !dmp.is_a?(Hash) || dmp['dmp'].nil?
|
123
120
|
|
124
|
-
puts "FETCHING VERSIONS"
|
125
|
-
|
126
121
|
results = versions(p_key: p_key, client: client, debug: debug)
|
127
122
|
return dmp unless results.length > 1
|
128
123
|
|
129
124
|
versions = results.map do |ver|
|
130
|
-
|
131
|
-
puts version
|
132
|
-
|
133
|
-
version = ver['dmp'].nil? ? JSON.parse({ dmp: ver }.to_json) : ver
|
134
|
-
next if version.fetch('dmp', {})['modified'].nil?
|
135
|
-
|
136
|
-
timestamp = version['dmp']['modified']
|
125
|
+
next if ver['modified'].nil?
|
137
126
|
{
|
138
|
-
timestamp:
|
139
|
-
url: "#{Helper.api_base_url}dmps/#{Helper.remove_pk_prefix(p_key: p_key)}?version=#{
|
127
|
+
timestamp: ver['modified'],
|
128
|
+
url: "#{Helper.api_base_url}dmps/#{Helper.remove_pk_prefix(p_key: p_key)}?version=#{ver['modified']}"
|
140
129
|
}
|
141
130
|
end
|
142
131
|
dmp['dmp']['dmphub_versions'] = JSON.parse(versions.to_json)
|
143
|
-
|
144
|
-
puts "AFTER APPENDING VERSIONS:"
|
145
|
-
puts dmp
|
146
|
-
|
147
132
|
dmp
|
148
133
|
end
|
149
134
|
# rubocop:enable Metrics/AbcSize
|
data/lib/uc3-dmp-id/version.rb
CHANGED