outreach_gem 1.0.76 → 1.0.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/outreach-s3/ruby-upload-s3.rb +23 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 97ec8afa61b6beb80b50d295026341cb55967310995947653a99f12f69e78bd4
|
|
4
|
+
data.tar.gz: aaa53c5f11338054d5517b34a12ed7d9c7b540d52b3cc6b718f34210c8d47b5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11e7f9659e69f5f7f820bad4cbddb231e173619727beb0c955f2e51279258cdd5fc37ca2a93325feb54a4535fdf8dc7b9d4f27f3c9d4ea3d7761f5f7368ff056
|
|
7
|
+
data.tar.gz: a958b354c1d507853f94008f2cfc02b1f405db6b1ae0ee3e942b0e056bba389aa226e54d27a0e8270687006fdd143f8cbd3a7480e31c4d6ba984831ef8a9b4c4
|
|
@@ -41,16 +41,32 @@ class OutreachUploadS3
|
|
|
41
41
|
})
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
# When it comes to binary files you should be doing open then the read
|
|
45
|
+
# operations to it. Must not forget to close the file when performing
|
|
46
|
+
# an open operation on it.
|
|
44
47
|
# @param path [String] path to the file that needs to be uploaded
|
|
45
48
|
# @param key [String] the name of the object to upload
|
|
49
|
+
# @return obj [Hashes] the resulting object being returned from AWS S3
|
|
46
50
|
def uploadFile(path, key)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
if path.nil? or path.empty?
|
|
52
|
+
raise 'Cannot have an empty path when attempting to upload an object to AWS S3'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if key.nil? or key.empty?
|
|
56
|
+
raise 'Cannot have an empty key when uploading an Object to S3'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
begin
|
|
60
|
+
# Open the file and get it ready to be read
|
|
61
|
+
file = File.open(path, 'rb')
|
|
62
|
+
|
|
63
|
+
# Stream the file into the S3 bucket
|
|
64
|
+
return @s3_client.put_object(bucket: @bucketName, key: key, body: file)
|
|
65
|
+
ensure
|
|
66
|
+
unless file.nil?
|
|
67
|
+
file.close
|
|
68
|
+
end
|
|
69
|
+
end
|
|
54
70
|
end
|
|
55
71
|
|
|
56
72
|
# Retrieve an item from S3 and return it in memory
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: outreach_gem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.78
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patrique Legault
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: patrique.legault@uottawa.ca
|