Compare commits

...
18 Commits
Author SHA1 Message Date
Bai Long 17f69da758 Update CHANGELOG.md 2014-07-11 15:55:04 +08:00
Bai Long 7280ca139a Merge pull request #100 from dp90219/master
a mistake. change `persistent_ops` to `persistentOps` and so on
2014-07-09 22:16:17 +08:00
Bai Long bc30779647 Merge pull request #99 from coaku/b_xzk_upload_qiniu_com
#9891
2014-07-09 21:55:13 +08:00
liupeng b6ab98b238 Merge branch 'master' of https://github.com/dp90219/ruby-sdk 2014-07-09 14:09:44 +08:00
liupeng db62d9bcd3 a mistake. change params[:persistent_ops] to params[:persistentOps] and so on 2014-07-09 14:06:16 +08:00
xuzhaokui 089ebb2354 upload.qiniu.com 2014-07-09 11:27:46 +08:00
liupeng e97582e370 a mistake. change persistent_ops to persistentOps and so on 2014-07-09 10:20:22 +08:00
Bai Long c01a43f3d9 Merge pull request #97 from dp90219/master
去除generate_upload_token 中旧的async_options, 添加 persistent_ops
2014-07-08 20:51:50 +08:00
Bai Long 4142c0182a Merge pull request #98 from BluntBlade/master
为过时方法添加说明。
2014-07-08 20:50:48 +08:00
Liang Tao 3d9d50c3c5 为过时方法添加说明。 2014-07-08 17:20:12 +08:00
liupeng e0c4a14e20 去除generate_upload_token 中旧的async_options, 添加 persistent_ops, persistent_notify_url, persistent_pipeline 2014-07-08 17:09:41 +08:00
Bai Long 67c4d63a05 Merge pull request #95 from BluntBlade/master
添加 authorize_download_url_2 方法,对包含中文或其它 utf-8 字符的Key做下载授权。
2014-07-01 15:41:30 +08:00
Liang Tao 5ffe9daf58 更新版本信息。 2014-07-01 15:27:35 +08:00
Liang Tao a6debbec49 Merge branch 'master' of github.com:qiniu/ruby-sdk 2014-07-01 15:04:55 +08:00
Liang Tao 58dfe18328 添加 authorize_download_url_2 方法,对包含中文或其它 utf-8 字符的Key做下载授权。 2014-07-01 14:40:48 +08:00
Liang Tao 1222559c71 添加 schema 和 port 参数。 2014-07-01 11:57:45 +08:00
Liang Tao 31cbf3a6fd 添加针对中文Key的私有资源下载URL授权方法。 2014-06-30 16:08:46 +08:00
Bai Long 3504d39cd0 Update README.md 2014-06-20 22:11:03 +08:00
9 changed files with 47 additions and 8 deletions
+10
View File
@@ -1,5 +1,15 @@
## CHANGE LOG
### v6.3.1
- 为过期方法添加说明。 [https://github.com/qiniu/ruby-sdk/pull/98](https://github.com/qiniu/ruby-sdk/pull/98)
- 修改上传域名。 [https://github.com/qiniu/ruby-sdk/pull/99](https://github.com/qiniu/ruby-sdk/pull/99)
- 增加pfop参数。 [https://github.com/qiniu/ruby-sdk/pull/100](https://github.com/qiniu/ruby-sdk/pull/100)
### v6.3.0
- 添加 authorize_download_url_2 方法,对包含中文或其它 utf-8 字符的 Key 做下载授权。 [https://github.com/qiniu/ruby-sdk/pull/95](https://github.com/qiniu/ruby-sdk/pull/95)
### v6.2.4
- 调整User Agent。 [https://github.com/qiniu/ruby-sdk/pull/94](https://github.com/qiniu/ruby-sdk/pull/94)
+1 -1
View File
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
qiniu (6.2.4)
qiniu (6.3.1)
json (~> 1.7)
mime-types (~> 1.19)
rest-client (~> 1.6)
+2 -2
View File
@@ -2,7 +2,7 @@
## 关于
此 Ruby SDK 适用于 Ruby 1.8.x, 1.9.x, 2.0.x, jruby, rbx, ree 版本,基于 [七牛云存储官方API](http://developer.qiniu.com/docs/v6/index.html) 构建。使用此 SDK 构建您的网络应用程序,能让您以非常便捷地方式将数据安全地存储到七牛云存储上。无论您的网络应用是一个网站程序,还是包括从云端(服务端程序)到终端(手持设备应用)的架构的服务或应用,通过七牛云存储及其 SDK,都能让您应用程序的终端用户高速上传和下载,同时也让您的服务端更加轻盈。
此 Ruby SDK 适用于 Ruby 1.9.x, 2.0.x, 2.1.x, jruby版本,基于 [七牛云存储官方API](http://developer.qiniu.com/docs/v6/index.html) 构建。使用此 SDK 构建您的网络应用程序,能让您以非常便捷地方式将数据安全地存储到七牛云存储上。无论您的网络应用是一个网站程序,还是包括从云端(服务端程序)到终端(手持设备应用)的架构的服务或应用,通过七牛云存储及其 SDK,都能让您应用程序的终端用户高速上传和下载,同时也让您的服务端更加轻盈。
## 状态
@@ -15,7 +15,7 @@
在您 Ruby 应用程序的 `Gemfile` 文件中,添加如下一行代码:
gem 'qiniu', '~> 6.1.0'
gem 'qiniu', '~> 6.3.1'
然后,在应用程序所在的目录下,可以运行 `bundle` 安装依赖包:
+16
View File
@@ -3,6 +3,7 @@
require 'hmac-sha1'
require 'uri'
require 'cgi'
require 'qiniu/exceptions'
@@ -175,6 +176,21 @@ module Qiniu
return "#{download_url}&token=#{dntoken}"
end # authorize_download_url
### 对包含中文或其它 utf-8 字符的 Key 做下载授权
def authorize_download_url_2(domain, key, args = EMPTY_ARGS)
url_encoded_key = CGI::escape(key)
schema = args[:schema] || "http"
port = args[:port]
if port.nil? then
download_url = "#{schema}://#{domain}/#{url_encoded_key}"
else
download_url = "#{schema}://#{domain}:#{port}/#{url_encoded_key}"
end
return authorize_download_url(download_url, args)
end # authorize_download_url_2
def generate_acctoken(url, body = '')
### 提取AK/SK信息
access_key = Config.settings[:access_key]
+1 -1
View File
@@ -20,7 +20,7 @@ module Qiniu
:content_type => 'application/x-www-form-urlencoded',
:auth_url => "https://acc.qbox.me/oauth2/token",
:rs_host => "http://rs.qiniu.com",
:up_host => "http://up.qiniu.com",
:up_host => "http://upload.qiniu.com",
:pub_host => "http://pu.qbox.me:10200",
:eu_host => "http://eu.qbox.me",
:access_key => "",
+2
View File
@@ -4,6 +4,8 @@ require 'hmac-sha1'
require 'qiniu/config'
require 'qiniu/utils'
### AccessToken 类已经过时,请改用 Qiniu::Auth.generate_acctoken 方法 ###
module Qiniu
class AccessToken
+3
View File
@@ -4,6 +4,9 @@ require 'json'
require 'qiniu/tokens/access_token'
require 'qiniu/utils'
### DownloadToken 类已经过时,请改用 Qiniu::Auth.authorize_download_url 方法 ###
### 或 Qiniu::Auth.authorize_download_url_2 方法 ###
module Qiniu
class DownloadToken < AccessToken
+10 -2
View File
@@ -4,6 +4,8 @@ require 'json'
require 'qiniu/tokens/access_token'
require 'qiniu/utils'
### UploadToken 类已经过时,请改用 Qiniu::Auth.generate_uptoken 方法 ###
module Qiniu
class UploadToken < AccessToken
@@ -19,7 +21,9 @@ module Qiniu
@callback_body_type = opts[:callback_body_type]
@customer = opts[:customer]
@escape = opts[:escape]
@async_options = opts[:async_options]
@persistent_ops = opts[:persistent_ops]
@persistent_notify_url = opts[:persistent_notify_url]
@persistent_pipeline = opts[:persistent_pipeline]
@return_body = opts[:return_body]
@return_url = opts[:return_url]
end
@@ -31,9 +35,13 @@ module Qiniu
params[:callbackBodyType] = @callback_body_type if !@callback_body_type.nil? && !@callback_body_type.empty?
params[:customer] = @customer if !@customer.nil? && !@customer.empty?
params[:escape] = 1 if @escape == 1 || @escape == true
params[:asyncOps] = @async_options if !@async_options.nil? && !@async_options.empty?
params[:returnBody] = @return_body if !@return_body.nil? && !@return_body.empty?
params[:returnUrl] = @return_url if !@return_url.nil? && !@return_url.empty?
params[:persistentOps] = @persistent_ops if !@persistent_ops.nil? && !@persistent_ops.empty?
params[:persistentNotifyUrl] = @persistent_notify_url if !@persistent_notify_url.nil? && !@persistent_notify_url.empty?
params[:persistentPipeline] = @persistent_pipeline if !@persistent_pipeline.nil? && !@persistent_pipeline.empty?
Utils.urlsafe_base64_encode(params.to_json)
end
+2 -2
View File
@@ -3,8 +3,8 @@
module Qiniu
module Version
MAJOR = 6
MINOR = 2
PATCH = 4
MINOR = 3
PATCH = 1
# Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and <tt>PATCH</tt> with <tt>'.'</tt>
#
# Example