ddr-batch 2.0.0.alpha.2 → 2.0.0.alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 824038c27b5269a2816f0d253891c345a69e42c6
4
- data.tar.gz: 06b2646d38c6975037358d695ddd83d8a6231ad4
3
+ metadata.gz: f96c0f1f769ec80cade15b674d9762447e769fb3
4
+ data.tar.gz: d68014dc69eae5e2494889f4a79aca769aba0f1d
5
5
  SHA512:
6
- metadata.gz: 293bf55a24e1fc20b7139af536965a1bff028e23c27033fca4b879c633c381faa39ef7b81d1c1888cb55d3811aaec7fec27f183ae7c0db7ddd43267e30386078
7
- data.tar.gz: 66cbc236d73feb005e5c276b8072450462e121c69e81ebdf0fc46e36cef4e734bb28f8199b892cd220d75a769d1c245546db07354ee6f7413f2cf94a0c6ec4ec
6
+ metadata.gz: 91d4affd0356322275b123be05bc679c82f21d385cd6edac9afdb1fed2069bbe16ce2a9858ff5d411eded91c853d68e2ba9add1f3870a8cbfdff47280c99959b
7
+ data.tar.gz: aec0a4258f45c05a5f8ac46934bd45bc2a994ab93a0de724773790af9d693b10844c09398c8f73ca0016c4b5eb834cc01bf90e749738e6aefd5cf92e8a9b3428
@@ -16,6 +16,7 @@ module Ddr::Batch
16
16
 
17
17
  validates :operation, inclusion: { in: OPERATIONS }
18
18
  validates :datastream, presence: true
19
+ validate :valid_datastream_operation
19
20
  with_options if: :operation_requires_name? do |obj|
20
21
  obj.validates :name, presence: true
21
22
  end
@@ -25,6 +26,14 @@ module Ddr::Batch
25
26
  obj.validates :value_type, inclusion: { in: VALUE_TYPES }
26
27
  end
27
28
 
29
+ def valid_datastream_operation
30
+ if operation == OPERATION_CLEAR_ALL
31
+ unless datastream == 'descMetadata'
32
+ errors.add(:operation, "Operation #{operation} is not valid for #{datastream}")
33
+ end
34
+ end
35
+ end
36
+
28
37
  def operation_requires_name?
29
38
  [ OPERATION_ADD, OPERATION_DELETE, OPERATION_CLEAR ].include? operation
30
39
  end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Batch
3
- VERSION = "2.0.0.alpha.2"
3
+ VERSION = "2.0.0.alpha.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.2
4
+ version: 2.0.0.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-03 00:00:00.000000000 Z
12
+ date: 2016-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails