Created
November 28, 2013 09:41
-
-
Save lintianzhi/7689450 to your computer and use it in GitHub Desktop.
qiniu ruby sdk v3, upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'qiniu-rs' | |
Qiniu::RS.establish_connection! :access_key => 'access key', | |
:secret_key => 'secret key' | |
bucket_name = 'test963' | |
token = Qiniu::RS.generate_upload_token :scope => bucket_name, | |
:expires_in => 3600 | |
# :callback_url => callback_url, | |
# :callback_body => callback_body, | |
# :callback_body_type => callback_body_type, | |
# :customer => end_user_id, | |
# :escape => allow_upload_callback_api, | |
# :async_options => async_callback_api_commands, | |
# :return_body => custom_response_body | |
puts token | |
ret = Qiniu::RS.upload_file :uptoken => token, | |
:file => 'file_path', | |
:bucket => bucket_name, | |
:key => 'keys' | |
puts ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
没注释,代码凌乱...
https://gist.github.com/jay16/7689655