onlyoffice_s3_wrapper 0.4.0 → 0.5.0
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/onlyoffice_s3_wrapper/version.rb +1 -1
- data/lib/onlyoffice_s3_wrapper.rb +11 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25f38aa09f4a824ded25d7ce67f2d755b6198bc3d3ef0da38ce34f7f764ee073
|
4
|
+
data.tar.gz: 867c8fbe23ef0652ac46d67616603bc3f1114cbcbd42e9bb4be1f0328640d94f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd20669e80e5d8864681f3bc027d669e2ca87b90b011d4cae92807221d1ff958c746e500599a260a9848b44b4d9394dd590139624bdee54451f7acef7e4809ec
|
7
|
+
data.tar.gz: 1215716abf6d09264ba2af95ce961b70d1fcb8369b68addfb854579ff839d02c4d1e16b39b46084b5ed89857f8eb3e4ebe4be1d45752b7e4f30833db7c32b3f4
|
@@ -11,6 +11,9 @@ require 'onlyoffice_s3_wrapper/version'
|
|
11
11
|
module OnlyofficeS3Wrapper
|
12
12
|
# Class for working with amazon s3
|
13
13
|
class AmazonS3Wrapper
|
14
|
+
# @return [String] default content type for uploaded files
|
15
|
+
DEFAULT_CONTENT_TYPE = 'binary/octet-stream'
|
16
|
+
|
14
17
|
include PathHelper
|
15
18
|
attr_accessor :s3, :bucket, :download_folder
|
16
19
|
# [String] Amazon key
|
@@ -93,11 +96,12 @@ module OnlyofficeS3Wrapper
|
|
93
96
|
# Upload file
|
94
97
|
# @param file_path [String] file to upload
|
95
98
|
# @param upload_folder [String] path to upload
|
99
|
+
# @param content_type [String] content type of file to upload
|
96
100
|
# @return [nil]
|
97
|
-
def upload_file(file_path, upload_folder)
|
101
|
+
def upload_file(file_path, upload_folder, content_type = DEFAULT_CONTENT_TYPE)
|
98
102
|
path = bucket_file_path(File.basename(file_path),
|
99
103
|
upload_folder)
|
100
|
-
@bucket.object(path).upload_file(file_path)
|
104
|
+
@bucket.object(path).upload_file(file_path, content_type: content_type)
|
101
105
|
end
|
102
106
|
|
103
107
|
# Make file public
|
@@ -119,9 +123,12 @@ module OnlyofficeS3Wrapper
|
|
119
123
|
# Upload file/folder and make public
|
120
124
|
# @param file_path [String] file to upload
|
121
125
|
# @param upload_folder [True, False] is this a folder
|
126
|
+
# @param content_type [String] content type of file to upload
|
122
127
|
# @return [String] public url
|
123
|
-
def upload_file_and_make_public(file_path,
|
124
|
-
|
128
|
+
def upload_file_and_make_public(file_path,
|
129
|
+
upload_folder = nil,
|
130
|
+
content_type = DEFAULT_CONTENT_TYPE)
|
131
|
+
upload_file(file_path, upload_folder, content_type)
|
125
132
|
make_public(bucket_file_path(File.basename(file_path), upload_folder))
|
126
133
|
@bucket.object(bucket_file_path(File.basename(file_path),
|
127
134
|
upload_folder)).public_url
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlyoffice_s3_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-12-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: aws-sdk-s3
|
@@ -193,6 +193,7 @@ metadata:
|
|
193
193
|
documentation_uri: https://www.rubydoc.info/gems/onlyoffice_s3_wrapper
|
194
194
|
homepage_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_s3_wrapper
|
195
195
|
source_code_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_s3_wrapper
|
196
|
+
rubygems_mfa_required: 'true'
|
196
197
|
post_install_message:
|
197
198
|
rdoc_options: []
|
198
199
|
require_paths:
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
- !ruby/object:Gem::Version
|
209
210
|
version: '0'
|
210
211
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.2.32
|
212
213
|
signing_key:
|
213
214
|
specification_version: 4
|
214
215
|
summary: ONLYOFFICE Helper Gem for S3
|