From b176c7a604fa57c1cb4882fa9f46d027f2b3d6f8 Mon Sep 17 00:00:00 2001 From: huobazi Date: Sat, 18 Aug 2012 23:22:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=A1=A3=E4=B8=AD=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=20Qiniu::RS.generate=5Fupload=5Ftoke=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=B8=BA=E5=8F=AF=E9=80=89,=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=E4=B8=BA3600,=E4=BD=86=E4=BB=A3=E7=A0=81=E4=B8=AD?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E7=9A=84=E5=A4=84=E7=90=86=E5=B9=B6=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=80=83=E8=99=91=E5=8F=82=E6=95=B0=E6=9C=AA=E4=BC=A0?= =?UTF-8?q?=E5=80=BC=E6=97=B6=E5=8F=96=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: http://docs.qiniutek.com/v3/sdk/ruby/#upload --- lib/qiniu/tokens/upload_token.rb | 2 +- spec/qiniu/rs_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/qiniu/tokens/upload_token.rb b/lib/qiniu/tokens/upload_token.rb index 0542762..5fb22b3 100755 --- a/lib/qiniu/tokens/upload_token.rb +++ b/lib/qiniu/tokens/upload_token.rb @@ -14,7 +14,7 @@ module Qiniu def initialize(opts = {}) @scope = opts[:scope] - @expires_in = opts[:expires_in] + @expires_in = opts[:expires_in] || 3600 @callback_url = opts[:callback_url] @callback_body_type = opts[:callback_body_type] @customer = opts[:customer] diff --git a/spec/qiniu/rs_spec.rb b/spec/qiniu/rs_spec.rb index 215b0b4..8f2a32a 100755 --- a/spec/qiniu/rs_spec.rb +++ b/spec/qiniu/rs_spec.rb @@ -115,7 +115,7 @@ module Qiniu context ".upload_file" do it "should works" do - uptoken_opts = {:scope => @bucket, :expires_in => 3600} + uptoken_opts = {:scope => @bucket} upload_opts = { :uptoken => Qiniu::RS.generate_upload_token(uptoken_opts), :file => __FILE__, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bafee2d..78f5edc 100755 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,7 +8,7 @@ RSpec.configure do |config| config.before :all do #=begin Qiniu::RS.establish_connection! :access_key => "3fPHl_SLkPXdioqI_A8_NGngPWVJhlDk2ktRjogH", - :secret_key => "bXTPMDJrVYRJUiSDRFtFYwycVD_mjXxYWrCYlDHy", + :secret_key => "bXTPMDJrVYRJUiSDRFtFYwycVD_mjXxYWrCYlDHy" #=end =begin Qiniu::RS.establish_connection! :access_key => "bE21M6FW9V7zAFrBY5psgKOKJQLiBj12qMWTpc57",