activestorage-cloudinary-service 0.2.1 → 0.2.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50dae378cf0139e357b729556b67dc4c54d5145
|
4
|
+
data.tar.gz: 1abc550178e3e9d0185d6054ac6e106b93856785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '038120527a18e575f83ecd25affec02642e2a1ca9436188441dca8e835a01526bc02b0898e0a5d075c2155a670748950dc0d1027242f4db6e7022d5b29b34e00'
|
7
|
+
data.tar.gz: c56153d54fb3f1e195d828904292d3afdf0d30ee16a663979a97bb7959857dc9775422dd585442ba688513aaebf03d23503f39f489df9b1f710d5e54a071d1dd
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activestorage-cloudinary-service (0.2.
|
4
|
+
activestorage-cloudinary-service (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -112,7 +112,7 @@ DEPENDENCIES
|
|
112
112
|
cloudinary (~> 1.8.2)
|
113
113
|
pry (~> 0.11.3)
|
114
114
|
rake (~> 10.0)
|
115
|
-
rspec (~> 3.7
|
115
|
+
rspec (~> 3.7)
|
116
116
|
|
117
117
|
BUNDLED WITH
|
118
118
|
1.16.2
|
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
24
24
|
spec.add_development_dependency 'pry', '~> 0.11.3'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.7
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
27
27
|
end
|
@@ -19,7 +19,7 @@ module ActiveStorage
|
|
19
19
|
# Cloudinary.config_from_url(url)
|
20
20
|
end
|
21
21
|
|
22
|
-
def upload(key, io, checksum: nil)
|
22
|
+
def upload(key, io, checksum: nil, **)
|
23
23
|
instrument :upload, key: key, checksum: checksum do
|
24
24
|
Cloudinary::Uploader.upload(io, public_id: key, resource_type: 'auto')
|
25
25
|
end
|
@@ -6,37 +6,23 @@ module DownloadUtils
|
|
6
6
|
url = URI.parse(source)
|
7
7
|
http, req = setup_connection(url)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
#
|
13
|
-
# parts = (content_length / chunk_size.to_f).ceil
|
14
|
-
|
15
|
-
# http.start do |agent|
|
16
|
-
# parts.times do |part|
|
17
|
-
# req.range = (part * chunk_size)...((part + 1) * chunk_size)
|
18
|
-
# chunk = agent.request(req).body
|
19
|
-
# yield chunk.force_encoding(Encoding::BINARY)
|
20
|
-
# end
|
21
|
-
# end
|
9
|
+
content_length = http.request_head(url).content_length
|
10
|
+
upper_limit = content_length + (content_length % chunk_size)
|
11
|
+
offset = 0
|
22
12
|
|
23
13
|
http.start do |agent|
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
while offset < upper_limit
|
15
|
+
lim = (offset + chunk_size)
|
16
|
+
# QUESTION: is it relevant to set the last chunk
|
17
|
+
# to the exact remaining bytes
|
18
|
+
# lim = content_length if lim > content_length
|
19
|
+
req.range = (offset..lim)
|
27
20
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
# req.range = (offset..lim)
|
34
|
-
#
|
35
|
-
# chunk = agent.request(req).body
|
36
|
-
# yield chunk.force_encoding(Encoding::BINARY)
|
37
|
-
#
|
38
|
-
# offset += chunk_size + 1
|
39
|
-
# end
|
21
|
+
chunk = agent.request(req).body
|
22
|
+
yield chunk.force_encoding(Encoding::BINARY)
|
23
|
+
|
24
|
+
offset += chunk_size + 1
|
25
|
+
end
|
40
26
|
end
|
41
27
|
end
|
42
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-cloudinary-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Osmond Oscar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 3.7
|
61
|
+
version: '3.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 3.7
|
68
|
+
version: '3.7'
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- oskarromero3@gmail.com
|