multi_video_streaming 1.0.0.beta1 → 1.0.0.beta3
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/multi_video_streaming/drivers/s3.rb +1 -6
- data/lib/multi_video_streaming/errors/invalid_s3_method_name.rb +11 -0
- data/lib/multi_video_streaming/errors.rb +1 -0
- data/lib/multi_video_streaming/helpers.rb +3 -3
- data/lib/multi_video_streaming/utils/s3/generate_presign_url.rb +15 -0
- data/lib/multi_video_streaming/utils.rb +3 -0
- data/lib/multi_video_streaming/version.rb +1 -1
- data/lib/multi_video_streaming.rb +1 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acf42e8d2007eef149c4dcdd7d7d7e03af262560a55bb81ff54c6a918b08f6bc
|
4
|
+
data.tar.gz: cbe6379565d1ed0725390656eeefa3c66aae23e9ea20e20441060570d59c8792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac96bdf4b26d0be4bac76b78b709628a446ae48a95c263bb04256482173447a335427fe0bb0d8c0bf1a8c4355d1d47a1dab2ee7941926d94b1dc2512310a149
|
7
|
+
data.tar.gz: 9064f855a2f808e9fb415998536af588c49fe660b07cca011be2ff805f5e1911ccf114916b6fc8de9fa64009fc92cbb97b881d0bce408d13af61f3ecdd42df17
|
@@ -29,7 +29,7 @@ module MultiVideoStreaming
|
|
29
29
|
response = Aws::S3::Resource.new().bucket(bucket).object(video_id)
|
30
30
|
video_url = response.public_url
|
31
31
|
|
32
|
-
url_signed = generate_presign_url(bucket: bucket, key: video_id)
|
32
|
+
url_signed = MultiVideoStreaming::Utils::S3.generate_presign_url(bucket: bucket, key: video_id)
|
33
33
|
data = {
|
34
34
|
"key": response.key,
|
35
35
|
"title": response.key,
|
@@ -140,11 +140,6 @@ module MultiVideoStreaming
|
|
140
140
|
Aws.config.update(credentials: credentials, region: region, force_path_style: true)
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
144
|
-
def generate_presign_url(bucket:, key:)
|
145
|
-
signer = Aws::S3::Presigner.new
|
146
|
-
signer.presigned_url(:get_object, bucket: bucket, key: key, expires_in: 900)
|
147
|
-
end
|
148
143
|
end
|
149
144
|
end
|
150
145
|
end
|
@@ -3,5 +3,6 @@
|
|
3
3
|
require "multi_video_streaming/errors/duplicated_platform_name"
|
4
4
|
require "multi_video_streaming/errors/invalid_platform_name"
|
5
5
|
require "multi_video_streaming/errors/invalid_platforms_param"
|
6
|
+
require "multi_video_streaming/errors/invalid_s3_method_name"
|
6
7
|
require "multi_video_streaming/errors/missing_param"
|
7
8
|
require "multi_video_streaming/errors/s3_is_not_valid_to_upload"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "multi_video_streaming/helpers/title_from_url
|
4
|
-
require "multi_video_streaming/helpers/sort_files_array_by_label
|
5
|
-
require "multi_video_streaming/helpers/get_default_error_message
|
3
|
+
require "multi_video_streaming/helpers/title_from_url"
|
4
|
+
require "multi_video_streaming/helpers/sort_files_array_by_label"
|
5
|
+
require "multi_video_streaming/helpers/get_default_error_message"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MultiVideoStreaming
|
4
|
+
module Utils
|
5
|
+
module S3
|
6
|
+
def self.generate_presign_url(method:, bucket:, key:)
|
7
|
+
methods = { :get => :get_object, :put => :put_object, :delete => :delete_object }
|
8
|
+
method_to_generate_presign_url = methods[method]
|
9
|
+
raise MultiVideoStreaming::Errors::InvalidS3MethodName.new(method) if method_to_generate_presign_url.nil?
|
10
|
+
signer = Aws::S3::Presigner.new
|
11
|
+
signer.presigned_url(method_to_generate_presign_url, bucket: bucket, key: key, expires_in: 900)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -16,6 +16,7 @@ require "multi_video_streaming/factories"
|
|
16
16
|
require "multi_video_streaming/errors"
|
17
17
|
require "multi_video_streaming/response"
|
18
18
|
require "multi_video_streaming/helpers"
|
19
|
+
require "multi_video_streaming/utils"
|
19
20
|
require "multi_video_streaming/version"
|
20
21
|
require "multi_video_streaming/validators"
|
21
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_video_streaming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Schmeller
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/multi_video_streaming/errors/duplicated_platform_name.rb
|
84
84
|
- lib/multi_video_streaming/errors/invalid_platform_name.rb
|
85
85
|
- lib/multi_video_streaming/errors/invalid_platforms_param.rb
|
86
|
+
- lib/multi_video_streaming/errors/invalid_s3_method_name.rb
|
86
87
|
- lib/multi_video_streaming/errors/missing_param.rb
|
87
88
|
- lib/multi_video_streaming/errors/s3_is_not_valid_to_upload.rb
|
88
89
|
- lib/multi_video_streaming/factories.rb
|
@@ -99,6 +100,8 @@ files:
|
|
99
100
|
- lib/multi_video_streaming/response.rb
|
100
101
|
- lib/multi_video_streaming/services.rb
|
101
102
|
- lib/multi_video_streaming/services/https.rb
|
103
|
+
- lib/multi_video_streaming/utils.rb
|
104
|
+
- lib/multi_video_streaming/utils/s3/generate_presign_url.rb
|
102
105
|
- lib/multi_video_streaming/validators.rb
|
103
106
|
- lib/multi_video_streaming/validators/platform_name_validator.rb
|
104
107
|
- lib/multi_video_streaming/validators/platforms_array_validator.rb
|