uc3-dmp-id 0.0.30 → 0.0.32

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: 1f4ce38233177d1b1e22baed19433da77c8a25c0acee58101ba4e850addd687f
4
- data.tar.gz: 3759570bcfa5ca95481b06e138f9c87019a26b16bc328b57ec47605ea23d1b35
3
+ metadata.gz: e9c5eb1e3af04a0d8ed5468b4f2357872e63e8a07e06ce071a6414daed420a27
4
+ data.tar.gz: fd042c4b9bb088a893010bcaf7e5d84fdb884a7c8ef513313159508bcbe79056
5
5
  SHA512:
6
- metadata.gz: c28f028177f51d082e1a002038743f274ca7032e2fb5fca74fdea186641e2286b1219e71b2dbb3279e2023a7a1e3fa3e25513c5f3eda9d7527601e2c81b0e750
7
- data.tar.gz: dbc4defdafb8221e41127d12e74fb7439761f1eea5e5a4fb5f1ced7de110584bd1b45cca9f11a0f769bf9663af155b6a238dd155e08392eb80f075f6c4344821
6
+ metadata.gz: ac616730bfdc04c41a01bda6bbcd795981a889df0a2fe0d5ec8087a1047380a1b8a020bc6b72274c57941004e5b7e198ed00f98df8b946a755f67379e0dc651f
7
+ data.tar.gz: 5fe3de09a45418038dbc64241938955bdd5273dceb4d3fa329f1f7d5bf6ba3841b9307461947fc3c5ac5bbfef1e701bbb4a41a9cd6d192a76fc24a5f5316db40
@@ -19,8 +19,8 @@ module Uc3DmpId
19
19
  raise DeleterError, MSG_DMP_FORBIDDEN unless provenance.is_a?(Hash) && !provenance['PK'].nil?
20
20
 
21
21
  # Validate the incoming JSON first
22
- errs = Validator.validate(mode: 'author', json: Helper.parse_json(json: json))&.fetch('dmp', {})
23
- raise CreatorError, errs.join(', ') if errs.is_a?(Array) && errs.any?
22
+ errs = Validator.validate(mode: 'author', json: Helper.parse_json(json: json))
23
+ raise CreatorError, errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
24
24
 
25
25
  # Fail if the provenance or owner affiliation are not defined
26
26
  raise CreatorError, MSG_NO_PROVENANCE_OWNER if provenance.nil? || owner_org.nil?
@@ -47,7 +47,7 @@ module Uc3DmpId
47
47
  def _updateable?(provenance:, p_key:, json:)
48
48
  # Validate the incoming JSON first
49
49
  errs = Validator.validate(mode: 'author', json: json)&.fetch('dmp', {})
50
- return errs.join(', ') if errs.is_a?(Array) && errs.any?
50
+ return errs.join(', ') if errs.is_a?(Array) && errs.any? && errs.first != Validator::MSG_VALID_JSON
51
51
 
52
52
  # Fail if the provenance is not defined
53
53
  return [MSG_DMP_FORBIDDEN] unless provenance.is_a?(Hash) && !provenance['PK'].nil?
@@ -44,12 +44,6 @@ module Uc3DmpId
44
44
  # Load the JSON schema that corresponds with the mode
45
45
  # ------------------------------------------------------------------------------------
46
46
  def _load_schema(mode:)
47
-
48
- puts "::Uc3DmpId::Schemas::Author defined? #{Object.const_defined?('::Uc3DmpId::Schemas::Author')}"
49
- puts "Uc3DmpId::Schemas::Author defined? #{Object.const_defined?('Uc3DmpId::Schemas::Author')}"
50
- puts "Schemas::Author defined? #{Object.const_defined?('Schemas::Author')}"
51
- puts "Author defined? #{Object.const_defined?('Author')}"
52
-
53
47
  # Instatiate the matching schema
54
48
  schema = "Uc3DmpId::Schemas::#{mode.to_s.downcase.capitalize}".split('::').inject(Object) { |o,c| p o; o.const_get c }
55
49
  schema.respond_to?(:load) ? schema.load : nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.0.30'
4
+ VERSION = '0.0.32'
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.30
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley