Method: PF::Action#push
- Defined in:
- lib/pf/action/action.rb
#push(file, bucket) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pf/action/action.rb', line 9 def push(file, bucket) Qiniu.establish_connection! access_key: account.access_key, secret_key: account.secret_key key = File.basename(file) put_policy = Qiniu::Auth::PutPolicy.new( bucket, key, 3600 ) uptoken = Qiniu::Auth.generate_uptoken(put_policy) filePath = file code, result, response_headers = Qiniu::Storage.upload_with_token_2( uptoken, filePath, key, nil, bucket: bucket ) end |