uc3-dmp-s3 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/uc3-dmp-s3/client.rb +10 -1
- data/lib/uc3-dmp-s3/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4777a819ac1d24ba32e2d4e1110db3356741957d5aee5e50da7cf503e8be424
|
4
|
+
data.tar.gz: 2b28808d7652c94eee7971c259173428ca39bd8f1517db0d7f5a0b22bb2d63c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f05df072a1b7dbff40cdd98edf346811322a0dc9d969f459f19c79a47c0492d1057f836378e903df73cb9d57dd07a4ccee946a671bb61e02d07c2643b45e5c29
|
7
|
+
data.tar.gz: 3638037edd2dbad88417df2fa7ba38064fa4bfc56a873a002d3360ff780f05581658a60435fac359c5edfd071e26943736c23bc4ca930b9ccded49351bf25ca0
|
data/lib/uc3-dmp-s3/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Uc3DmpS3
|
|
25
25
|
|
26
26
|
class << self
|
27
27
|
# Put the narrative file into the S3 bucket
|
28
|
-
def put_resource_file(file:, explorer_details
|
28
|
+
def put_resource_file(file:, explorer_details:)
|
29
29
|
return nil if File.nil? || !explorer_details.is_a?(Hash) || ENV['S3_BUCKET'].nil? ||
|
30
30
|
explorer_details.fetch('file_metadata', {})['filename'].nil?
|
31
31
|
|
@@ -39,6 +39,15 @@ module Uc3DmpS3
|
|
39
39
|
raise ClientError, "#{msg} - #{e.message}"
|
40
40
|
end
|
41
41
|
|
42
|
+
# Fetch the narrative file from the S3 bucket
|
43
|
+
def get_resource_file(key:)
|
44
|
+
return nil unless key.is_a?(String) && !key.strip.empty? && !ENV['S3_BUCKET'].nil?
|
45
|
+
|
46
|
+
obj = _get_object(key: key.start_with?(RESOURCE_KEY_PREFIX) ? key : "#{RESOURCE_KEY_PREFIX}#{key}")
|
47
|
+
rescue Aws::Errors::ServiceError => e
|
48
|
+
raise ClientError, "Unable to fetch External Resource file from S3 bucket (key: #{key}) - #{e.message}"
|
49
|
+
end
|
50
|
+
|
42
51
|
# Put the narrative file into the S3 bucket
|
43
52
|
def put_narrative(document:, dmp_id: nil, base64: false)
|
44
53
|
return nil if !document.is_a?(String) || document.strip.empty? || ENV['S3_BUCKET'].nil?
|
data/lib/uc3-dmp-s3/version.rb
CHANGED