activestorage-cloudinary-service 0.2.0 → 0.2.1

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: 2ed3e755146252107a2682fbd64e330be4ad5da2
4
- data.tar.gz: dd6ea8202085b611a75cf588c3acd499a632975b
3
+ metadata.gz: 8dabc2d19ae96fc59d1da3098a2c57bde025d181
4
+ data.tar.gz: 22502fdb687f935395f06e98237daa1ca2c98ed9
5
5
  SHA512:
6
- metadata.gz: 9b82f66786e2c685b88b4470a536b8a4d1d97578b61eb0f973a6508b44fb7bce0a406555456a806dc6cbd4791f7ff217f0cbe1a746b5670d323db13f69901c67
7
- data.tar.gz: 2fc0f43b8c67469a7b658bf8ec9b9b5d8a5759f29de7b906ddde69fb23f294b4acf35734dabce0e5e71fd80d256ed05ac78eefb8bab7b577413b1f280e9c9ade
6
+ metadata.gz: f8bc1c8c87d28083ede0fd36330c0c38b296e2cfc7e47faecccf91e3d04c066195d8c5f2158bf7343d91c1c0283c5cb91f0176e62e58e23968e2c424539c7942
7
+ data.tar.gz: d7479eb0533d704fb94b91a15d0cca6db0194479a40fec5bdcc7022856c92c45a2db104de37890c9460e37717704f086a00245df2a30312d90dab032ee62f03d
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in active_storage-cloudinary_service.gemspec
6
6
  gemspec
7
7
 
8
- gem 'activestorage', '~> 5.2.0', require: false
8
+ gem 'activestorage', '~> 5.2.1.1', require: false
9
9
  gem 'cloudinary', '~> 1.8.2', require: false
@@ -6,30 +6,30 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actionpack (5.2.0)
10
- actionview (= 5.2.0)
11
- activesupport (= 5.2.0)
9
+ actionpack (5.2.1.1)
10
+ actionview (= 5.2.1.1)
11
+ activesupport (= 5.2.1.1)
12
12
  rack (~> 2.0)
13
13
  rack-test (>= 0.6.3)
14
14
  rails-dom-testing (~> 2.0)
15
15
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
16
- actionview (5.2.0)
17
- activesupport (= 5.2.0)
16
+ actionview (5.2.1.1)
17
+ activesupport (= 5.2.1.1)
18
18
  builder (~> 3.1)
19
19
  erubi (~> 1.4)
20
20
  rails-dom-testing (~> 2.0)
21
21
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
22
- activemodel (5.2.0)
23
- activesupport (= 5.2.0)
24
- activerecord (5.2.0)
25
- activemodel (= 5.2.0)
26
- activesupport (= 5.2.0)
22
+ activemodel (5.2.1.1)
23
+ activesupport (= 5.2.1.1)
24
+ activerecord (5.2.1.1)
25
+ activemodel (= 5.2.1.1)
26
+ activesupport (= 5.2.1.1)
27
27
  arel (>= 9.0)
28
- activestorage (5.2.0)
29
- actionpack (= 5.2.0)
30
- activerecord (= 5.2.0)
28
+ activestorage (5.2.1.1)
29
+ actionpack (= 5.2.1.1)
30
+ activerecord (= 5.2.1.1)
31
31
  marcel (~> 0.3.1)
32
- activesupport (5.2.0)
32
+ activesupport (5.2.1.1)
33
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
34
  i18n (>= 0.7, < 2)
35
35
  minitest (~> 5.1)
@@ -41,7 +41,7 @@ GEM
41
41
  aws_cf_signer
42
42
  rest-client
43
43
  coderay (1.1.2)
44
- concurrent-ruby (1.0.5)
44
+ concurrent-ruby (1.1.3)
45
45
  crass (1.0.4)
46
46
  diff-lcs (1.3)
47
47
  domain_name (0.5.20170404)
@@ -49,12 +49,12 @@ GEM
49
49
  erubi (1.7.1)
50
50
  http-cookie (1.0.3)
51
51
  domain_name (~> 0.5)
52
- i18n (1.0.1)
52
+ i18n (1.2.0)
53
53
  concurrent-ruby (~> 1.0)
54
- loofah (2.2.2)
54
+ loofah (2.2.3)
55
55
  crass (~> 1.0.2)
56
56
  nokogiri (>= 1.5.9)
57
- marcel (0.3.2)
57
+ marcel (0.3.3)
58
58
  mimemagic (~> 0.3.2)
59
59
  method_source (0.9.0)
60
60
  mime-types (3.1)
@@ -64,12 +64,12 @@ GEM
64
64
  mini_portile2 (2.3.0)
65
65
  minitest (5.11.3)
66
66
  netrc (0.11.0)
67
- nokogiri (1.8.4)
67
+ nokogiri (1.8.5)
68
68
  mini_portile2 (~> 2.3.0)
69
69
  pry (0.11.3)
70
70
  coderay (~> 1.1.0)
71
71
  method_source (~> 0.9.0)
72
- rack (2.0.5)
72
+ rack (2.0.6)
73
73
  rack-test (1.1.0)
74
74
  rack (>= 1.0, < 3)
75
75
  rails-dom-testing (2.0.3)
@@ -106,7 +106,7 @@ PLATFORMS
106
106
  ruby
107
107
 
108
108
  DEPENDENCIES
109
- activestorage (~> 5.2.0)
109
+ activestorage (~> 5.2.1.1)
110
110
  activestorage-cloudinary-service!
111
111
  bundler (~> 1.16)
112
112
  cloudinary (~> 1.8.2)
@@ -6,23 +6,37 @@ module DownloadUtils
6
6
  url = URI.parse(source)
7
7
  http, req = setup_connection(url)
8
8
 
9
- content_length = http.request_head(url).content_length
10
- upper_limit = content_length + (content_length % chunk_size)
11
- offset = 0
9
+ # content_length = http.request_head(url).content_length
10
+ # upper_limit = content_length + (content_length % chunk_size)
11
+ # offset = 0
12
+ #
13
+ # parts = (content_length / chunk_size.to_f).ceil
12
14
 
13
- http.start do |agent|
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)
20
-
21
- chunk = agent.request(req).body
22
- yield chunk.force_encoding(Encoding::BINARY)
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
23
22
 
24
- offset += chunk_size + 1
23
+ http.start do |agent|
24
+ agent.request(req) do |resp|
25
+ resp.read_body { |chunk| yield chunk.force_encoding(Encoding::BINARY) }
25
26
  end
27
+
28
+ # while offset < upper_limit
29
+ # lim = (offset + chunk_size)
30
+ # # QUESTION: is it relevant to set the last chunk
31
+ # # to the exact remaining bytes
32
+ # # lim = content_length if lim > content_length
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
26
40
  end
27
41
  end
28
42
 
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module CloudinaryService
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
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.0
4
+ version: 0.2.1
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-07-30 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler