qiniu 6.9.0 → 6.9.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.
- checksums.yaml +5 -5
- data/README.md +12 -8
- data/lib/qiniu/auth.rb +4 -2
- data/lib/qiniu/version.rb +1 -1
- data/spec/qiniu/auth_spec.rb +3 -1
- data/spec/qiniu/qiniu_spec.rb +2 -1
- data/spec/qiniu/upload_spec.rb +18 -28
- data/spec/spec_helper.rb +10 -0
- metadata +55 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1a186af33928bfc26c7918fa28e2d3b747c3ee0917f75feaded835d778d61cdd
|
4
|
+
data.tar.gz: ed06c6e414c438b98ad98ed258c542ccca9d424541b9378a8a9426f83ba79ec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21ea48d66bb48632d71195d87a2be48eaa1ac492d2033203599f8c82850c8502d1d1a1af21e64f749b9398e7d5762047a91e7b3d83fe997b50d4ff393ad0f4b8
|
7
|
+
data.tar.gz: 8d6cd1a2fe505c41ec3937a0d918d44315721103c39f49293ad4e1600c342068d4b41a5288caf6a5c539d2a60d4b6f23ba9fd1a86abe75f5d97439cabf0e28ab
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Qiniu Resource (Cloud) Storage SDK for Ruby
|
2
2
|
|
3
|
+
[](https://github.com/qiniu/ruby-sdk/blob/master/LICENSE)
|
4
|
+
[](https://travis-ci.org/qiniu/ruby-sdk)
|
5
|
+
[](https://github.com/qiniu/ruby-sdk/releases)
|
6
|
+
[](https://codecov.io/gh/qiniu/ruby-sdk)
|
7
|
+
[](http://badge.fury.io/rb/qiniu)
|
8
|
+
[](https://gemnasium.com/qiniu/ruby-sdk)
|
9
|
+
[](https://codeclimate.com/github/qiniu/ruby-sdk)
|
10
|
+
|
3
11
|
## 关于
|
4
12
|
|
5
13
|
此 Ruby SDK 基于 [七牛云存储官方API](http://developer.qiniu.com/docs/v6/index.html) 构建。使用此 SDK 构建您的网络应用程序,能让您以非常便捷地方式将数据安全地存储到七牛云存储上。无论您的网络应用是一个网站程序,还是包括从云端(服务端程序)到终端(手持设备应用)的架构的服务或应用,通过七牛云存储及其 SDK,都能让您应用程序的终端用户高速上传和下载,同时也让您的服务端更加轻盈。
|
@@ -10,22 +18,18 @@
|
|
10
18
|
* Ruby 2.2.x
|
11
19
|
* Ruby 2.3.x
|
12
20
|
* Ruby 2.4.x
|
21
|
+
* Ruby 2.5.x
|
22
|
+
* Ruby 2.6.x
|
23
|
+
* Ruby 2.7.x
|
13
24
|
* JRuby 9.x
|
14
25
|
|
15
26
|
如果您的应用程序需要在 Ruby 1.9、2.0 或 JRuby 1.7 上运行,请使用此 Ruby SDK 的 6.6.0 版本。
|
16
27
|
|
17
|
-
## 状态
|
18
|
-
|
19
|
-
[](https://travis-ci.org/qiniu/ruby-sdk)
|
20
|
-
[](http://badge.fury.io/rb/qiniu)
|
21
|
-
[](https://gemnasium.com/qiniu/ruby-sdk)
|
22
|
-
[](https://codeclimate.com/github/qiniu/ruby-sdk)
|
23
|
-
|
24
28
|
## 安装
|
25
29
|
|
26
30
|
在您 Ruby 应用程序的 `Gemfile` 文件中,添加如下一行代码:
|
27
31
|
|
28
|
-
gem 'qiniu', '>= 6.9.
|
32
|
+
gem 'qiniu', '>= 6.9.1'
|
29
33
|
|
30
34
|
然后,在应用程序所在的目录下,可以运行 `bundle` 安装依赖包:
|
31
35
|
|
data/lib/qiniu/auth.rb
CHANGED
@@ -49,6 +49,7 @@ module Qiniu
|
|
49
49
|
PARAMS = {
|
50
50
|
# 字符串类型参数
|
51
51
|
:scope => "scope" ,
|
52
|
+
:is_prefixal_scope => "isPrefixalScope" ,
|
52
53
|
:save_key => "saveKey" ,
|
53
54
|
:end_user => "endUser" ,
|
54
55
|
:return_url => "returnUrl" ,
|
@@ -64,13 +65,14 @@ module Qiniu
|
|
64
65
|
# 数值类型参数
|
65
66
|
:deadline => "deadline" ,
|
66
67
|
:insert_only => "insertOnly" ,
|
68
|
+
:fsize_min => "fsizeMin" ,
|
67
69
|
:fsize_limit => "fsizeLimit" ,
|
68
|
-
:callback_fetch_key => "callbackFetchKey" ,
|
69
70
|
:detect_mime => "detectMime" ,
|
70
71
|
:mime_limit => "mimeLimit" ,
|
71
72
|
:uphosts => "uphosts" ,
|
72
73
|
:global => "global" ,
|
73
|
-
:delete_after_days => "deleteAfterDays"
|
74
|
+
:delete_after_days => "deleteAfterDays" ,
|
75
|
+
:file_type => "fileType"
|
74
76
|
} # PARAMS
|
75
77
|
|
76
78
|
public
|
data/lib/qiniu/version.rb
CHANGED
data/spec/qiniu/auth_spec.rb
CHANGED
@@ -40,6 +40,8 @@ module Qiniu
|
|
40
40
|
|
41
41
|
### 获取下载地址
|
42
42
|
code, domains, = Qiniu::Storage.domains(@bucket)
|
43
|
+
|
44
|
+
code.should == 200
|
43
45
|
domains.should_not be_empty
|
44
46
|
domain = domains.first['domain']
|
45
47
|
url = "http://#{domain}/#{key}"
|
@@ -77,7 +79,7 @@ module Qiniu
|
|
77
79
|
|
78
80
|
### 生成 PutPolicy
|
79
81
|
pp = Auth::PutPolicy.new(@bucket, key)
|
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.
|
82
|
+
expect(pp.instance_variable_get(:@uphosts)).to eq ["http://up.qiniu.com", "http://upload.qiniu.com", "-H up.qiniu.com http://183.131.7.3"]
|
81
83
|
expect(pp.instance_variable_get(:@global)).to be false
|
82
84
|
ensure
|
83
85
|
Config.settings[:multi_region] = origin_multi_region
|
data/spec/qiniu/qiniu_spec.rb
CHANGED
data/spec/qiniu/upload_spec.rb
CHANGED
@@ -10,6 +10,8 @@ module Qiniu
|
|
10
10
|
module Storage
|
11
11
|
shared_examples "Upload Specs" do
|
12
12
|
before :all do
|
13
|
+
Config.settings[:multi_region] = true
|
14
|
+
|
13
15
|
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
|
14
16
|
@key = make_unique_key_in_bucket(@key)
|
15
17
|
puts "key=#{@key}"
|
@@ -320,42 +322,30 @@ module Qiniu
|
|
320
322
|
end
|
321
323
|
end
|
322
324
|
|
323
|
-
describe '
|
325
|
+
describe 'for na0 bucket' do
|
324
326
|
before :all do
|
325
|
-
|
326
|
-
@bucket = 'rubysdk'
|
327
|
+
@bucket = 'rubysdk-na0'
|
327
328
|
end
|
328
329
|
include_examples 'Upload Specs'
|
329
330
|
end
|
330
331
|
|
331
|
-
describe '
|
332
|
-
|
333
|
-
|
334
|
-
Config.settings[:multi_region] = true
|
335
|
-
@bucket = 'rubysdk'
|
336
|
-
end
|
337
|
-
include_examples 'Upload Specs'
|
332
|
+
describe 'for as0 bucket' do
|
333
|
+
before :all do
|
334
|
+
@bucket = 'rubysdk-as0'
|
338
335
|
end
|
336
|
+
include_examples 'Upload Specs'
|
339
337
|
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
@bucket = 'rubysdk-bc'
|
344
|
-
end
|
345
|
-
include_examples 'Upload Specs'
|
338
|
+
it 'should raise BucketIsMissing error' do
|
339
|
+
upopts = {:scope => @bucket, :expires_in => 3600, :endUser => "why404@gmail.com"}
|
340
|
+
uptoken = Qiniu.generate_upload_token(upopts)
|
346
341
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
__FILE__,
|
355
|
-
@key,
|
356
|
-
)
|
357
|
-
end.to raise_error('upload_with_token_2 requires :bucket option when multi_region is enabled')
|
358
|
-
end
|
342
|
+
expect do
|
343
|
+
Qiniu::Storage.upload_with_token_2(
|
344
|
+
uptoken,
|
345
|
+
__FILE__,
|
346
|
+
@key,
|
347
|
+
)
|
348
|
+
end.to raise_error('upload_with_token_2 requires :bucket option when multi_region is enabled')
|
359
349
|
end
|
360
350
|
end
|
361
351
|
end # module Storage
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,16 @@ require 'qiniu'
|
|
5
5
|
require 'rspec'
|
6
6
|
require 'webmock'
|
7
7
|
|
8
|
+
if RUBY_ENGINE == 'jruby' && Gem::Version.create(RUBY_VERSION) < Gem::Version::create('2.3.0')
|
9
|
+
# Do nothing
|
10
|
+
else
|
11
|
+
require 'simplecov'
|
12
|
+
require 'codecov'
|
13
|
+
|
14
|
+
SimpleCov.start
|
15
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
16
|
+
end
|
17
|
+
|
8
18
|
RSpec.configure do |config|
|
9
19
|
config.before :all do
|
10
20
|
Qiniu.establish_connection! :access_key => ENV["QINIU_ACCESS_KEY"], :secret_key => ENV["QINIU_SECRET_KEY"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qiniu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.9.
|
4
|
+
version: 6.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- why404
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -53,6 +53,48 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '2.3'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: codecov
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.2.5
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.2.5
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.18.5
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.18.5
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rexml
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '3.2'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '3.2'
|
56
98
|
- !ruby/object:Gem::Dependency
|
57
99
|
name: rest-client
|
58
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,30 +179,29 @@ require_paths:
|
|
137
179
|
- lib
|
138
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
181
|
requirements:
|
140
|
-
- - "
|
182
|
+
- - ">="
|
141
183
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
184
|
+
version: '0'
|
143
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
186
|
requirements:
|
145
187
|
- - ">="
|
146
188
|
- !ruby/object:Gem::Version
|
147
189
|
version: '0'
|
148
190
|
requirements: []
|
149
|
-
|
150
|
-
rubygems_version: 2.6.14
|
191
|
+
rubygems_version: 3.0.8
|
151
192
|
signing_key:
|
152
193
|
specification_version: 4
|
153
194
|
summary: Qiniu Resource (Cloud) Storage SDK for Ruby
|
154
195
|
test_files:
|
155
|
-
- spec/
|
156
|
-
- spec/qiniu/
|
196
|
+
- spec/spec_helper.rb
|
197
|
+
- spec/qiniu/pfop_spec.rb
|
157
198
|
- spec/qiniu/image_spec.rb
|
199
|
+
- spec/qiniu/auth_spec.rb
|
158
200
|
- spec/qiniu/management_spec.rb
|
159
|
-
- spec/qiniu/misc_spec.rb
|
160
|
-
- spec/qiniu/pfop_spec.rb
|
161
|
-
- spec/qiniu/qiniu_spec.rb
|
162
|
-
- spec/qiniu/tokens/qbox_token_spec.rb
|
163
201
|
- spec/qiniu/upload_spec.rb
|
164
|
-
- spec/qiniu/
|
202
|
+
- spec/qiniu/misc_spec.rb
|
165
203
|
- spec/qiniu/version_spec.rb
|
166
|
-
- spec/
|
204
|
+
- spec/qiniu/utils_spec.rb
|
205
|
+
- spec/qiniu/abstract_spec.rb
|
206
|
+
- spec/qiniu/tokens/qbox_token_spec.rb
|
207
|
+
- spec/qiniu/qiniu_spec.rb
|