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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 311e98d2bb2766b13451da262a40a971bf6bd277a9b20e08a370b6bc85736c01
4
- data.tar.gz: f44522707fdc652d66d691807d078a07e1f4749eb5bd8c7710e3cf8bfa764f2f
3
+ metadata.gz: ba5ea607a46a54a678d88187f9aa1e1afb49b691a7586a01b8f22e1502771865
4
+ data.tar.gz: f24f181d33ae842057fdd2bc95002baa41cdc75040e37ce4904502ecbccf120f
5
5
  SHA512:
6
- metadata.gz: dec0556fc472a139b1ec25f502eb1a4c1bbf6a533158697b4f554f5211ff69b8dc42cf65accc7ceb8b4d10f4ec792f972bd7a28352fad89b0f3df21ad2600cb0
7
- data.tar.gz: '087af9131a1bcfee8ddfe93f6202cf0f9d38cd9151a6de00c3c50b783eade3775e42a6695b50b5963e2e70f881444ae3f2d4f02a1f9061b4fa9d87478dac2931'
6
+ metadata.gz: 769b2512b7d4b2d7a18b7a11863b8eb0b0870b3ab5d23301386830bfd9db9e9630f887670dfda30031b541ff968ec7b178248ab5ffe9308b7ec59e81a2321f21
7
+ data.tar.gz: bd200b2ad45a7a202a86ef2eeac50834b19ab4713bd200185f4fc8f663c9668a8d2afacfe3a5c6c54d5bae47efb556b39d9d75ff926abdc6966a42a7de169842
@@ -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: timestamp,
139
- url: "#{Helper.api_base_url}dmps/#{Helper.remove_pk_prefix(p_key: p_key)}?version=#{timestamp}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.17'
4
+ VERSION = '0.0.19'
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.17
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley