uc3-dmp-id 0.0.12 → 0.0.13
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 +18 -3
- 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: 7305cd9930a1eb2f2feb56fa439ef8ebfc95ce5550184f81801989b570b9e56e
|
4
|
+
data.tar.gz: dafe80d52cb7ef18b1dc63c15708955eb8abb608bace639d29df2cbcd96e0aaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b14d04b52398da535ef787b15e5f883f9fdf93a6adb1adf34c5e82c459f13c40f481fb214bb17f770502e06a8fe67e3a6692359a2a8e96a5a6918dcd2e134c3
|
7
|
+
data.tar.gz: 3c9eded9447bc3fd9a4b3f2168bc289d812b5b1613a86e4e407ba83ad402be23ca4fd01d113373e93f23c951d1d96d36d6b75863cbad14be27c47376cc9f2ebc
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -60,17 +60,22 @@ module Uc3DmpId
|
|
60
60
|
def by_pk(p_key:, s_key: Helper::DMP_LATEST_VERSION, client: nil, debug: false)
|
61
61
|
raise Uc3DmpIdFinderError, MSG_MISSING_PK if p_key.nil?
|
62
62
|
|
63
|
-
s_key = Helper::DMP_LATEST_VERSION if s_key.nil? || s_key.strip.empty?
|
63
|
+
s_key = Helper::DMP_LATEST_VERSION if s_key.nil? || s_key.to_s.strip.empty?
|
64
|
+
|
65
|
+
puts "PK: #{p_key}, SK: #{s_key}"
|
64
66
|
|
65
67
|
client = client.nil? ? Uc3DmpDynamo::Client.new(debug: debug) : client
|
66
68
|
resp = client.get_item(
|
67
69
|
key: {
|
68
70
|
PK: Helper.append_pk_prefix(p_key: p_key),
|
69
|
-
SK: s_key
|
71
|
+
SK: s_key
|
70
72
|
}
|
71
73
|
)
|
72
74
|
return resp unless resp.is_a?(Hash)
|
73
75
|
|
76
|
+
puts "FETCHED:"
|
77
|
+
puts resp
|
78
|
+
|
74
79
|
dmp = resp['dmp'].nil? ? JSON.parse({ dmp: resp }.to_json) : resp
|
75
80
|
return nil if resp['dmp']['PK'].nil?
|
76
81
|
|
@@ -112,10 +117,16 @@ module Uc3DmpId
|
|
112
117
|
def _append_versions(p_key:, dmp:, client: nil, debug: false)
|
113
118
|
return dmp if p_key.nil? || !dmp.is_a?(Hash) || dmp['dmp'].nil?
|
114
119
|
|
120
|
+
puts "FETCHING VERSIONS"
|
121
|
+
|
115
122
|
results = versions(p_key: p_key, client: client, debug: debug)
|
116
123
|
return dmp unless results.length > 1
|
117
124
|
|
118
|
-
versions = results.map do |
|
125
|
+
versions = results.map do |ver|
|
126
|
+
|
127
|
+
puts version
|
128
|
+
|
129
|
+
version = ver['dmp'].nil? ? JSON.parse({ dmp: ver }.to_json) : ver
|
119
130
|
next if version.fetch('dmp', {})['modified'].nil?
|
120
131
|
|
121
132
|
timestamp = version['dmp']['modified']
|
@@ -125,6 +136,10 @@ module Uc3DmpId
|
|
125
136
|
}
|
126
137
|
end
|
127
138
|
dmp['dmp']['dmphub_versions'] = JSON.parse(versions.to_json)
|
139
|
+
|
140
|
+
puts "AFTER APPENDING VERSIONS:"
|
141
|
+
puts dmp
|
142
|
+
|
128
143
|
dmp
|
129
144
|
end
|
130
145
|
# rubocop:enable Metrics/AbcSize
|
data/lib/uc3-dmp-id/version.rb
CHANGED