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: 6b429bd2736b54b0f4f7b606eea45b49a1529c76
4
- data.tar.gz: 7aca1f980bfeff6efd3b2636edc30a45abe45d04
3
+ metadata.gz: cd25ca1a87f36aa646b09de9fe52311735db39c9
4
+ data.tar.gz: d3d0b4ec50f9e35fbbccdb1ed2abc633ae9c6592
5
5
  SHA512:
6
- metadata.gz: 17ceb7a9dcafa94141873a1b7f0c5079a5a6dd4f2adbdc48416110d629bf3fc79a2862ff6c5c7533184a0cf349d3a1a1f461dc7567818db32cc4222faf3246bc
7
- data.tar.gz: 82a94f3aeab73f92b382e3e3459a1c8207f3f994af30308b6aee41e2b982fb3d843142890d4b029afcd5382080dcd4998d66dea5ac740ebb725ce4031d3d0e5c
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)
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Models
3
- VERSION = "2.7.0"
3
+ VERSION = "2.7.1"
4
4
  end
5
5
  end
@@ -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.0
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-05 00:00:00.000000000 Z
12
+ date: 2017-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails