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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 348b2ef87c38baa18adc32994643d32a16ca7d1394bd5b44cd164163eb8e2646
4
- data.tar.gz: e36d6cd2d493beaea1dd58188ed252e33dd9473a9797a564a42b9326fa27ae3e
3
+ metadata.gz: 23f78ce53915c90a661addc8521d5832f9038b6e336dd46f40b58faf1989f4f7
4
+ data.tar.gz: 7a9a73d48927d790327a42795d870757d06fe34b1ae8079dd94d713350a5d830
5
5
  SHA512:
6
- metadata.gz: 0c8e24008019e8543bd391ec8eeff8d1ff2928c8b6ddf063751ce61757ed2dc5acbc1a0d5846ee70f7239b40cb64f8cab7c7e6cd85c8f43b96ab55053c68437f
7
- data.tar.gz: 1043a7284e7d81856d0f1066a029fca8003b14fd0a84fa22bbbdf9badb26e51d1e095d2e8b4f24167d6390a50836e114a4add6e68d3ac1a15144ac00960154c6
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
- raise NotImplementedError
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
- "/#{key}"
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.1
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 00:00:00.000000000 Z
11
+ date: 2018-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage