mirror of
https://github.com/wahyd4/ruby-sdk.git
synced 2026-08-09 04:46:10 +10:00
Merge pull request #95 from BluntBlade/master
添加 authorize_download_url_2 方法,对包含中文或其它 utf-8 字符的Key做下载授权。
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
## CHANGE LOG
|
||||
|
||||
### 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
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
qiniu (6.2.4)
|
||||
qiniu (6.3.0)
|
||||
json (~> 1.7)
|
||||
mime-types (~> 1.19)
|
||||
rest-client (~> 1.6)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
在您 Ruby 应用程序的 `Gemfile` 文件中,添加如下一行代码:
|
||||
|
||||
gem 'qiniu', '~> 6.2.0'
|
||||
gem 'qiniu', '~> 6.3.0'
|
||||
|
||||
然后,在应用程序所在的目录下,可以运行 `bundle` 安装依赖包:
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
module Qiniu
|
||||
module Version
|
||||
MAJOR = 6
|
||||
MINOR = 2
|
||||
PATCH = 4
|
||||
MINOR = 3
|
||||
PATCH = 0
|
||||
# Returns a version string by joining <tt>MAJOR</tt>, <tt>MINOR</tt>, and <tt>PATCH</tt> with <tt>'.'</tt>
|
||||
#
|
||||
# Example
|
||||
|
||||
Reference in New Issue
Block a user