qiniu 6.8.1 → 6.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +2 -1
- data/lib/qiniu.rb +27 -37
- data/lib/qiniu/auth.rb +5 -12
- data/lib/qiniu/config.rb +67 -28
- data/lib/qiniu/host_manager.rb +1 -1
- data/lib/qiniu/management.rb +6 -13
- data/lib/qiniu/pfop.rb +4 -7
- data/lib/qiniu/tokens/access_token.rb +3 -4
- data/lib/qiniu/utils.rb +0 -1
- data/lib/qiniu/version.rb +2 -2
- data/spec/qiniu/auth_spec.rb +7 -13
- data/spec/qiniu/image_spec.rb +31 -35
- data/spec/qiniu/management_spec.rb +1 -17
- data/spec/qiniu/pfop_spec.rb +6 -6
- data/spec/qiniu/qiniu_spec.rb +44 -70
- data/spec/qiniu/upload_spec.rb +32 -0
- data/spec/qiniu/utils_spec.rb +9 -13
- data/spec/spec_helper.rb +1 -0
- metadata +14 -91
- data/.gitignore +0 -20
- data/.rspec +0 -1
- data/.travis.yml +0 -19
- data/Gemfile +0 -8
- data/Rakefile +0 -21
- data/docs/README.md +0 -790
- data/examples/copy.rb +0 -25
- data/examples/delete.rb +0 -20
- data/examples/download.rb +0 -11
- data/examples/fetch.rb +0 -25
- data/examples/fops.rb +0 -36
- data/examples/list.rb +0 -21
- data/examples/move.rb +0 -26
- data/examples/pfop_vframe.rb +0 -36
- data/examples/pfop_watermark.rb +0 -38
- data/examples/stat.rb +0 -19
- data/examples/upload.rb +0 -38
- data/examples/upload_callback.rb +0 -41
- data/examples/upload_pfops.rb +0 -47
- data/qiniu.gemspec +0 -29
- data/rails3/Gemfile +0 -4
- data/rails3/qiniu.gemspec +0 -29
- data/spec/qiniu/image_logo_for_test.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 306d8a843360b13bd622e22467add2b392657a78
|
4
|
+
data.tar.gz: 5e15d490efd048e1f3f8b00c04658cf29d00e46d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9937b7d424f62640fcdf7b2cd84648799c41c4e6d739f79df01f3bd94fc83f6a30ecd22fdca8602437e2c854b49459e607421057597b1d28893ba2adbe6bf83
|
7
|
+
data.tar.gz: fdc93590e8b774bc5ea732171189555daad50b6d4023e809a6e585b36b32a51959feeb17c33c3d0080bb827034c1f762c0f3e4ae97d896c68c8d2ed328c48732
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
## CHANGE LOG
|
2
2
|
|
3
|
+
### v6.9.0
|
4
|
+
|
5
|
+
- 增加 `Qiniu.establish_https_connection!` 方法,使所有七牛请求都使用 HTTPS 协议,保证连接的安全性。
|
6
|
+
|
7
|
+
- 重构随 gem 附带的 example 中的代码,使用更简洁易用的 API。
|
8
|
+
|
9
|
+
- 移除 `Qiniu::Config::DEFAULT_OPTIONS`,用户可以调用 `Qiniu::Config.settings` 获取七牛配置。
|
10
|
+
|
11
|
+
- 移除 `Qiniu.get`,`Qiniu.download` 和 `Qiniu::Storage.get` 方法以及它们的 `batch` 版本。
|
12
|
+
|
13
|
+
- 移除对于 Fixnum 的使用,支持 Ruby 2.4.x
|
14
|
+
|
3
15
|
### v6.8.1
|
4
16
|
|
5
17
|
- 增加delafterdays 策略。[https://github.com/qiniu/ruby-sdk/pull/162](https://github.com/qiniu/ruby-sdk/pull/162)
|
data/README.md
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
* Ruby 2.1.x
|
10
10
|
* Ruby 2.2.x
|
11
11
|
* Ruby 2.3.x
|
12
|
+
* Ruby 2.4.x
|
12
13
|
* JRuby 9.x
|
13
14
|
|
14
15
|
如果您的应用程序需要在 Ruby 1.9、2.0 或 JRuby 1.7 上运行,请使用此 Ruby SDK 的 6.6.0 版本。
|
@@ -24,7 +25,7 @@
|
|
24
25
|
|
25
26
|
在您 Ruby 应用程序的 `Gemfile` 文件中,添加如下一行代码:
|
26
27
|
|
27
|
-
gem 'qiniu', '>= 6.
|
28
|
+
gem 'qiniu', '>= 6.9.0'
|
28
29
|
|
29
30
|
然后,在应用程序所在的目录下,可以运行 `bundle` 安装依赖包:
|
30
31
|
|
data/lib/qiniu.rb
CHANGED
@@ -3,20 +3,21 @@
|
|
3
3
|
require 'qiniu/exceptions'
|
4
4
|
|
5
5
|
module Qiniu
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
require_relative 'qiniu/version'
|
7
|
+
require_relative 'qiniu/utils'
|
8
|
+
require_relative 'qiniu/auth'
|
9
|
+
require_relative 'qiniu/config'
|
10
|
+
require_relative 'qiniu/log'
|
11
|
+
require_relative 'qiniu/tokens/access_token'
|
12
|
+
require_relative 'qiniu/tokens/qbox_token'
|
13
|
+
require_relative 'qiniu/tokens/upload_token'
|
14
|
+
require_relative 'qiniu/tokens/download_token'
|
15
|
+
require_relative 'qiniu/abstract'
|
16
|
+
require_relative 'qiniu/storage'
|
17
|
+
require_relative 'qiniu/fop'
|
18
|
+
require_relative 'qiniu/misc'
|
19
|
+
require_relative 'qiniu/host_manager'
|
20
|
+
require_relative 'qiniu/http'
|
20
21
|
|
21
22
|
class << self
|
22
23
|
|
@@ -26,6 +27,18 @@ module Qiniu
|
|
26
27
|
Config.initialize_connect opts
|
27
28
|
end
|
28
29
|
|
30
|
+
def establish_https_connection!(opts = {})
|
31
|
+
Config.initialize_connect_https opts
|
32
|
+
end
|
33
|
+
|
34
|
+
def switch_to_http!
|
35
|
+
Config.switch_to_http
|
36
|
+
end
|
37
|
+
|
38
|
+
def switch_to_https!
|
39
|
+
Config.switch_to_https
|
40
|
+
end
|
41
|
+
|
29
42
|
def mkbucket(bucket_name)
|
30
43
|
code, data = Storage.mkbucket(bucket_name)
|
31
44
|
code == StatusOK
|
@@ -94,16 +107,6 @@ module Qiniu
|
|
94
107
|
code == StatusOK ? data : false
|
95
108
|
end
|
96
109
|
|
97
|
-
def get(bucket, key, save_as = nil, expires_in = nil, version = nil)
|
98
|
-
code, data = Storage.get(bucket, key, save_as, expires_in, version)
|
99
|
-
code == StatusOK ? data : false
|
100
|
-
end
|
101
|
-
|
102
|
-
def download(bucket, key, save_as = nil, expires_in = nil, version = nil)
|
103
|
-
code, data = Storage.get(bucket, key, save_as, expires_in, version)
|
104
|
-
code == StatusOK ? data["url"] : false
|
105
|
-
end
|
106
|
-
|
107
110
|
def copy(source_bucket, source_key, target_bucket, target_key)
|
108
111
|
code, data = Storage.copy(source_bucket, source_key, target_bucket, target_key)
|
109
112
|
code == StatusOK
|
@@ -134,11 +137,6 @@ module Qiniu
|
|
134
137
|
code == StatusOK ? data : false
|
135
138
|
end
|
136
139
|
|
137
|
-
def batch_get(bucket, keys)
|
138
|
-
code, data = Storage.batch_get(bucket, keys)
|
139
|
-
code == StatusOK ? data : false
|
140
|
-
end
|
141
|
-
|
142
140
|
def batch_copy(*args)
|
143
141
|
code, data = Storage.batch_copy(args)
|
144
142
|
code == StatusOK
|
@@ -149,14 +147,6 @@ module Qiniu
|
|
149
147
|
code == StatusOK
|
150
148
|
end
|
151
149
|
|
152
|
-
def batch_download(bucket, keys)
|
153
|
-
code, data = Storage.batch_get(bucket, keys)
|
154
|
-
return false unless code == StatusOK
|
155
|
-
links = []
|
156
|
-
data.each { |e| links << e["data"]["url"] }
|
157
|
-
links
|
158
|
-
end
|
159
|
-
|
160
150
|
def batch_delete(bucket, keys)
|
161
151
|
code, data = Storage.batch_delete(bucket, keys)
|
162
152
|
code == StatusOK ? data : false
|
data/lib/qiniu/auth.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# vim: sw=2 ts=2
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'openssl'
|
5
5
|
require 'uri'
|
6
6
|
require 'cgi'
|
7
7
|
|
@@ -27,15 +27,8 @@ module Qiniu
|
|
27
27
|
end # calculate_deadline
|
28
28
|
|
29
29
|
def calculate_hmac_sha1_digest(sk, str)
|
30
|
-
|
31
|
-
|
32
|
-
rescue RuntimeError => e
|
33
|
-
raise RuntimeError, "Please set Qiniu's access_key and secret_key before authorize any tokens."
|
34
|
-
rescue
|
35
|
-
raise
|
36
|
-
else
|
37
|
-
return sign
|
38
|
-
end
|
30
|
+
raise ArgumentError, "Please set Qiniu's access_key and secret_key before authorize any tokens." if sk.nil?
|
31
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), sk, str)
|
39
32
|
end
|
40
33
|
end # class << self
|
41
34
|
|
@@ -171,7 +164,7 @@ module Qiniu
|
|
171
164
|
|
172
165
|
### URL变换:追加FOP指令
|
173
166
|
if args[:fop].is_a?(String) && args[:fop] != '' then
|
174
|
-
if download_url.
|
167
|
+
if download_url.include?('?')
|
175
168
|
# 已有参数
|
176
169
|
download_url = "#{download_url}&#{args[:fop]}"
|
177
170
|
else
|
@@ -184,7 +177,7 @@ module Qiniu
|
|
184
177
|
e = Auth.calculate_deadline(args[:expires_in], args[:deadline])
|
185
178
|
|
186
179
|
### URL变换:追加授权期参数
|
187
|
-
if download_url.
|
180
|
+
if download_url.include?('?')
|
188
181
|
# 已有参数
|
189
182
|
download_url = "#{download_url}&e=#{e}"
|
190
183
|
else
|
data/lib/qiniu/config.rb
CHANGED
@@ -13,32 +13,6 @@ require 'tmpdir'
|
|
13
13
|
module Qiniu
|
14
14
|
module Config
|
15
15
|
class << self
|
16
|
-
|
17
|
-
DEFAULT_OPTIONS = {
|
18
|
-
:user_agent => 'QiniuRuby/' + Version.to_s + ' ('+RUBY_PLATFORM+')' + ' Ruby/'+ RUBY_VERSION,
|
19
|
-
:method => :post,
|
20
|
-
:content_type => 'application/x-www-form-urlencoded',
|
21
|
-
:auth_url => "https://acc.qbox.me/oauth2/token",
|
22
|
-
:rs_host => "http://rs.qiniu.com",
|
23
|
-
:fetch_host => nil,
|
24
|
-
:rsf_host => "http://rsf.qbox.me",
|
25
|
-
:up_host => nil,
|
26
|
-
:pub_host => "http://pu.qbox.me:10200",
|
27
|
-
:eu_host => "http://eu.qbox.me",
|
28
|
-
:uc_host => "http://uc.qbox.me",
|
29
|
-
:access_key => "",
|
30
|
-
:secret_key => "",
|
31
|
-
:auto_reconnect => true,
|
32
|
-
:max_retry_times => 3,
|
33
|
-
:block_size => 1024*1024*4,
|
34
|
-
:chunk_size => 1024*256,
|
35
|
-
:enable_debug => true,
|
36
|
-
:tmpdir => Dir.tmpdir + File::SEPARATOR + 'QiniuRuby',
|
37
|
-
:multi_region => true
|
38
|
-
}
|
39
|
-
|
40
|
-
REQUIRED_OPTION_KEYS = [:access_key, :secret_key]
|
41
|
-
|
42
16
|
attr_reader :settings, :default_params, :host_manager
|
43
17
|
|
44
18
|
def load config_file
|
@@ -52,14 +26,31 @@ module Qiniu
|
|
52
26
|
end
|
53
27
|
|
54
28
|
def initialize_connect options = {}
|
55
|
-
|
56
|
-
|
29
|
+
options = if options[:protocol] == :https
|
30
|
+
https_options.merge(options)
|
31
|
+
else
|
32
|
+
http_options.merge(options)
|
33
|
+
end
|
34
|
+
@settings = default_options.merge(options)
|
35
|
+
required_options_keys.each do |opt|
|
57
36
|
raise MissingArgsError, [opt] unless @settings.has_key?(opt)
|
58
37
|
end
|
59
38
|
@host_manager = HostManager.new(@settings)
|
60
39
|
nil
|
61
40
|
end
|
62
41
|
|
42
|
+
def initialize_connect_https options = {}
|
43
|
+
initialize_connect(options.merge(:protocol => :https))
|
44
|
+
end
|
45
|
+
|
46
|
+
def switch_to_http
|
47
|
+
@settings.merge!(http_options)
|
48
|
+
end
|
49
|
+
|
50
|
+
def switch_to_https
|
51
|
+
@settings.merge!(https_options)
|
52
|
+
end
|
53
|
+
|
63
54
|
def up_host(bucket, opts = {})
|
64
55
|
@settings[:up_host] || @host_manager.up_host(bucket, opts)
|
65
56
|
end
|
@@ -67,6 +58,54 @@ module Qiniu
|
|
67
58
|
def fetch_host(bucket, opts = {})
|
68
59
|
@settings[:fetch_host] || @host_manager.fetch_host(bucket, opts)
|
69
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def default_options
|
65
|
+
{
|
66
|
+
:user_agent => 'QiniuRuby/' + Version.to_s + ' ('+RUBY_PLATFORM+')' + ' Ruby/'+ RUBY_VERSION,
|
67
|
+
:method => :post,
|
68
|
+
:content_type => 'application/x-www-form-urlencoded',
|
69
|
+
:auth_url => "https://acc.qbox.me/oauth2/token",
|
70
|
+
:access_key => "",
|
71
|
+
:secret_key => "",
|
72
|
+
:auto_reconnect => true,
|
73
|
+
:max_retry_times => 3,
|
74
|
+
:block_size => 1024*1024*4,
|
75
|
+
:chunk_size => 1024*256,
|
76
|
+
:enable_debug => true,
|
77
|
+
:tmpdir => Dir.tmpdir + File::SEPARATOR + 'QiniuRuby',
|
78
|
+
:multi_region => true
|
79
|
+
}.freeze
|
80
|
+
end
|
81
|
+
|
82
|
+
def http_options
|
83
|
+
{
|
84
|
+
:rs_host => "http://rs.qiniu.com",
|
85
|
+
:rsf_host => "http://rsf.qbox.me",
|
86
|
+
:pub_host => "http://pu.qbox.me:10200",
|
87
|
+
:eu_host => "http://eu.qbox.me",
|
88
|
+
:uc_host => "http://uc.qbox.me",
|
89
|
+
:api_host => "http://api.qiniu.com",
|
90
|
+
:protocol => :http
|
91
|
+
}.freeze
|
92
|
+
end
|
93
|
+
|
94
|
+
def https_options
|
95
|
+
{
|
96
|
+
:rs_host => "https://rs.qbox.me",
|
97
|
+
:rsf_host => "https://rsf.qbox.me",
|
98
|
+
:pub_host => "https://pu.qbox.me",
|
99
|
+
:eu_host => "https://eu.qbox.me",
|
100
|
+
:uc_host => "https://uc.qbox.me",
|
101
|
+
:api_host => "https://api.qiniu.com",
|
102
|
+
:protocol => :https
|
103
|
+
}.freeze
|
104
|
+
end
|
105
|
+
|
106
|
+
def required_options_keys
|
107
|
+
[:access_key, :secret_key].freeze
|
108
|
+
end
|
70
109
|
end
|
71
110
|
end # module Config
|
72
111
|
end # module Qiniu
|
data/lib/qiniu/host_manager.rb
CHANGED
data/lib/qiniu/management.rb
CHANGED
@@ -57,14 +57,6 @@ module Qiniu
|
|
57
57
|
return HTTP.management_post(url)
|
58
58
|
end # stat
|
59
59
|
|
60
|
-
def get(bucket, key, save_as = nil, expires_in = nil, version = nil)
|
61
|
-
url = Config.settings[:rs_host] + '/get/' + encode_entry_uri(bucket, key)
|
62
|
-
url += '/base/' + version unless version.nil?
|
63
|
-
url += '/attName/' + Utils.urlsafe_base64_encode(save_as) unless save_as.nil?
|
64
|
-
url += '/expires/' + expires_in.to_s if !expires_in.nil? && expires_in > 0
|
65
|
-
return HTTP.management_post(url)
|
66
|
-
end # get
|
67
|
-
|
68
60
|
def copy(source_bucket, source_key, target_bucket, target_key)
|
69
61
|
uri = _generate_cp_or_mv_opstr('copy', source_bucket, source_key, target_bucket, target_key)
|
70
62
|
url = Config.settings[:rs_host] + uri
|
@@ -97,16 +89,12 @@ module Qiniu
|
|
97
89
|
return HTTP.management_post(url, execs.join("&"))
|
98
90
|
end # batch
|
99
91
|
|
100
|
-
def batch_get(bucket, keys)
|
101
|
-
batch("get", bucket, keys)
|
102
|
-
end # batch_get
|
103
|
-
|
104
92
|
def batch_stat(bucket, keys)
|
105
93
|
batch("stat", bucket, keys)
|
106
94
|
end # batch_stat
|
107
95
|
|
108
96
|
def batch_copy(*args)
|
109
|
-
_batch_cp_or_mv('copy', args)
|
97
|
+
_batch_cp_or_mv('copy', *args)
|
110
98
|
end # batch_copy
|
111
99
|
|
112
100
|
def batch_move(*args)
|
@@ -149,6 +137,11 @@ module Qiniu
|
|
149
137
|
return resp_code, resp_body, resp_headers, has_more, new_list_policy
|
150
138
|
end # list
|
151
139
|
|
140
|
+
def domains(bucket)
|
141
|
+
url = Config.settings[:api_host] + '/v7/domain/list?tbl=' + bucket
|
142
|
+
return HTTP.management_post(url)
|
143
|
+
end
|
144
|
+
|
152
145
|
private
|
153
146
|
|
154
147
|
def _generate_cp_or_mv_opstr(command, source_bucket, source_key, target_bucket, target_key)
|
data/lib/qiniu/pfop.rb
CHANGED
@@ -72,11 +72,8 @@ module Qiniu
|
|
72
72
|
|
73
73
|
class << self
|
74
74
|
|
75
|
-
API_HOST = 'http://api.qiniu.com'
|
76
|
-
|
77
|
-
PFOP_URL = API_HOST + '/pfop/'
|
78
|
-
|
79
75
|
def pfop (args)
|
76
|
+
pfop_url = Config.settings[:api_host] + '/pfop/'
|
80
77
|
### 生成fop指令串
|
81
78
|
if args.is_a?(PfopPolicy) then
|
82
79
|
# PfopPolicy的各个字段按固定顺序组织
|
@@ -90,12 +87,12 @@ module Qiniu
|
|
90
87
|
end
|
91
88
|
|
92
89
|
### 发送请求
|
93
|
-
return HTTP.management_post(
|
90
|
+
return HTTP.management_post(pfop_url, body)
|
94
91
|
end # pfop
|
95
92
|
|
96
|
-
PREFOP_URL = API_HOST + '/status/get/prefop?id='
|
97
93
|
|
98
94
|
def prefop (persistent_id)
|
95
|
+
prefop_url = Config.settings[:api_host] + '/status/get/prefop?id='
|
99
96
|
### 抽取persistentId
|
100
97
|
if persistent_id.is_a?(Hash) then
|
101
98
|
pid = persistent_id['persistentId']
|
@@ -104,7 +101,7 @@ module Qiniu
|
|
104
101
|
end
|
105
102
|
|
106
103
|
### 发送请求
|
107
|
-
url =
|
104
|
+
url = prefop_url + pid
|
108
105
|
return HTTP.api_get(url)
|
109
106
|
end # prefop
|
110
107
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'openssl'
|
4
4
|
require 'qiniu/config'
|
5
5
|
require 'qiniu/utils'
|
6
6
|
|
@@ -14,9 +14,8 @@ module Qiniu
|
|
14
14
|
attr_accessor :access_key, :secret_key
|
15
15
|
|
16
16
|
def generate_encoded_digest(signature)
|
17
|
-
|
18
|
-
|
19
|
-
urlsafe_base64_encode(hmac.digest)
|
17
|
+
raw_hmac_digest = OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), @secret_key, signature)
|
18
|
+
urlsafe_base64_encode(raw_hmac_digest)
|
20
19
|
end
|
21
20
|
|
22
21
|
end # AccessToken
|
data/lib/qiniu/utils.rb
CHANGED
data/lib/qiniu/version.rb
CHANGED
data/spec/qiniu/auth_spec.rb
CHANGED
@@ -39,11 +39,10 @@ module Qiniu
|
|
39
39
|
puts raw_headers.inspect
|
40
40
|
|
41
41
|
### 获取下载地址
|
42
|
-
code,
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
url = data['url']
|
42
|
+
code, domains, = Qiniu::Storage.domains(@bucket)
|
43
|
+
domains.should_not be_empty
|
44
|
+
domain = domains.first['domain']
|
45
|
+
url = "http://#{domain}/#{key}"
|
47
46
|
|
48
47
|
### 授权下载地址(不带参数)
|
49
48
|
download_url = Qiniu::Auth.authorize_download_url(url)
|
@@ -54,12 +53,7 @@ module Qiniu
|
|
54
53
|
result.body.should_not be_empty
|
55
54
|
|
56
55
|
### 授权下载地址(带参数)
|
57
|
-
download_url = Qiniu::Auth.authorize_download_url(
|
58
|
-
url,
|
59
|
-
{
|
60
|
-
:fop => 'download/a.m3u8'
|
61
|
-
}
|
62
|
-
)
|
56
|
+
download_url = Qiniu::Auth.authorize_download_url(url, fop: 'qhash/md5')
|
63
57
|
puts "download_url=#{download_url}"
|
64
58
|
|
65
59
|
result = RestClient.get(download_url)
|
@@ -68,8 +62,8 @@ module Qiniu
|
|
68
62
|
|
69
63
|
### 删除文件
|
70
64
|
code, data = Qiniu::Storage.delete(@bucket, key)
|
71
|
-
code.should == 200
|
72
65
|
puts data.inspect
|
66
|
+
code.should == 200
|
73
67
|
end
|
74
68
|
|
75
69
|
it "should generate uphosts and global for multi_region" do
|
@@ -83,7 +77,7 @@ module Qiniu
|
|
83
77
|
|
84
78
|
### 生成 PutPolicy
|
85
79
|
pp = Auth::PutPolicy.new(@bucket, key)
|
86
|
-
expect(pp.instance_variable_get(:@uphosts)).to eq ["http://up.qiniu.com", "http://upload.qiniu.com", "-H up.qiniu.com http://183.
|
80
|
+
expect(pp.instance_variable_get(:@uphosts)).to eq ["http://up.qiniu.com", "http://upload.qiniu.com", "-H up.qiniu.com http://183.131.7.18"]
|
87
81
|
expect(pp.instance_variable_get(:@global)).to be false
|
88
82
|
ensure
|
89
83
|
Config.settings[:multi_region] = origin_multi_region
|