activestorage-tencent_cos 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/lib/active_storage/service/tencent_cos_service.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23f78ce53915c90a661addc8521d5832f9038b6e336dd46f40b58faf1989f4f7
|
4
|
+
data.tar.gz: 7a9a73d48927d790327a42795d870757d06fe34b1ae8079dd94d713350a5d830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 143af6bad5873afe9c8d133bc5b50734d994dc0b20519c247a394ffd0dcfbb305738030ed785fc7f9c5bd2a19d26774b4ea7e5fff0ecc10cc7e48ac20150eb82
|
7
|
+
data.tar.gz: 81ff34f1b624f213cda72d5c8dda499e5071721e84cf5f4025389f9f2082c11a4bdd91bc070680a3f6a66df5c6a7788e0e6359a6330f109e66433e829134ff73
|
data/README.md
CHANGED
@@ -7,7 +7,6 @@ It is important to note that this library is still in early stages and is curren
|
|
7
7
|
- only public read bucket is support(HTTP caching purpose)
|
8
8
|
- direct upload only
|
9
9
|
- delete variants have not yet been implemented
|
10
|
-
- download have not yet been implemented
|
11
10
|
|
12
11
|
|
13
12
|
## Usage
|
@@ -13,8 +13,17 @@ module ActiveStorage
|
|
13
13
|
raise NotImplementedError
|
14
14
|
end
|
15
15
|
|
16
|
-
def download(key)
|
17
|
-
|
16
|
+
def download(key, &block)
|
17
|
+
uri = URI(url_for(key))
|
18
|
+
if block_given?
|
19
|
+
instrument :streaming_download, key: key do
|
20
|
+
Net::HTTP.get_response(uri, &block)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
instrument :download, key: key do
|
24
|
+
Net::HTTP.get(uri)
|
25
|
+
end
|
26
|
+
end
|
18
27
|
end
|
19
28
|
|
20
29
|
def download_chunk(key, range)
|
@@ -94,7 +103,8 @@ module ActiveStorage
|
|
94
103
|
end
|
95
104
|
|
96
105
|
def path_for(key)
|
97
|
-
|
106
|
+
prefix = config.fetch(:prefix, '')
|
107
|
+
"#{prefix}/#{key}"
|
98
108
|
end
|
99
109
|
|
100
110
|
def host
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-tencent_cos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activestorage
|