qiniu-rs 3.3.0 → 3.3.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.
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +1 -1
- data/lib/qiniu/rs/version.rb +1 -1
- data/spec/qiniu/rs/eu_spec.rb +2 -3
- data/spec/qiniu/rs/image_spec.rb +2 -3
- data/spec/qiniu/rs/io_spec.rb +2 -3
- data/spec/qiniu/rs/pub_spec.rb +1 -2
- data/spec/qiniu/rs/rs_spec.rb +4 -3
- data/spec/qiniu/rs/up_spec.rb +2 -2
- data/spec/qiniu/rs_spec.rb +12 -14
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
1
|
## CHANGE LOG
|
2
2
|
|
3
|
+
### v3.3.1
|
4
|
+
|
5
|
+
|
6
|
+
确保单元测试里边用到的测试 Bucket 全局唯一
|
7
|
+
|
8
|
+
使得10多种不通的 Ruby 宿主环境能隔离互不影响地执行单元/集成测试
|
9
|
+
|
10
|
+
Ruby 宿主环境如下
|
11
|
+
|
12
|
+
1.8.7, 1.9.2, 1.9.3, jruby-18mode, jruby-19mode, rbx-18mode, rbx-19mode, ruby-head, jruby-head, ree
|
13
|
+
|
14
|
+
详见 <https://travis-ci.org/qiniu/ruby-sdk>
|
15
|
+
|
3
16
|
### v3.3.0
|
4
17
|
|
5
|
-
|
18
|
+
私有资源下载新版实现,添加 Qiniu::RS.generate_download_token() 方法。参考 [downloadToken](http://docs.qiniutek.com/v3/api/io/#get)
|
19
|
+
|
20
|
+
详见 [Ruby SDK 使用文档之私有资源下载](http://docs.qiniutek.com/v3/sdk/ruby/#download-private-files)
|
6
21
|
|
7
22
|
### v3.2.2
|
8
23
|
|
data/Gemfile.lock
CHANGED
data/lib/qiniu/rs/version.rb
CHANGED
data/spec/qiniu/rs/eu_spec.rb
CHANGED
@@ -10,8 +10,8 @@ module Qiniu
|
|
10
10
|
describe EU do
|
11
11
|
|
12
12
|
before :all do
|
13
|
-
@customer_id = "
|
14
|
-
@bucket =
|
13
|
+
@customer_id = "why404@gmail.com"
|
14
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
15
15
|
@key = "image_logo_for_test.png"
|
16
16
|
|
17
17
|
result = Qiniu::RS.mkbucket(@bucket)
|
@@ -35,7 +35,6 @@ module Qiniu
|
|
35
35
|
end
|
36
36
|
|
37
37
|
after :all do
|
38
|
-
@bucket = "wm_test_bucket"
|
39
38
|
result = Qiniu::RS.drop(@bucket)
|
40
39
|
puts result.inspect
|
41
40
|
result.should_not be_false
|
data/spec/qiniu/rs/image_spec.rb
CHANGED
@@ -11,7 +11,7 @@ module Qiniu
|
|
11
11
|
|
12
12
|
before :all do
|
13
13
|
|
14
|
-
@bucket =
|
14
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
15
15
|
@key = "image_logo_for_test.png"
|
16
16
|
|
17
17
|
result = Qiniu::RS.mkbucket(@bucket)
|
@@ -20,7 +20,7 @@ module Qiniu
|
|
20
20
|
|
21
21
|
local_file = File.expand_path('../' + @key, __FILE__)
|
22
22
|
|
23
|
-
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "
|
23
|
+
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com"}
|
24
24
|
uptoken = Qiniu::RS.generate_upload_token(upopts)
|
25
25
|
data = Qiniu::RS.upload_file :uptoken => uptoken, :file => local_file, :bucket => @bucket, :key => @key
|
26
26
|
puts data.inspect
|
@@ -42,7 +42,6 @@ module Qiniu
|
|
42
42
|
end
|
43
43
|
|
44
44
|
after :all do
|
45
|
-
@bucket = "test_images_12345"
|
46
45
|
result = Qiniu::RS.drop(@bucket)
|
47
46
|
puts result.inspect
|
48
47
|
result.should_not be_false
|
data/spec/qiniu/rs/io_spec.rb
CHANGED
@@ -10,7 +10,7 @@ module Qiniu
|
|
10
10
|
describe IO do
|
11
11
|
|
12
12
|
before :all do
|
13
|
-
@bucket =
|
13
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
14
14
|
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
|
15
15
|
|
16
16
|
result = Qiniu::RS.mkbucket(@bucket)
|
@@ -19,7 +19,6 @@ module Qiniu
|
|
19
19
|
end
|
20
20
|
|
21
21
|
after :all do
|
22
|
-
@bucket = "io_test_bucket"
|
23
22
|
result = Qiniu::RS.drop(@bucket)
|
24
23
|
puts result.inspect
|
25
24
|
result.should_not be_false
|
@@ -48,7 +47,7 @@ module Qiniu
|
|
48
47
|
|
49
48
|
context ".upload_with_token" do
|
50
49
|
it "should works" do
|
51
|
-
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "
|
50
|
+
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com"}
|
52
51
|
uptoken = Qiniu::RS.generate_upload_token(upopts)
|
53
52
|
code, data = Qiniu::RS::IO.upload_with_token(uptoken, __FILE__, @bucket, @key, nil, nil, nil, true)
|
54
53
|
code.should == 200
|
data/spec/qiniu/rs/pub_spec.rb
CHANGED
@@ -10,14 +10,13 @@ module Qiniu
|
|
10
10
|
describe Pub do
|
11
11
|
|
12
12
|
before :all do
|
13
|
-
@bucket =
|
13
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
14
14
|
result = Qiniu::RS.mkbucket(@bucket)
|
15
15
|
puts result.inspect
|
16
16
|
result.should_not be_false
|
17
17
|
end
|
18
18
|
|
19
19
|
after :all do
|
20
|
-
@bucket = "pub_test_bucket"
|
21
20
|
result = Qiniu::RS.drop(@bucket)
|
22
21
|
puts result.inspect
|
23
22
|
result.should_not be_false
|
data/spec/qiniu/rs/rs_spec.rb
CHANGED
@@ -11,9 +11,9 @@ module Qiniu
|
|
11
11
|
describe RS do
|
12
12
|
|
13
13
|
before :all do
|
14
|
-
@bucket =
|
14
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
15
15
|
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
|
16
|
-
|
16
|
+
#@domain = @bucket + '.dn.qbox.me'
|
17
17
|
|
18
18
|
code, data = Qiniu::RS::RS.mkbucket(@bucket)
|
19
19
|
puts [code, data].inspect
|
@@ -21,7 +21,6 @@ module Qiniu
|
|
21
21
|
end
|
22
22
|
|
23
23
|
after :all do
|
24
|
-
@bucket = "rs_test_bucket"
|
25
24
|
code, data = Qiniu::RS::RS.drop(@bucket)
|
26
25
|
puts [code, data].inspect
|
27
26
|
code.should == 200
|
@@ -90,6 +89,7 @@ module Qiniu
|
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
92
|
+
=begin
|
93
93
|
context ".publish" do
|
94
94
|
it "should works" do
|
95
95
|
code, data = Qiniu::RS::RS.publish(@domain, @bucket)
|
@@ -105,6 +105,7 @@ module Qiniu
|
|
105
105
|
puts data.inspect
|
106
106
|
end
|
107
107
|
end
|
108
|
+
=end
|
108
109
|
|
109
110
|
context ".delete" do
|
110
111
|
it "should works" do
|
data/spec/qiniu/rs/up_spec.rb
CHANGED
@@ -12,7 +12,7 @@ module Qiniu
|
|
12
12
|
before :all do
|
13
13
|
@localfile = "bigfile.txt"
|
14
14
|
File.open(@localfile, "w"){|f| 5242888.times{f.write(rand(9).to_s)}}
|
15
|
-
@bucket =
|
15
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
16
16
|
@key = Digest::SHA1.hexdigest(@localfile+Time.now.to_s)
|
17
17
|
|
18
18
|
code, data = Qiniu::RS::RS.mkbucket(@bucket)
|
@@ -30,7 +30,7 @@ module Qiniu
|
|
30
30
|
|
31
31
|
context ".upload_with_token" do
|
32
32
|
it "should works" do
|
33
|
-
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "
|
33
|
+
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com"}
|
34
34
|
uptoken = Qiniu::RS.generate_upload_token(upopts)
|
35
35
|
code, data = Qiniu::RS::UP.upload_with_token(uptoken, @localfile, @bucket, @key)
|
36
36
|
puts data.inspect
|
data/spec/qiniu/rs_spec.rb
CHANGED
@@ -9,14 +9,14 @@ module Qiniu
|
|
9
9
|
describe RS do
|
10
10
|
|
11
11
|
before :all do
|
12
|
-
@bucket = '
|
12
|
+
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
13
13
|
@key = Digest::SHA1.hexdigest Time.now.to_s
|
14
|
-
|
14
|
+
#@domain = @bucket + '.dn.qbox.me'
|
15
15
|
|
16
16
|
result = Qiniu::RS.mkbucket(@bucket)
|
17
17
|
result.should_not be_false
|
18
18
|
|
19
|
-
@test_image_bucket = '
|
19
|
+
@test_image_bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
20
20
|
result2 = Qiniu::RS.mkbucket(@test_image_bucket)
|
21
21
|
puts result2.inspect
|
22
22
|
result2.should be_true
|
@@ -24,15 +24,15 @@ module Qiniu
|
|
24
24
|
@test_image_key = 'image_logo_for_test.png'
|
25
25
|
local_file = File.expand_path('./rs/' + @test_image_key, File.dirname(__FILE__))
|
26
26
|
puts local_file.inspect
|
27
|
-
upopts = {:scope => @test_image_bucket, :expires_in => 3600, :customer => "
|
27
|
+
upopts = {:scope => @test_image_bucket, :expires_in => 3600, :customer => "why404@gmail.com"}
|
28
28
|
uptoken = Qiniu::RS.generate_upload_token(upopts)
|
29
29
|
data = Qiniu::RS.upload_file :uptoken => uptoken, :file => local_file, :bucket => @test_image_bucket, :key => @test_image_key
|
30
30
|
puts data.inspect
|
31
31
|
end
|
32
32
|
|
33
33
|
after :all do
|
34
|
-
result = Qiniu::RS.unpublish(@domain)
|
35
|
-
result.should_not be_false
|
34
|
+
#result = Qiniu::RS.unpublish(@domain)
|
35
|
+
#result.should_not be_false
|
36
36
|
|
37
37
|
result1 = Qiniu::RS.drop(@bucket)
|
38
38
|
puts result1.inspect
|
@@ -186,7 +186,7 @@ module Qiniu
|
|
186
186
|
File.open(localfile, "w"){|f| 5242888.times{f.write(rand(9).to_s)}}
|
187
187
|
key = Digest::SHA1.hexdigest(localfile+Time.now.to_s)
|
188
188
|
# generate the upload token
|
189
|
-
uptoken_opts = {:scope => @bucket, :expires_in => 3600, :customer => "
|
189
|
+
uptoken_opts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com", :escape => 0}
|
190
190
|
uptoken = Qiniu::RS.generate_upload_token(uptoken_opts)
|
191
191
|
# uploading
|
192
192
|
upload_opts = {
|
@@ -277,12 +277,14 @@ module Qiniu
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
+
=begin
|
280
281
|
context ".publish" do
|
281
282
|
it "should works" do
|
282
283
|
result = Qiniu::RS.publish(@domain, @bucket)
|
283
284
|
result.should_not be_false
|
284
285
|
end
|
285
286
|
end
|
287
|
+
=end
|
286
288
|
|
287
289
|
=begin
|
288
290
|
context ".unpublish" do
|
@@ -338,10 +340,6 @@ module Qiniu
|
|
338
340
|
data.should_not be_empty
|
339
341
|
puts data.inspect
|
340
342
|
|
341
|
-
dest_bucket = "test_thumbnails_bucket"
|
342
|
-
result = Qiniu::RS.mkbucket(dest_bucket)
|
343
|
-
result.should_not be_false
|
344
|
-
|
345
343
|
dest_key = "cropped-" + @test_image_key
|
346
344
|
src_img_url = data["url"]
|
347
345
|
mogrify_options = {
|
@@ -353,7 +351,7 @@ module Qiniu
|
|
353
351
|
:format => "jpg",
|
354
352
|
:auto_orient => true
|
355
353
|
}
|
356
|
-
result2 = Qiniu::RS.image_mogrify_save_as(
|
354
|
+
result2 = Qiniu::RS.image_mogrify_save_as(@test_image_bucket, dest_key, src_img_url, mogrify_options)
|
357
355
|
result2.should_not be_false
|
358
356
|
result2.should_not be_empty
|
359
357
|
puts result2.inspect
|
@@ -362,7 +360,7 @@ module Qiniu
|
|
362
360
|
|
363
361
|
context ".generate_upload_token" do
|
364
362
|
it "should works" do
|
365
|
-
data = Qiniu::RS.generate_upload_token({:scope =>
|
363
|
+
data = Qiniu::RS.generate_upload_token({:scope => @bucket, :expires_in => 3600, :escape => 0})
|
366
364
|
data.should_not be_empty
|
367
365
|
puts data.inspect
|
368
366
|
data.split(":").length.should == 3
|
@@ -371,7 +369,7 @@ module Qiniu
|
|
371
369
|
|
372
370
|
context ".generate_download_token" do
|
373
371
|
it "should works" do
|
374
|
-
data = Qiniu::RS.generate_download_token({:expires_in => 1, :pattern => 'http
|
372
|
+
data = Qiniu::RS.generate_download_token({:expires_in => 1, :pattern => 'http://*.dn.qbox.me/*'})
|
375
373
|
data.should_not be_empty
|
376
374
|
puts data.inspect
|
377
375
|
data.split(":").length.should == 3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiniu-rs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -188,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
segments:
|
190
190
|
- 0
|
191
|
-
hash:
|
191
|
+
hash: -1910839503800791135
|
192
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
193
|
none: false
|
194
194
|
requirements:
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
version: '0'
|
198
198
|
segments:
|
199
199
|
- 0
|
200
|
-
hash:
|
200
|
+
hash: -1910839503800791135
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
203
|
rubygems_version: 1.8.24
|