ddr-models 2.7.0 → 2.7.1
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd25ca1a87f36aa646b09de9fe52311735db39c9
|
4
|
+
data.tar.gz: d3d0b4ec50f9e35fbbccdb1ed2abc633ae9c6592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167c0ac775721da5cba94ef7eb09b760eb9ad20796f869e3b613d22ad3b52ecc246b8cb93efa43017e18726e702c69ab888ef6e51013267fe18344a44d2fa0d8
|
7
|
+
data.tar.gz: 346fc64b0c5292893c88e0f032d46a0b622634023562a979f133c566c4ee174a066c598a87cfe29681d1d6f462ca57f46facfdbcfe022b0bb86651e80d5f31e9
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
1
3
|
module Ddr::Datastreams
|
2
4
|
class ExternalFileDatastream < ActiveFedora::Datastream
|
3
5
|
|
@@ -46,6 +48,11 @@ module Ddr::Datastreams
|
|
46
48
|
new? ? Array(file_path) : versions.map(&:file_path)
|
47
49
|
end
|
48
50
|
|
51
|
+
def content_digest(algorithm=Ddr::Datastreams::CHECKSUM_TYPE_SHA1)
|
52
|
+
digest_class = Digest.const_get(algorithm.sub("-", ""))
|
53
|
+
digest_class.file(file_path).hexdigest
|
54
|
+
end
|
55
|
+
|
49
56
|
private
|
50
57
|
|
51
58
|
def store(source_path)
|
data/lib/ddr/models/version.rb
CHANGED
@@ -33,5 +33,15 @@ module Ddr::Datastreams
|
|
33
33
|
expect(subject.file_path).to be_nil
|
34
34
|
}
|
35
35
|
|
36
|
+
describe "checksum validation" do
|
37
|
+
before do
|
38
|
+
subject.add_file(file1.path, mime_type: file1.content_type)
|
39
|
+
obj.save!
|
40
|
+
end
|
41
|
+
it "should not call Rubydora to retrieve datastream content" do
|
42
|
+
expect(subject).to_not receive(:content)
|
43
|
+
subject.validate_checksum!('a6ae0d815c1a2aef551b45fe34a35ceea1828a4d', Ddr::Datastreams::CHECKSUM_TYPE_SHA1)
|
44
|
+
end
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1
|
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: 2017-04-
|
12
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|