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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 806dbb2a9821958ce5b6d32219023f671ea6119e837ae1de29753a6d5acf4ce2
4
- data.tar.gz: 2ff4c8cafe89cb3169dc44d0feaa8ea77268ad109213f58bede51a0a0c65ffd9
3
+ metadata.gz: d4777a819ac1d24ba32e2d4e1110db3356741957d5aee5e50da7cf503e8be424
4
+ data.tar.gz: 2b28808d7652c94eee7971c259173428ca39bd8f1517db0d7f5a0b22bb2d63c6
5
5
  SHA512:
6
- metadata.gz: ea6d083e9e2b7f1907c019ac450232cb33cd0c060b0f71aa23a84099b9d45f8b476458598d2be36d9d4061da88f8b702cc9e8fbfcc38dd50446198d2f2741f22
7
- data.tar.gz: 553ca24e53f1a98b30a782ae58d2a0005139675e1f6de23f6d2b0dae2d92553de690b6eb5642d6567204890c59a4be8ec1c15eff868963264951271b0c2c0cda
6
+ metadata.gz: f05df072a1b7dbff40cdd98edf346811322a0dc9d969f459f19c79a47c0492d1057f836378e903df73cb9d57dd07a4ccee946a671bb61e02d07c2643b45e5c29
7
+ data.tar.gz: 3638037edd2dbad88417df2fa7ba38064fa4bfc56a873a002d3360ff780f05581658a60435fac359c5edfd071e26943736c23bc4ca930b9ccded49351bf25ca0
@@ -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:, base64: false)
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpS3
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley