Compare commits

...
21 Commits
Author SHA1 Message Date
Bai Long 2322bbcd9c Update Gemfile.lock 2014-06-20 21:24:15 +08:00
Bai Long 1ece11ea89 Update version.rb 2014-06-20 21:23:36 +08:00
Bai Long 48abc7f7c1 Update CHANGELOG.md 2014-06-20 21:21:01 +08:00
Bai Long 4aca5af37e Update CHANGELOG.md
调整user agent
2014-06-20 21:20:23 +08:00
Bai Long 35661ebcbf Update config.rb 2014-06-20 21:12:21 +08:00
Bai Long c87b75d3cf Merge pull request #94 from longbai/user-agent
User agent
2014-06-20 20:59:57 +08:00
longbai 328306814a add new user agent 2014-06-20 20:40:09 +08:00
longbai e2d8a07882 update site 2014-06-20 20:39:51 +08:00
Bai Long 8f11a43123 Merge pull request #93 from BluntBlade/master
为PutPolicy添加persistentPipeline参数。
2014-06-06 13:19:29 +08:00
Liang Tao 9d8f684eec 补充版本更新信息。 2014-06-06 12:18:14 +08:00
Liang Tao 244735a3f2 为PutPolicy添加persistentPipeline参数。 2014-06-06 12:15:00 +08:00
Bai Long 53d5f1bb4b Merge pull request #92 from BluntBlade/master
一些同步更新
2014-06-04 15:28:07 +08:00
Liang Tao de31e33460 添加Pull Request URL。 2014-06-04 14:58:24 +08:00
Liang Tao 01711a6fd4 Merge branch 'master' of github.com:BluntBlade/ruby-sdk 2014-06-04 14:53:35 +08:00
Liang Tao 5735dce6e9 Merge branch 'master' of github.com:qiniu/ruby-sdk 2014-06-04 14:48:17 +08:00
Liang Tao 788e21720b 添加版本说明。 2014-06-04 14:48:16 +08:00
Liang Tao 1f6e9ba47b 为authorize_download_url()添加:fop参数,以便生成含FOP指令的授权下载URL。 2014-06-04 14:40:23 +08:00
Liang Tao a424c79dd6 添加pipeline参数,用于指定命名转码队列。 2014-06-04 14:16:20 +08:00
Bai Long 7e66297bf9 Merge pull request #91 from longbai/remove-transform
remove transform
2014-05-30 19:59:32 +08:00
longbai ba91ee2377 remove transform 2014-05-30 18:44:04 +08:00
Liang Tao 417b717bc5 去除未公开的参数。 2014-05-05 16:44:36 +08:00
8 changed files with 46 additions and 16 deletions
+13
View File
@@ -1,5 +1,18 @@
## CHANGE LOG
### v6.2.4
- 调整User Agent。 [https://github.com/qiniu/ruby-sdk/pull/94](https://github.com/qiniu/ruby-sdk/pull/94)
### v6.2.3
- 为上传策略添加`persistentPipeline`参数,用于指明使用哪个命名转码队列。 [https://github.com/qiniu/ruby-sdk/pull/93](https://github.com/qiniu/ruby-sdk/pull/93)
### v6.2.2
- 为/pfop接口添加`pipeline`参数,用于指明使用哪个命名转码队列。 [https://github.com/qiniu/ruby-sdk/pull/92](https://github.com/qiniu/ruby-sdk/pull/92)
- 为authorize_download_url()添加`:fop`参数,用于生成含数据处理指令的授权下载URL。
### v6.2.1
- 去除已废弃的publish/unpublish接口。 [https://github.com/qiniu/ruby-sdk/pull/90](https://github.com/qiniu/ruby-sdk/pull/90) (#8143)
+1 -1
View File
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
qiniu (6.2.1)
qiniu (6.2.4)
json (~> 1.7)
mime-types (~> 1.19)
rest-client (~> 1.6)
+19 -7
View File
@@ -51,15 +51,14 @@ module Qiniu
:callback_body => "callbackBody" ,
:persistent_ops => "persistentOps" ,
:persistent_notify_url => "persistentNotifyUrl" ,
:transform => "transform" ,
:persistent_pipeline => "persistentPipeline" ,
# 数值类型参数
:deadline => "deadline" ,
:insert_only => "insertOnly" ,
:fsize_limit => "fsizeLimit" ,
:detect_mime => "detectMime" ,
:mime_limit => "mimeLimit" ,
:fop_timeout => "fopTimeout"
:mime_limit => "mimeLimit"
} # PARAMS
public
@@ -140,16 +139,29 @@ module Qiniu
access_key = Config.settings[:access_key]
secret_key = Config.settings[:secret_key]
download_url = url
### URL变换:追加FOP指令
if args[:fop].is_a?(String) && args[:fop] != '' then
if download_url.index('?').is_a?(Fixnum) then
# 已有参数
download_url = "#{download_url}&#{args[:fop]}"
else
# 尚无参数
download_url = "#{download_url}?#{args[:fop]}"
end
end
### 授权期计算
e = Auth.calculate_deadline(args[:expires_in], args[:deadline])
### URL变换:追加授权期参数
if url.index('?').is_a?(Fixnum) then
if download_url.index('?').is_a?(Fixnum) then
# 已有参数
download_url = "#{url}&e=#{e}"
download_url = "#{download_url}&e=#{e}"
else
# 尚无参数
download_url = "#{url}?e=#{e}"
download_url = "#{download_url}?e=#{e}"
end
### 生成数字签名
@@ -184,7 +196,7 @@ module Qiniu
# 如果有Body,则也加上
# (仅限于mime == "application/x-www-form-urlencoded"的情况)
if body.is_a?(String) && !body.empty?
signing_str += body
signing_str += body
end
### 生成数字签名
+2 -4
View File
@@ -15,7 +15,7 @@ module Qiniu
class << self
DEFAULT_OPTIONS = {
:user_agent => 'Qiniu-RS-Ruby-SDK-' + Version.to_s + '()',
:user_agent => 'QiniuRuby/' + Version.to_s + ' ('+RUBY_PLATFORM+')' + ' Ruby/'+ RUBY_VERSION,
:method => :post,
:content_type => 'application/x-www-form-urlencoded',
:auth_url => "https://acc.qbox.me/oauth2/token",
@@ -23,8 +23,6 @@ module Qiniu
:up_host => "http://up.qiniu.com",
:pub_host => "http://pu.qbox.me:10200",
:eu_host => "http://eu.qbox.me",
:client_id => "a75604760c4da4caaa456c0c5895c061c3065c5a",
:client_secret => "75df554a39f58accb7eb293b550fa59618674b7d",
:access_key => "",
:secret_key => "",
:auto_reconnect => true,
@@ -32,7 +30,7 @@ module Qiniu
:block_size => 1024*1024*4,
:chunk_size => 1024*256,
:enable_debug => true,
:tmpdir => Dir.tmpdir + File::SEPARATOR + 'Qiniu-RS-Ruby-SDK'
:tmpdir => Dir.tmpdir + File::SEPARATOR + 'QiniuRuby'
}
REQUIRED_OPTION_KEYS = [:access_key, :secret_key]
+1
View File
@@ -30,6 +30,7 @@ module Qiniu
:key => "key",
:fops => "fops",
:notify_url => "notifyURL",
:pipeline => "pipeline",
# 数值类型参数
:force => "force"
+1 -1
View File
@@ -4,7 +4,7 @@ module Qiniu
module Version
MAJOR = 6
MINOR = 2
PATCH = 1
PATCH = 4
# Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and <tt>PATCH</tt> with <tt>'.'</tt>
#
# Example
+7 -1
View File
@@ -1,4 +1,5 @@
# -*- encoding: utf-8 -*-
# vim: sw=2 ts=2
require 'spec_helper'
require 'qiniu/auth'
@@ -56,7 +57,12 @@ module Qiniu
result.body.should_not be_empty
### 授权下载地址(带参数)
download_url = Qiniu::Auth.authorize_download_url(url + '?download/a.m3u8')
download_url = Qiniu::Auth.authorize_download_url(
url,
{
:fop => 'download/a.m3u8'
}
)
puts "download_url=#{download_url}"
result = RestClient.get(download_url)
+2 -2
View File
@@ -7,7 +7,7 @@ module Qiniu
module RS
describe QboxToken do
before :all do
@qbox_token = QboxToken.new(:url => 'www.qiniutek.com?key1=value1',
@qbox_token = QboxToken.new(:url => 'www.qiniu.com?key1=value1',
:params => { :key2 => 'value2' })
@qbox_token.access_key = 'access_key'
@qbox_token.secret_key = 'secret_key'
@@ -21,7 +21,7 @@ module Qiniu
context "#generate_signature" do
it "should generate signature" do
@qbox_token.generate_signature.should == "www.qiniutek.com?key1=value1\nkey2=value2"
@qbox_token.generate_signature.should == "www.qiniu.com?key1=value1\nkey2=value2"
end
end
end