multi_video_streaming 1.0.1.beta4 → 1.0.1.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multi_video_streaming/drivers/bunny.rb +1 -2
- data/lib/multi_video_streaming/drivers/s3.rb +1 -1
- data/lib/multi_video_streaming/drivers/vimeo.rb +1 -2
- data/lib/multi_video_streaming/utils/s3/generate_presign_url.rb +3 -3
- data/lib/multi_video_streaming/version.rb +1 -1
- data/lib/multi_video_streaming.rb +2 -2
- metadata +1 -2
- data/lib/multi_video_streaming/helpers/title_from_url.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f01a78b03269551e463812ba899a4a1cac55b14f2690625356fc423b8fcc02a
|
4
|
+
data.tar.gz: 0dab500b9a3e956f6b0893fa3a0220382ac1c22897a1a8da6ddd0cfe057c48c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45d14d8e39a762ac4a8ab6a9c77184bb40bcab546fbeffbd94f7d3e8bcb00ea82f517cc98b1a1e11eba7415775588042d3363d152bec6b6fe03d9af94cfa1287
|
7
|
+
data.tar.gz: bf180a6375cc2dca09447e3ecdf072343b7354c363135783b39453ac6f47d93a0acb09a2e18e64851c94ee30f0a0b4fc9b18db58d2b504a43adb5f8def0e73ff
|
@@ -24,14 +24,13 @@ module MultiVideoStreaming
|
|
24
24
|
|
25
25
|
BASE_URL = "https://video.bunnycdn.com"
|
26
26
|
|
27
|
-
def upload_video(url:)
|
27
|
+
def upload_video(url:, title:)
|
28
28
|
begin
|
29
29
|
library_id, api_key = self.dependency_params.values_at(:library_id, :api_key)
|
30
30
|
@original_status_code = nil
|
31
31
|
|
32
32
|
self.required_fields_validator_instance.validate(library_id: library_id, api_key: api_key)
|
33
33
|
|
34
|
-
title = MultiVideoStreaming::Helpers::TitleFromUrl.get(url: url)
|
35
34
|
create_video_response = self.https_service_instance.post(uri: "#{BASE_URL}/library/#{library_id}/videos", headers: { :AccessKey => api_key }, body: { :title => title })
|
36
35
|
|
37
36
|
if create_video_response["status_code"] != 200
|
@@ -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 = MultiVideoStreaming::Utils::S3.generate_presign_url(method: :get, bucket: bucket, key: video_id, download: false)
|
32
|
+
url_signed = MultiVideoStreaming::Utils::S3.generate_presign_url(method: :get, bucket: bucket, key: video_id, download: false, expires_in: 900)
|
33
33
|
data = {
|
34
34
|
"key": response.key,
|
35
35
|
"title": response.key,
|
@@ -27,10 +27,9 @@ module MultiVideoStreaming
|
|
27
27
|
|
28
28
|
VIMEO_URL = "https://api.vimeo.com"
|
29
29
|
|
30
|
-
def upload_video(url:)
|
30
|
+
def upload_video(url:, title:)
|
31
31
|
begin
|
32
32
|
token = self.dependency_params[:token]
|
33
|
-
title = MultiVideoStreaming::Helpers::TitleFromUrl.get(url: url)
|
34
33
|
@original_status_code = nil
|
35
34
|
|
36
35
|
self.required_fields_validator_instance.validate(token: token)
|
@@ -3,15 +3,15 @@
|
|
3
3
|
module MultiVideoStreaming
|
4
4
|
module Utils
|
5
5
|
module S3
|
6
|
-
def self.generate_presign_url(method:, bucket:, key:, download:)
|
6
|
+
def self.generate_presign_url(method:, bucket:, key:, download:, expires_in: )
|
7
7
|
methods = { :get => :get_object, :put => :put_object, :delete => :delete_object }
|
8
8
|
method_to_generate_presign_url = methods[method]
|
9
9
|
raise MultiVideoStreaming::Errors::InvalidS3MethodName.new(method) if method_to_generate_presign_url.nil?
|
10
10
|
signer = Aws::S3::Presigner.new
|
11
11
|
if download
|
12
|
-
signer.presigned_url(method_to_generate_presign_url, bucket: bucket, key: key, expires_in:
|
12
|
+
signer.presigned_url(method_to_generate_presign_url, bucket: bucket, key: key, expires_in: expires_in, whitelist_headers: ['response-content-disposition'], response_content_disposition: 'attachment')
|
13
13
|
else
|
14
|
-
signer.presigned_url(method_to_generate_presign_url, bucket: bucket, key: key, expires_in:
|
14
|
+
signer.presigned_url(method_to_generate_presign_url, bucket: bucket, key: key, expires_in: expires_in)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -19,7 +19,7 @@ require "multi_video_streaming/version"
|
|
19
19
|
require "multi_video_streaming/validators"
|
20
20
|
|
21
21
|
module MultiVideoStreaming
|
22
|
-
def self.upload(url
|
22
|
+
def self.upload(url:, title:, *platforms)
|
23
23
|
MultiVideoStreaming::Validators::PlatformsArrayValidator.validate(platforms_array: platforms)
|
24
24
|
MultiVideoStreaming::Validators::PlatformsHashValidator.validate(platforms_hash: platforms, method: :create, number_of_platforms: platforms.length)
|
25
25
|
|
@@ -35,7 +35,7 @@ module MultiVideoStreaming
|
|
35
35
|
required_fields_validator_instance: required_fields_validator_instance,
|
36
36
|
https_service_instance: https_service_instance
|
37
37
|
)
|
38
|
-
platform_instance.upload_video(url: url)
|
38
|
+
platform_instance.upload_video(url: url, title: title)
|
39
39
|
end
|
40
40
|
|
41
41
|
response_instance.get_all_response
|
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.1.
|
4
|
+
version: 1.0.1.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Schmeller
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- lib/multi_video_streaming/helpers.rb
|
92
92
|
- lib/multi_video_streaming/helpers/get_default_error_message.rb
|
93
93
|
- lib/multi_video_streaming/helpers/sort_files_array_by_label.rb
|
94
|
-
- lib/multi_video_streaming/helpers/title_from_url.rb
|
95
94
|
- lib/multi_video_streaming/platforms_support.rb
|
96
95
|
- lib/multi_video_streaming/protocols.rb
|
97
96
|
- lib/multi_video_streaming/protocols/https.rb
|