uc3-dmp-id 0.0.90 → 0.0.92
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/deleter.rb +2 -4
- data/lib/uc3-dmp-id/finder.rb +3 -3
- data/lib/uc3-dmp-id/validator.rb +1 -1
- data/lib/uc3-dmp-id/version.rb +1 -1
- data/lib/uc3-dmp-id/versioner.rb +2 -6
- 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: 55e15684bfc0ccb76cb498ccddfae9b83c8ce935240efbb5ad1112ddbf791ab8
|
4
|
+
data.tar.gz: 2a729a50e838d4e25a4921d5a33f6b12b3e786e2da4c91b12016340b6d5a158b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70315b0ebd96129ec4c7ba051e39d5e385952079f20a565e000bd7b4812be60687a2cde3c414c66db71bda2ccb35a67e06dfcf90aa21b65dee22cb26786ddbfb
|
7
|
+
data.tar.gz: '0481364645a94de5cb4178bd4657b7d7e1622016cbc7bb0ff9cd3e2082efe2424f5bc98cf47d4b36f2e59515399e7dbd237f4e62ba49b025e788ae0c705bb135'
|
data/lib/uc3-dmp-id/deleter.rb
CHANGED
@@ -38,16 +38,14 @@ module Uc3DmpId
|
|
38
38
|
# Delete the Latest version
|
39
39
|
resp = client.delete_item(p_key: p_key, s_key: Helper::SK_DMP_PREFIX, logger: logger)
|
40
40
|
|
41
|
-
# TODO: We should do a check here to see if it was successful!
|
42
|
-
puts resp.inspect
|
41
|
+
# TODO: We should do a check here to see if it was successful!
|
43
42
|
|
44
43
|
# Notify EZID about the removal
|
45
44
|
_post_process(json: dmp, logger: logger)
|
46
45
|
# Return the tombstoned record
|
47
46
|
Helper.cleanse_dmp_json(json: JSON.parse({ dmp: dmp }.to_json))
|
48
47
|
rescue Aws::Errors::ServiceError => e
|
49
|
-
|
50
|
-
puts e.backtrace
|
48
|
+
logger.error(message: e.message, details: e.backtrace) unless logger.nil?
|
51
49
|
{ status: 500, error: Messages::MSG_SERVER_ERROR }
|
52
50
|
end
|
53
51
|
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
data/lib/uc3-dmp-id/finder.rb
CHANGED
@@ -135,7 +135,7 @@ module Uc3DmpId
|
|
135
135
|
filter_expression: 'SK = :version',
|
136
136
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
137
137
|
}
|
138
|
-
|
138
|
+
logger.info(message: "Querying _by_owner with #{args}") unless logger.nil?
|
139
139
|
client = client.nil? ? Uc3DmpDynamo::Client.new : client
|
140
140
|
_process_search_response(response: client.query(args: args, logger: logger))
|
141
141
|
end
|
@@ -159,7 +159,7 @@ module Uc3DmpId
|
|
159
159
|
filter_expression: 'SK = :version',
|
160
160
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
161
161
|
}
|
162
|
-
|
162
|
+
logger.info(message: "Querying _by_owner_org with #{args}") unless logger.nil?
|
163
163
|
client = client.nil? ? Uc3DmpDynamo::Client.new : client
|
164
164
|
_process_search_response(response: client.query(args: args, logger: logger))
|
165
165
|
end
|
@@ -180,7 +180,7 @@ module Uc3DmpId
|
|
180
180
|
filter_expression: 'SK = :version',
|
181
181
|
expression_attribute_values: { ':version': Helper::DMP_LATEST_VERSION }
|
182
182
|
}
|
183
|
-
|
183
|
+
logger.info(message: "Querying _by_mod_day with #{args}") unless logger.nil?
|
184
184
|
client = client.nil? ? Uc3DmpDynamo::Client.new : client
|
185
185
|
_process_search_response(response: client.query(args: args, logger: logger))
|
186
186
|
end
|
data/lib/uc3-dmp-id/validator.rb
CHANGED
@@ -45,7 +45,7 @@ module Uc3DmpId
|
|
45
45
|
# ------------------------------------------------------------------------------------
|
46
46
|
def _load_schema(mode:)
|
47
47
|
# Instatiate the matching schema
|
48
|
-
schema = "Uc3DmpId::Schemas::#{mode.to_s.downcase.capitalize}".split('::').inject(Object) { |o,c|
|
48
|
+
schema = "Uc3DmpId::Schemas::#{mode.to_s.downcase.capitalize}".split('::').inject(Object) { |o,c| o.const_get c }
|
49
49
|
schema.respond_to?(:load) ? schema.load : nil
|
50
50
|
end
|
51
51
|
|
data/lib/uc3-dmp-id/version.rb
CHANGED
data/lib/uc3-dmp-id/versioner.rb
CHANGED
@@ -38,12 +38,9 @@ module Uc3DmpId
|
|
38
38
|
latest_version = Finder.by_p_key(client: client, p_key: p_key) unless latest_version.is_a?(Hash) &&
|
39
39
|
!latest_version['PK'].nil?
|
40
40
|
|
41
|
-
|
42
|
-
return nil unless latest['SK'] != Helper::DMP_LATEST_VERSION
|
43
|
-
|
44
|
-
owner = latest['dmphub_provenance_id']
|
41
|
+
owner = latest_version['dmphub_provenance_id']
|
45
42
|
updater = provenance['PK']
|
46
|
-
prior = _generate_version(client: client, latest_version:
|
43
|
+
prior = _generate_version(client: client, latest_version: latest_version, owner: owner, updater: updater)
|
47
44
|
return nil if prior.nil?
|
48
45
|
|
49
46
|
args = { owner: owner, updater: updater, base: prior, mods: dmp, logger: logger }
|
@@ -111,7 +108,6 @@ module Uc3DmpId
|
|
111
108
|
resp = client.put_item(json: latest_version, logger: logger)
|
112
109
|
return nil if resp.nil?
|
113
110
|
|
114
|
-
puts "Created new version #{latest_version['PK']} - #{latest_version['SK']}" if debug
|
115
111
|
msg = "#{SOURCE} created version PK: #{latest_version['PK']} SK: #{latest_version['SK']}"
|
116
112
|
logger.info(message: msg, details: latest_version) if logger.respond_to?(:debug)
|
117
113
|
latest_version
|