resizing 1.1.0.pre → 1.2.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/resizing/client.rb +22 -8
- data/lib/resizing/version.rb +1 -1
- data/resizing.gemspec +1 -1
- data/test/resizing/client_test.rb +30 -1
- metadata +10 -16
- data/lib/resizing/video/client.rb +0 -116
- data/lib/resizing/video.rb +0 -8
- data/test/resizing/video/client_test.rb +0 -158
- data/test/vcr/video/metadata/success.yml +0 -47
- data/test/vcr/video/prepare/success.yml +0 -47
- data/test/vcr/video/upload_completed/success.yml +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f29ef7826174501bc395b977648ea813a942ef8360e47611b9bbc8f87f153f37
|
4
|
+
data.tar.gz: daa52c23493aea0ac244f99827023a44c7cd0c9b000f2fcb60493bdf7d8161f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b00781a214e9c92780912bcaf0176927caf7f86ebac96fdabf6c178128862ac60540a2c953085c645fba9eb34a9b6808ec40e05327d400c2849f48397f4cf196
|
7
|
+
data.tar.gz: 59c63f87c52c42d807f8de5897d4ff3cfdebbca4ab9be807bfe31d29de8a4ff11313f22d8209d6a324abf25ce593a17510de4cebda5894b67b4f88cace308d75
|
data/lib/resizing/client.rb
CHANGED
@@ -37,13 +37,14 @@ module Resizing
|
|
37
37
|
raise NotImplementedError
|
38
38
|
end
|
39
39
|
|
40
|
-
def post(
|
40
|
+
def post(filename_or_io, options = {})
|
41
41
|
ensure_content_type(options)
|
42
|
-
|
42
|
+
ensure_filename_or_io(filename_or_io)
|
43
|
+
filename = gather_filename filename_or_io, options
|
43
44
|
|
44
45
|
url = build_post_url
|
45
46
|
params = {
|
46
|
-
image: Faraday::Multipart::FilePart.new(
|
47
|
+
image: Faraday::Multipart::FilePart.new(filename_or_io, options[:content_type], filename)
|
47
48
|
}
|
48
49
|
|
49
50
|
response = handle_faraday_error do
|
@@ -56,13 +57,14 @@ module Resizing
|
|
56
57
|
result
|
57
58
|
end
|
58
59
|
|
59
|
-
def put(image_id,
|
60
|
+
def put(image_id, filename_or_io, options)
|
60
61
|
ensure_content_type(options)
|
61
|
-
|
62
|
+
ensure_filename_or_io(filename_or_io)
|
63
|
+
filename = gather_filename filename_or_io, options
|
62
64
|
|
63
65
|
url = build_put_url(image_id)
|
64
66
|
params = {
|
65
|
-
image: Faraday::Multipart::FilePart.new(
|
67
|
+
image: Faraday::Multipart::FilePart.new(filename_or_io, options[:content_type], filename)
|
66
68
|
}
|
67
69
|
|
68
70
|
response = handle_faraday_error do
|
@@ -111,9 +113,9 @@ module Resizing
|
|
111
113
|
"#{config.image_host}/projects/#{config.project_id}/upload/images/"
|
112
114
|
end
|
113
115
|
|
114
|
-
def gather_filename
|
116
|
+
def gather_filename(filename_or_io, options)
|
115
117
|
filename = options[:filename]
|
116
|
-
filename ||=
|
118
|
+
filename ||= filename_or_io.respond_to?(:path) ? File.basename(filename_or_io.path) : nil
|
117
119
|
end
|
118
120
|
|
119
121
|
def build_put_url(image_id)
|
@@ -132,6 +134,18 @@ module Resizing
|
|
132
134
|
raise ArgumentError, "need options[:content_type] for #{options.inspect}" unless options[:content_type]
|
133
135
|
end
|
134
136
|
|
137
|
+
def ensure_filename_or_io(filename_or_io)
|
138
|
+
return if filename_or_io.is_a?(File)
|
139
|
+
|
140
|
+
if filename_or_io.is_a?(String)
|
141
|
+
if File.exist?(filename_or_io)
|
142
|
+
return
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
raise ArgumentError, "filename_or_io must be a File object or a path to a file (#{filename_or_io.class})"
|
147
|
+
end
|
148
|
+
|
135
149
|
def handle_create_response(response)
|
136
150
|
raise APIError, "No response is returned" if response.nil?
|
137
151
|
|
data/lib/resizing/version.rb
CHANGED
data/resizing.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
spec.add_runtime_dependency 'faraday', '~> 2.3'
|
32
32
|
spec.add_runtime_dependency 'faraday-multipart'
|
33
|
-
spec.add_development_dependency 'rails', '
|
33
|
+
spec.add_development_dependency 'rails', '> 6.0'
|
34
34
|
spec.add_development_dependency 'carrierwave', '~> 2.2.5'
|
35
35
|
spec.add_development_dependency 'fog-aws'
|
36
36
|
spec.add_development_dependency 'minitest'
|
@@ -34,7 +34,36 @@ module Resizing
|
|
34
34
|
assert_equal(client.config, config)
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def test_is_postable_with_filename
|
38
|
+
Resizing.configure = @configuration_template
|
39
|
+
|
40
|
+
client = Resizing::Client.new
|
41
|
+
VCR.use_cassette 'client/post', record: :once do
|
42
|
+
r = client.post('test/data/images/sample1.jpg', content_type: 'image/jpeg')
|
43
|
+
assert_equal(r['id'], '87263920-2081-498e-a107-9625f4fde01b')
|
44
|
+
assert_equal(r['project_id'], Resizing.configure.project_id)
|
45
|
+
assert_equal(r['content_type'], 'image/jpeg')
|
46
|
+
assert(!r['latest_version_id'].nil?)
|
47
|
+
assert(!r['latest_etag'].nil?)
|
48
|
+
assert(!r['created_at'].nil?)
|
49
|
+
assert(!r['updated_at'].nil?)
|
50
|
+
assert_equal(r['public_id'], '/projects/e06e710d-f026-4dcf-b2c0-eab0de8bb83f/upload/images/87263920-2081-498e-a107-9625f4fde01b/vHg9VFvdI6HRzLFbV495VdwVmHIspLRCo')
|
51
|
+
assert_equal(r['filename'], 'sample1.jpg')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_is_unpostable_with_filename
|
56
|
+
Resizing.configure = @configuration_template
|
57
|
+
|
58
|
+
client = Resizing::Client.new
|
59
|
+
VCR.use_cassette 'client/post', record: :once do
|
60
|
+
assert_raises ArgumentError do
|
61
|
+
client.post('file_is_not_exists', content_type: 'image/jpeg')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_is_postable_with_file
|
38
67
|
Resizing.configure = @configuration_template
|
39
68
|
|
40
69
|
client = Resizing::Client.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resizing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Junichiro Kasuya
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '6.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '6.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -227,8 +227,6 @@ files:
|
|
227
227
|
- lib/resizing/mock_client.rb
|
228
228
|
- lib/resizing/public_id.rb
|
229
229
|
- lib/resizing/version.rb
|
230
|
-
- lib/resizing/video.rb
|
231
|
-
- lib/resizing/video/client.rb
|
232
230
|
- resizing.gemspec
|
233
231
|
- test/data/images/empty_file.jpg
|
234
232
|
- test/data/images/sample1.jpg
|
@@ -238,7 +236,6 @@ files:
|
|
238
236
|
- test/resizing/client_test.rb
|
239
237
|
- test/resizing/configuration_test.rb
|
240
238
|
- test/resizing/public_id_test.rb
|
241
|
-
- test/resizing/video/client_test.rb
|
242
239
|
- test/resizing_test.rb
|
243
240
|
- test/test_helper.rb
|
244
241
|
- test/vcr/carrier_wave_test/remove_resizing_picture.yml
|
@@ -248,9 +245,6 @@ files:
|
|
248
245
|
- test/vcr/client/metadata.yml
|
249
246
|
- test/vcr/client/post.yml
|
250
247
|
- test/vcr/client/put.yml
|
251
|
-
- test/vcr/video/metadata/success.yml
|
252
|
-
- test/vcr/video/prepare/success.yml
|
253
|
-
- test/vcr/video/upload_completed/success.yml
|
254
248
|
homepage: https://github.com/jksy/resizing-gem
|
255
249
|
licenses:
|
256
250
|
- MIT
|
@@ -258,7 +252,7 @@ metadata:
|
|
258
252
|
allowed_push_host: https://rubygems.org
|
259
253
|
homepage_uri: https://github.com/jksy/resizing-gem
|
260
254
|
source_code_uri: https://github.com/jksy/resizing-gem.
|
261
|
-
post_install_message:
|
255
|
+
post_install_message:
|
262
256
|
rdoc_options: []
|
263
257
|
require_paths:
|
264
258
|
- lib
|
@@ -269,12 +263,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
263
|
version: 2.3.0
|
270
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
265
|
requirements:
|
272
|
-
- - "
|
266
|
+
- - ">="
|
273
267
|
- !ruby/object:Gem::Version
|
274
|
-
version:
|
268
|
+
version: '0'
|
275
269
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
277
|
-
signing_key:
|
270
|
+
rubygems_version: 3.5.3
|
271
|
+
signing_key:
|
278
272
|
specification_version: 4
|
279
273
|
summary: Client and utilities for Resizing
|
280
274
|
test_files: []
|
@@ -1,116 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Resizing
|
4
|
-
module Video
|
5
|
-
class Client
|
6
|
-
include Resizing::Constants
|
7
|
-
include Resizing::Configurable
|
8
|
-
include Resizing::HttpClientable
|
9
|
-
|
10
|
-
def initialize(*attrs)
|
11
|
-
initialize_config(*attrs)
|
12
|
-
end
|
13
|
-
|
14
|
-
def prepare
|
15
|
-
url = build_prepare_url
|
16
|
-
|
17
|
-
response = handle_faraday_error do
|
18
|
-
http_client.post(url) do |request|
|
19
|
-
request.headers['X-ResizingToken'] = config.generate_auth_header
|
20
|
-
end
|
21
|
-
end
|
22
|
-
handle_prepare_response response
|
23
|
-
end
|
24
|
-
|
25
|
-
def upload_completed response_or_url
|
26
|
-
url = url_from response_or_url, 'upload_completed_url'
|
27
|
-
|
28
|
-
response = handle_faraday_error do
|
29
|
-
http_client.put(url) do |request|
|
30
|
-
request.headers['X-ResizingToken'] = config.generate_auth_header
|
31
|
-
end
|
32
|
-
end
|
33
|
-
handle_upload_completed_response response
|
34
|
-
end
|
35
|
-
|
36
|
-
def delete response_or_url
|
37
|
-
url = url_from response_or_url, 'destroy_url'
|
38
|
-
|
39
|
-
response = handle_faraday_error do
|
40
|
-
http_client.put(url) do |request|
|
41
|
-
request.headers['X-ResizingToken'] = config.generate_auth_header
|
42
|
-
end
|
43
|
-
end
|
44
|
-
handle_upload_completed_response response
|
45
|
-
end
|
46
|
-
|
47
|
-
def metadata response_or_url
|
48
|
-
url = url_from response_or_url, 'self_url'
|
49
|
-
|
50
|
-
response = handle_faraday_error do
|
51
|
-
http_client.get(url) do |request|
|
52
|
-
request.headers['X-ResizingToken'] = config.generate_auth_header
|
53
|
-
end
|
54
|
-
end
|
55
|
-
handle_metadata_response response
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_prepare_url
|
59
|
-
"#{config.video_host}/projects/#{config.project_id}/upload/videos/prepare"
|
60
|
-
end
|
61
|
-
|
62
|
-
private
|
63
|
-
|
64
|
-
def url_from response_or_url, name
|
65
|
-
if response_or_url.kind_of? String
|
66
|
-
response_or_url
|
67
|
-
elsif response_or_url.kind_of? Hash
|
68
|
-
response_or_url[name.to_s] || response_or_url[name.intern]
|
69
|
-
else
|
70
|
-
raise ArgumentError, "upload_completed is require Hash or String"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def handle_prepare_response response
|
76
|
-
raise APIError, "no response is returned" if response.nil?
|
77
|
-
|
78
|
-
case response.status
|
79
|
-
when HTTP_STATUS_OK, HTTP_STATUS_CREATED
|
80
|
-
JSON.parse(response.body)
|
81
|
-
else
|
82
|
-
handle_error_response response
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def handle_upload_completed_response response
|
87
|
-
raise APIError, "no response is returned" if response.nil?
|
88
|
-
|
89
|
-
case response.status
|
90
|
-
when HTTP_STATUS_OK
|
91
|
-
JSON.parse(response.body)
|
92
|
-
else
|
93
|
-
handle_error_response response
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def handle_metadata_response response
|
98
|
-
raise APIError, "no response is returned" if response.nil?
|
99
|
-
|
100
|
-
case response.status
|
101
|
-
when HTTP_STATUS_OK
|
102
|
-
JSON.parse(response.body)
|
103
|
-
else
|
104
|
-
handle_error_response response
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
def handle_error_response response
|
109
|
-
result = JSON.parse(response.body) rescue {}
|
110
|
-
err = APIError.new("invalid http status code #{response.status}")
|
111
|
-
err.decoded_body = result
|
112
|
-
raise err
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
data/lib/resizing/video.rb
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
module Resizing
|
6
|
-
module Video
|
7
|
-
class ClientTest < Minitest::Test
|
8
|
-
def setup
|
9
|
-
# TODO
|
10
|
-
# refactoring
|
11
|
-
@configuration_template = {
|
12
|
-
image_host: 'http://192.168.56.101:5000',
|
13
|
-
video_host: 'http://192.168.56.101:5000',
|
14
|
-
project_id: 'f11dfad4-2247-4220-b3b2-efeb82864a97',
|
15
|
-
secret_token: 'xn2fkkrrp2uiragliaigkx3mwnmjis6dg35sa3kya12sq133t3xjp36s7iwamp64',
|
16
|
-
open_timeout: 10,
|
17
|
-
response_timeout: 20
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
def teardown
|
22
|
-
# NOP
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_is_initialized
|
26
|
-
Resizing.configure = @configuration_template
|
27
|
-
|
28
|
-
client = Resizing::Video::Client.new
|
29
|
-
assert(!client.config.nil?)
|
30
|
-
assert_equal(client.config, Resizing.configure)
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_is_initialized_with_configuration
|
34
|
-
config = Resizing::Configuration.new(@configuration_template)
|
35
|
-
client = Resizing::Video::Client.new(config)
|
36
|
-
assert(!client.config.nil?)
|
37
|
-
assert_equal(client.config, config)
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_is_callable_build_prepare_url
|
41
|
-
Resizing.configure = @configuration_template
|
42
|
-
|
43
|
-
client = Resizing::Video::Client.new
|
44
|
-
url = client.build_prepare_url
|
45
|
-
assert_equal(url, 'http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/prepare')
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_is_callable_prepare
|
49
|
-
Resizing.configure = @configuration_template
|
50
|
-
|
51
|
-
client = Resizing::Video::Client.new
|
52
|
-
VCR.use_cassette 'video/prepare/success', record: :once do
|
53
|
-
base_url = 'http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d'
|
54
|
-
r = client.prepare
|
55
|
-
assert_equal(r['id'], '3a101d25-e03f-4fac-a4ee-dbe882c6139d')
|
56
|
-
assert_equal(r['project_id'], Resizing.configure.project_id)
|
57
|
-
assert_equal(r['state'], 'initialized')
|
58
|
-
assert_nil(r['deleted_at'])
|
59
|
-
# assert_nil(r['source_uri']) # TODO: remove
|
60
|
-
assert(r['s3_presigned_url'] != nil)
|
61
|
-
assert_nil(r['converted_uri']) # TODO:remove
|
62
|
-
assert(r['created_at'] != nil)
|
63
|
-
assert(r['updated_at'] != nil)
|
64
|
-
assert(r['upload_completed_url'], "#{base_url}/upload_completed")
|
65
|
-
assert(r['self_url'], "#{base_url}.json")
|
66
|
-
assert_nil(r['m3u8_url'])
|
67
|
-
assert_nil(r['avc_url'])
|
68
|
-
assert_nil(r['hevc_url'])
|
69
|
-
assert_includes(r['thumbnail_url'], 'now-converting')
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_is_timeout_with_prepare_method
|
74
|
-
Resizing.configure = @configuration_template.merge(project_id: 'timeout_project_id')
|
75
|
-
|
76
|
-
client = Resizing::Video::Client.new
|
77
|
-
assert_raises Resizing::APIError do
|
78
|
-
client.prepare
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_is_callable_upload_complete_with_response
|
83
|
-
Resizing.configure = @configuration_template
|
84
|
-
|
85
|
-
client = Resizing::Video::Client.new
|
86
|
-
r = nil
|
87
|
-
VCR.use_cassette 'video/prepare/success', record: :once do
|
88
|
-
r = client.prepare
|
89
|
-
end
|
90
|
-
|
91
|
-
VCR.use_cassette 'video/upload_completed/success', record: :once do
|
92
|
-
r = client.upload_completed r
|
93
|
-
assert_upload_completed_response r
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_is_callable_upload_complete_with_string
|
98
|
-
Resizing.configure = @configuration_template
|
99
|
-
|
100
|
-
client = Resizing::Video::Client.new
|
101
|
-
r = nil
|
102
|
-
VCR.use_cassette 'video/prepare/success', record: :once do
|
103
|
-
r = client.prepare
|
104
|
-
end
|
105
|
-
|
106
|
-
VCR.use_cassette 'video/upload_completed/success', record: :once do
|
107
|
-
r = client.upload_completed r['upload_completed_url']
|
108
|
-
assert_upload_completed_response r
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_is_callable_metadata_with_response
|
113
|
-
Resizing.configure = @configuration_template
|
114
|
-
|
115
|
-
client = Resizing::Video::Client.new
|
116
|
-
r = nil
|
117
|
-
VCR.use_cassette 'video/prepare/success', record: :once do
|
118
|
-
r = client.prepare
|
119
|
-
end
|
120
|
-
|
121
|
-
completed_response = nil
|
122
|
-
VCR.use_cassette 'video/upload_completed/success', record: :once do
|
123
|
-
completed_response = client.upload_completed r['upload_completed_url']
|
124
|
-
end
|
125
|
-
|
126
|
-
VCR.use_cassette 'video/metadata/success', record: :once do
|
127
|
-
r = client.metadata r
|
128
|
-
assert_equal(completed_response, r)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def assert_upload_completed_response r
|
133
|
-
base_url = 'http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d'
|
134
|
-
assert_equal(r['id'], '3a101d25-e03f-4fac-a4ee-dbe882c6139d')
|
135
|
-
assert_equal(r['project_id'], Resizing.configure.project_id)
|
136
|
-
assert_equal(r['state'], 'uploaded')
|
137
|
-
assert_nil(r['deleted_at'])
|
138
|
-
# assert(r['source_uri'] != nil) # TODO: remove
|
139
|
-
assert(r['s3_presigned_url'] != nil)
|
140
|
-
# assert_equal(r['converted_uri'], "#{base_url}/") # TODO:remove
|
141
|
-
assert(r['created_at'] != nil)
|
142
|
-
assert(r['updated_at'] != nil)
|
143
|
-
assert(r['upload_completed_url'], "#{base_url}/upload_completed")
|
144
|
-
assert(r['self_url'], "#{base_url}.json")
|
145
|
-
assert_nil(r['m3u8_url'])
|
146
|
-
assert_nil(r['avc_url'])
|
147
|
-
assert_nil(r['hevc_url'])
|
148
|
-
assert_includes(r['thumbnail_url'], 'now-converting')
|
149
|
-
assert_equal(r['job_state']['id'], 'a586d38f-bdc3-4af2-9dbc-e0c18d2d54c5')
|
150
|
-
assert_equal(r['job_state']['upload_video_id'], '3a101d25-e03f-4fac-a4ee-dbe882c6139d')
|
151
|
-
assert_equal(r['job_state']['state'], 'initialized')
|
152
|
-
assert_equal(r['job_state']['job_percent_complete'], 0)
|
153
|
-
assert(r['job_state']['created_at'] != nil)
|
154
|
-
assert(r['job_state']['updated_at'] != nil)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d.json
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.0.1
|
12
|
-
X-ResizingToken:
|
13
|
-
- v1,1611308558,a02cf32edef894208f6d1bc17cc6182783728e2b2edfdca1bf6b3109fe37a58d
|
14
|
-
response:
|
15
|
-
status:
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
x-frame-options:
|
20
|
-
- SAMEORIGIN
|
21
|
-
x-xss-protection:
|
22
|
-
- 1; mode=block
|
23
|
-
x-content-type-options:
|
24
|
-
- nosniff
|
25
|
-
x-download-options:
|
26
|
-
- noopen
|
27
|
-
x-permitted-cross-domain-policies:
|
28
|
-
- none
|
29
|
-
referrer-policy:
|
30
|
-
- strict-origin-when-cross-origin
|
31
|
-
content-type:
|
32
|
-
- application/json; charset=utf-8
|
33
|
-
etag:
|
34
|
-
- W/"f2386fd24b9a80cecab7721608aa8902"
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-request-id:
|
38
|
-
- 84895278-9508-45c0-a7dc-d1087dc68813
|
39
|
-
x-runtime:
|
40
|
-
- '0.023674'
|
41
|
-
transfer-encoding:
|
42
|
-
- chunked
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"id":"3a101d25-e03f-4fac-a4ee-dbe882c6139d","project_id":"f11dfad4-2247-4220-b3b2-efeb82864a97","state":"uploaded","source_uri":"s3://resizing-bucket-development-video/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8","deleted_at":null,"s3_presigned_url":"https://resizing-bucket-development-video.s3.ap-northeast-1.amazonaws.com/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=AKIXXXXXXXXXX%2F20210122%2Fap-northeast-1%2Fs3%2Faws4_request\u0026X-Amz-Date=20210122T094237Z\u0026X-Amz-Expires=900\u0026X-Amz-SignedHeaders=host\u0026X-Amz-Signature=c847ca1bfc20b7caeefcb999697df3cfd531aa2b7f0aa13f9066f289f693c22d","converted_uri":"s3://resizing-bucket-development-video/videos/converted/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8","created_at":"2021-01-22T09:42:37.670Z","updated_at":"2021-01-22T09:42:37.878Z","upload_completed_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d/upload_completed","self_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d.json","m3u8_url":null,"hevc_url":null,"avc_url":null,"thumbnail_url":"/assets/videos/now-converting-8a05d294385c14270a3662e01df5e50578cabcd2787123c18057ac06b101344c.png","job_state":{"id":"a586d38f-bdc3-4af2-9dbc-e0c18d2d54c5","upload_video_id":"3a101d25-e03f-4fac-a4ee-dbe882c6139d","state":"initialized","job_percent_complete":0,"created_at":"2021-01-22T09:42:38.501Z","updated_at":"2021-01-22T09:42:38.501Z"}}'
|
46
|
-
recorded_at: Fri, 22 Jan 2021 09:42:38 GMT
|
47
|
-
recorded_with: VCR 6.0.0
|
@@ -1,47 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/prepare
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.0.1
|
12
|
-
X-ResizingToken:
|
13
|
-
- v1,1611308557,6628235db472f228a7c3c6b309e081b6c32aac01890abbfd2f38230ff4105c1c
|
14
|
-
response:
|
15
|
-
status:
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
x-frame-options:
|
20
|
-
- SAMEORIGIN
|
21
|
-
x-xss-protection:
|
22
|
-
- 1; mode=block
|
23
|
-
x-content-type-options:
|
24
|
-
- nosniff
|
25
|
-
x-download-options:
|
26
|
-
- noopen
|
27
|
-
x-permitted-cross-domain-policies:
|
28
|
-
- none
|
29
|
-
referrer-policy:
|
30
|
-
- strict-origin-when-cross-origin
|
31
|
-
content-type:
|
32
|
-
- application/json; charset=utf-8
|
33
|
-
etag:
|
34
|
-
- W/"273d4e663c17e06deb0c69cc90bb79b6"
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-request-id:
|
38
|
-
- e586873a-9cc9-45a0-a216-5e62165cb9f1
|
39
|
-
x-runtime:
|
40
|
-
- '0.046932'
|
41
|
-
transfer-encoding:
|
42
|
-
- chunked
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"id":"3a101d25-e03f-4fac-a4ee-dbe882c6139d","project_id":"f11dfad4-2247-4220-b3b2-efeb82864a97","state":"initialized","source_uri":"s3://resizing-bucket-development-video/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8","deleted_at":null,"s3_presigned_url":"https://resizing-bucket-development-video.s3.ap-northeast-1.amazonaws.com/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=AKIXXXXXXXXXXXXXX%2F20210122%2Fap-northeast-1%2Fs3%2Faws4_request\u0026X-Amz-Date=20210122T094237Z\u0026X-Amz-Expires=900\u0026X-Amz-SignedHeaders=host\u0026X-Amz-Signature=c847ca1bfc20b7caeefcb999697df3cfd531aa2b7f0aa13f9066f289f693c22d","converted_uri":null,"created_at":"2021-01-22T09:42:37.670Z","updated_at":"2021-01-22T09:42:37.670Z","upload_completed_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d/upload_completed","self_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d.json","m3u8_url":null,"hevc_url":null,"avc_url":null,"thumbnail_url":"/assets/videos/now-converting-8a05d294385c14270a3662e01df5e50578cabcd2787123c18057ac06b101344c.png","job_state":null}'
|
46
|
-
recorded_at: Fri, 22 Jan 2021 09:42:37 GMT
|
47
|
-
recorded_with: VCR 6.0.0
|
@@ -1,47 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: put
|
5
|
-
uri: http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d/upload_completed
|
6
|
-
body:
|
7
|
-
encoding: US-ASCII
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- Faraday v1.0.1
|
12
|
-
X-ResizingToken:
|
13
|
-
- v1,1611308557,6628235db472f228a7c3c6b309e081b6c32aac01890abbfd2f38230ff4105c1c
|
14
|
-
response:
|
15
|
-
status:
|
16
|
-
code: 200
|
17
|
-
message: OK
|
18
|
-
headers:
|
19
|
-
x-frame-options:
|
20
|
-
- SAMEORIGIN
|
21
|
-
x-xss-protection:
|
22
|
-
- 1; mode=block
|
23
|
-
x-content-type-options:
|
24
|
-
- nosniff
|
25
|
-
x-download-options:
|
26
|
-
- noopen
|
27
|
-
x-permitted-cross-domain-policies:
|
28
|
-
- none
|
29
|
-
referrer-policy:
|
30
|
-
- strict-origin-when-cross-origin
|
31
|
-
content-type:
|
32
|
-
- application/json; charset=utf-8
|
33
|
-
etag:
|
34
|
-
- W/"f7ce780fcb3afdb5077ccfee0564b182"
|
35
|
-
cache-control:
|
36
|
-
- max-age=0, private, must-revalidate
|
37
|
-
x-request-id:
|
38
|
-
- 8a79b573-8db2-474c-a994-9e1ff59bc6c1
|
39
|
-
x-runtime:
|
40
|
-
- '0.830313'
|
41
|
-
transfer-encoding:
|
42
|
-
- chunked
|
43
|
-
body:
|
44
|
-
encoding: UTF-8
|
45
|
-
string: '{"project_id":"f11dfad4-2247-4220-b3b2-efeb82864a97","id":"3a101d25-e03f-4fac-a4ee-dbe882c6139d","state":"uploaded","source_uri":"s3://resizing-bucket-development-video/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8","deleted_at":null,"s3_presigned_url":"https://resizing-bucket-development-video.s3.ap-northeast-1.amazonaws.com/videos/uploading/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8?X-Amz-Algorithm=AWS4-HMAC-SHA256\u0026X-Amz-Credential=AKIXXXXXXXXXX%2F20210122%2Fap-northeast-1%2Fs3%2Faws4_request\u0026X-Amz-Date=20210122T094237Z\u0026X-Amz-Expires=900\u0026X-Amz-SignedHeaders=host\u0026X-Amz-Signature=c847ca1bfc20b7caeefcb999697df3cfd531aa2b7f0aa13f9066f289f693c22d","converted_uri":"s3://resizing-bucket-development-video/videos/converted/f11dfad4-2247-4220-b3b2-efeb82864a97/3a101d25-e03f-4fac-a4ee-dbe882c6139d/1dc40aae-29ab-4369-87da-10b146371fb8","created_at":"2021-01-22T09:42:37.670Z","updated_at":"2021-01-22T09:42:37.878Z","upload_completed_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d/upload_completed","self_url":"http://192.168.56.101:5000/projects/f11dfad4-2247-4220-b3b2-efeb82864a97/upload/videos/3a101d25-e03f-4fac-a4ee-dbe882c6139d.json","m3u8_url":null,"hevc_url":null,"avc_url":null,"thumbnail_url":"/assets/videos/now-converting-8a05d294385c14270a3662e01df5e50578cabcd2787123c18057ac06b101344c.png","job_state":{"id":"a586d38f-bdc3-4af2-9dbc-e0c18d2d54c5","upload_video_id":"3a101d25-e03f-4fac-a4ee-dbe882c6139d","state":"initialized","job_percent_complete":0,"created_at":"2021-01-22T09:42:38.501Z","updated_at":"2021-01-22T09:42:38.501Z"}}'
|
46
|
-
recorded_at: Fri, 22 Jan 2021 09:42:38 GMT
|
47
|
-
recorded_with: VCR 6.0.0
|