删除过时的Qiniu::Storage.put_file方法。

This commit is contained in:
Liang Tao
2014-03-26 17:07:34 +08:00
parent cfad4ef53f
commit bc1b8acea5
7 changed files with 13 additions and 77 deletions
+4
View File
@@ -8,6 +8,10 @@
- 更新Qiniu::Storage所有上传接口的测试用例,打印HTTP响应Header信息。
- 删除过时的Qiniu::Storage#put_file方法和相关测试用例
该方法调用的API已过时并逐步废弃,建议用户尽快迁移到Qiniu::Storage#upload_with_token_2方法上
### v6.0.1
- 重新划分命名空间,存储相关归入Qiniu::Storage,数据处理相关归入Qiniu::Fop,杂项相关归入Qiniu::Misc。
-10
View File
@@ -54,16 +54,6 @@ module Qiniu
code == StatusOK
end
def put_file opts = {}
code, data = Storage.put_file(opts[:file],
opts[:bucket],
opts[:key],
opts[:mime_type],
opts[:note],
opts[:enable_crc32_check])
code == StatusOK
end
def upload_file opts = {}
uncontained_opts = [:uptoken, :file, :bucket, :key] - opts.keys
raise MissingArgsError, uncontained_opts unless uncontained_opts.empty?
-1
View File
@@ -20,7 +20,6 @@ module Qiniu
:content_type => 'application/x-www-form-urlencoded',
:auth_url => "https://acc.qbox.me/oauth2/token",
:rs_host => "http://rs.qiniu.com",
:io_host => "http://iovip.qbox.me",
:up_host => "http://up.qiniu.com",
:pub_host => "http://pu.qbox.me:10200",
:eu_host => "http://eu.qbox.me",
-21
View File
@@ -5,27 +5,6 @@ module Qiniu
class << self
include Utils
def put_file(local_file,
bucket,
key = nil,
mime_type = nil,
custom_meta = nil,
enable_crc32_check = false)
action_params = _generate_action_params(
local_file,
bucket,
key,
mime_type,
custom_meta,
enable_crc32_check
)
url = Config.settings[:io_host] + action_params
options = {:content_type => 'application/octet-stream'}
Auth.request url, ::IO.read(local_file), options
end # put_file
def upload_with_token(uptoken,
local_file,
bucket,
+9 -2
View File
@@ -29,9 +29,16 @@ module Qiniu
end
### 准备数据
context ".put_file" do
context ".upload_with_token_2" do
it "should works" do
code, data = Storage.put_file(__FILE__, @bucket, @key, 'application/x-ruby', 'customMeta', true)
upopts = {:scope => @bucket, :expires_in => 3600, :endUser => "why404@gmail.com"}
uptoken = Qiniu.generate_upload_token(upopts)
code, data, raw_headers = Qiniu::Storage.upload_with_token_2(
uptoken,
__FILE__,
@key
)
code.should == 200
puts data.inspect
end
-11
View File
@@ -37,17 +37,6 @@ module Qiniu
### 不删除Bucket以备下次使用
end
context ".put_file" do
it "should works" do
result = Qiniu.put_file :file => __FILE__,
:bucket => @bucket,
:key => @key,
:mime_type => 'application/x-ruby',
:enable_crc32_check => true
result.should be_true
end
end
context ".buckets" do
it "should works" do
result = Qiniu.buckets
-32
View File
@@ -57,38 +57,6 @@ module Qiniu
end
### 测试单文件直传
context ".put_file" do
it "should works" do
code, data, raw_headers = Qiniu::Storage.put_file(
__FILE__,
@bucket,
@key,
'application/x-ruby',
'customMeta',
true
)
code.should == 200
puts data.inspect
puts raw_headers.inspect
end
end
context ".stat" do
it "should exists" do
code, data = Qiniu::Storage.stat(@bucket, @key)
puts data.inspect
code.should == 200
end
end
context ".delete" do
it "should works" do
code, data = Qiniu::Storage.delete(@bucket, @key)
puts data.inspect
code.should == 200
end
end
context ".upload_with_token" do
it "should works" do
upopts = {:scope => @bucket, :expires_in => 3600, :customer => "why404@gmail.com"}