carrierwave-qiniu 0.0.5 → 0.0.6
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/carrierwave/storage/qiniu.rb +8 -8
- data/lib/carrierwave-qiniu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7466c24b8bbad340cb158313bce99c1649c0ccb4
|
|
4
|
+
data.tar.gz: 6d5152971794c5b28e3306ccfa01c4db5e56a46e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88bd1de7f76d7c9bf7126a0918ed63deb2211b71498841da479584877274bb202183fe73668dc93bf013e713d2b943644067bc30fad56717abae10cbb9e667ec
|
|
7
|
+
data.tar.gz: e9120ad9050bb2dd1bbfc163c1ff2e22838307b0e7ec9e575828a3b77463653df4e0377ea8bcf04399a23f190974944c371be8c2a4d313d20944d715755e10c2
|
|
@@ -25,7 +25,7 @@ module CarrierWave
|
|
|
25
25
|
@qiniu_protocal = options[:qiniu_protocal] || "http"
|
|
26
26
|
init
|
|
27
27
|
end
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
def store(file, key)
|
|
30
30
|
token_opts = {
|
|
31
31
|
:scope => @qiniu_bucket, :expires_in => 3600 # https://github.com/qiniu/ruby-sdk/pull/15
|
|
@@ -53,14 +53,14 @@ module CarrierWave
|
|
|
53
53
|
|
|
54
54
|
def get_public_url(key)
|
|
55
55
|
if @qiniu_bucket_domain and @qiniu_bucket_domain.size > 0
|
|
56
|
-
"#{@qiniu_protocal}://#{@qiniu_bucket_domain}/#{key}"
|
|
56
|
+
"#{@qiniu_protocal}://#{@qiniu_bucket_domain}/#{key}"
|
|
57
57
|
else
|
|
58
58
|
res = ::Qiniu::RS.get(@qiniu_bucket, key)
|
|
59
59
|
if res
|
|
60
60
|
res["url"]
|
|
61
61
|
else
|
|
62
62
|
nil
|
|
63
|
-
end
|
|
63
|
+
end
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -70,17 +70,17 @@ module CarrierWave
|
|
|
70
70
|
setup_publish_bucket_and_domain
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
def init_qiniu_rs_connection
|
|
73
|
+
def init_qiniu_rs_connection
|
|
74
74
|
return if @qiniu_rs_connection_inited
|
|
75
75
|
::Qiniu::RS.establish_connection! :access_key => @qiniu_access_key,
|
|
76
76
|
:secret_key => @qiniu_secret_key,
|
|
77
77
|
:block_size => @qiniu_block_size
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
@qiniu_rs_connection_inited = true
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def setup_publish_bucket_and_domain
|
|
83
|
-
::Qiniu::RS.publish(@qiniu_bucket_domain, @qiniu_bucket)
|
|
83
|
+
::Qiniu::RS.publish(@qiniu_bucket_domain, @qiniu_bucket)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
end
|
|
@@ -97,9 +97,9 @@ module CarrierWave
|
|
|
97
97
|
|
|
98
98
|
def url
|
|
99
99
|
if @uploader.qiniu_bucket_domain and @uploader.qiniu_bucket_domain.size > 0
|
|
100
|
-
"#{@uploader.qiniu_protocal}://#{@uploader.qiniu_bucket_domain}/#{@path}"
|
|
100
|
+
"#{@uploader.qiniu_protocal || 'http'}://#{@uploader.qiniu_bucket_domain}/#{@path}"
|
|
101
101
|
else
|
|
102
|
-
qiniu_connection.get_public_url(@path)
|
|
102
|
+
qiniu_connection.get_public_url(@path)
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: carrierwave-qiniu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- huobazi
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-05-
|
|
11
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: carrierwave
|