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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0a0a7c8a7c2ec3b7bfdc0051c323b85ba6f7bb14aa0bc1f77e499b7682b3814
4
- data.tar.gz: 9bb5fa376caa1d07bd243cebad4b5757771eb996a4723c200366c034fdf56b2c
3
+ metadata.gz: 7305cd9930a1eb2f2feb56fa439ef8ebfc95ce5550184f81801989b570b9e56e
4
+ data.tar.gz: dafe80d52cb7ef18b1dc63c15708955eb8abb608bace639d29df2cbcd96e0aaf
5
5
  SHA512:
6
- metadata.gz: 8b8ff1171c5127af8fedbfe85bf2c74b4a61f25dc4bab73e42fa1903bbe36c9a20adb0f9db2b1906c6542f7172496ea9173b05c047b20392577d5cc9341002db
7
- data.tar.gz: '079687ec9e07dddde7afcbcd9d1b6dc0b3606276f735e4040ca0183e378f1bc0c72017747d48dde140c32b922e7ce6825afc5b3961d6b93503ce4c2052226495'
6
+ metadata.gz: 2b14d04b52398da535ef787b15e5f883f9fdf93a6adb1adf34c5e82c459f13c40f481fb214bb17f770502e06a8fe67e3a6692359a2a8e96a5a6918dcd2e134c3
7
+ data.tar.gz: 3c9eded9447bc3fd9a4b3f2168bc289d812b5b1613a86e4e407ba83ad402be23ca4fd01d113373e93f23c951d1d96d36d6b75863cbad14be27c47376cc9f2ebc
@@ -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.nil? || s_key.strip.empty? ? Helper::DMP_LATEST_VERSION : 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 |version|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.12'
4
+ VERSION = '0.0.13'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley