valkyrie-shrine 0.3.0 → 0.4.0

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: aef24fabeacf6da3dce1036b01bbc5738921e79f205b38c067d67d5d62d623f4
4
- data.tar.gz: 53e0b0ffd66e766c808c0a5ce1be1ba340f4fe4404806f4f0c0c909eb62d5fd1
3
+ metadata.gz: 9b14a6f34ed732f2ad8fba8517734c2a63b3b3e0683b10d720c30acd58ca12fb
4
+ data.tar.gz: aa4d0cfbbe47beef0196ecb5761915411b82b1d662124345a65ebb3ad9aec125
5
5
  SHA512:
6
- metadata.gz: 4573d6b6f1ba7e0e6bdd4dc03df7cf442f9c73e727498bd36c064d8ad75df56fe4d13fa9f159cd3dfa52150bf2eefc6f3a903afbd32acc9d47d9141152360b9f
7
- data.tar.gz: f6e541e72d6b15fda6fb9611a7422eede93d33054450662954b0c5bbab970df03154038a954b6f54f5821421ab2fea84ea8dbf86b591ecf4b99a3dbe829f6740
6
+ metadata.gz: 59deb36fc5a6bfd73912c49ea313a4b8126af086d4c359253c606bbb3183bbf8ee50d7a80ef9e35ed3758138fc27cd68191fda0e53f209ad93ed9c10c750123e
7
+ data.tar.gz: 7a626c0a02be2089faccd4ceaaacba57bf7d28440259f1948189948282ee2fd7881fe881f1b482c5a7f52f1fdfc0cf7c6eb78fa2f97fd6fcf7ceb31aad3eb701
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Valkyrie
4
4
  module Shrine
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
@@ -20,6 +20,27 @@ module Valkyrie
20
20
  end
21
21
  end
22
22
 
23
+ class DelayedDownload
24
+ attr_reader :shrine, :id
25
+ def initialize(shrine, id)
26
+ @shrine = shrine
27
+ @id = id
28
+ end
29
+
30
+ def file
31
+ @file ||= shrine.open(id)
32
+ end
33
+
34
+ def method_missing(meth_name, *args, &block)
35
+ return super unless file.respond_to?(meth_name)
36
+ file.send(meth_name, *args, &block)
37
+ end
38
+
39
+ def respond_to_missing?(meth_name, include_private = false)
40
+ file.respond_to?(meth_name) || super
41
+ end
42
+ end
43
+
23
44
  def initialize(shrine_storage, verifier = nil, path_generator = IDPathGenerator, identifier_prefix: nil)
24
45
  @path_generator = path_generator.new(base_path: "")
25
46
  @shrine = shrine_storage
@@ -57,7 +78,7 @@ module Valkyrie
57
78
  # @raise Valkyrie::StorageAdapter::FileNotFound if nothing is found
58
79
  def find_by(id:)
59
80
  raise Valkyrie::StorageAdapter::FileNotFound unless shrine.exists?(shrine_id_for(id))
60
- Valkyrie::StorageAdapter::StreamFile.new(id: Valkyrie::ID.new(id.to_s), io: shrine.open(shrine_id_for(id)))
81
+ Valkyrie::StorageAdapter::StreamFile.new(id: Valkyrie::ID.new(id.to_s), io: DelayedDownload.new(shrine, shrine_id_for(id)))
61
82
  rescue Aws::S3::Errors::NoSuchKey
62
83
  raise Valkyrie::StorageAdapter::FileNotFound
63
84
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_development_dependency 'bixby', '~> 2.0.0.pre.beta1'
31
31
  spec.add_development_dependency 'bundler', '~> 2.0'
32
- spec.add_development_dependency 'coveralls'
32
+ spec.add_development_dependency 'coveralls', '~> 0.8.3'
33
33
  spec.add_development_dependency 'pry'
34
34
  spec.add_development_dependency 'pry-byebug'
35
35
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valkyrie-shrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Quinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-26 00:00:00.000000000 Z
11
+ date: 2020-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: coveralls
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.8.3
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.8.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
222
  - !ruby/object:Gem::Version
223
223
  version: '0'
224
224
  requirements: []
225
- rubygems_version: 3.0.1
225
+ rubygems_version: 3.1.2
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Shrine storage adapter for Valkyrie