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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13c2a01e8e979f1cc3a4e9fe003cb8429d742c0e5b9d217d78e2d93bd36c276c
4
- data.tar.gz: 5541be19755ac0850166d14fd4e02408d02db1e35caf83cddab527729c061a54
3
+ metadata.gz: 55e15684bfc0ccb76cb498ccddfae9b83c8ce935240efbb5ad1112ddbf791ab8
4
+ data.tar.gz: 2a729a50e838d4e25a4921d5a33f6b12b3e786e2da4c91b12016340b6d5a158b
5
5
  SHA512:
6
- metadata.gz: 0d9e65edacb5d45bef33510718f50023fb14abf271859ca07910bd2b60941ebb7219e662efcead0a818141e7e2349f5e57c81e705162685dbe7cd6d736c60238
7
- data.tar.gz: f5e2103aa8360d25a73ec5af6415a3087c73afdfc63c03983cbdf798e107e1bb086f0effc7c00ca3ddd71e4859e48832e03d441a2d092ff11ab4c0f0db053fcc
6
+ metadata.gz: 70315b0ebd96129ec4c7ba051e39d5e385952079f20a565e000bd7b4812be60687a2cde3c414c66db71bda2ccb35a67e06dfcf90aa21b65dee22cb26786ddbfb
7
+ data.tar.gz: '0481364645a94de5cb4178bd4657b7d7e1622016cbc7bb0ff9cd3e2082efe2424f5bc98cf47d4b36f2e59515399e7dbd237f4e62ba49b025e788ae0c705bb135'
@@ -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
- puts "ERROR in Uc3DmpId::Deleter - #{e.message}"
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
@@ -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
- puts "Querying _by_owner with #{args}" if debug
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
- puts "Querying _by_owner_org with #{args}" if debug
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
- puts "Querying _by_mod_day with #{args}" if debug
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
@@ -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| p o; o.const_get 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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.90'
4
+ VERSION = '0.0.92'
5
5
  end
@@ -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
- # Only continue if there was an existing record and its the latest version
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: latest, owner: owner, updater: updater)
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
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.90
4
+ version: 0.0.92
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley