mirror of
https://github.com/wahyd4/ruby-sdk.git
synced 2026-08-09 04:46:10 +10:00
add Qiniu.fetch method
This commit is contained in:
@@ -118,6 +118,11 @@ module Qiniu
|
||||
code == StatusOK
|
||||
end
|
||||
|
||||
def fetch(bucket, target_url, key)
|
||||
code, data = Storage.fetch(bucket, target_url, key)
|
||||
code == StatusOK
|
||||
end
|
||||
|
||||
def batch(command, bucket, keys)
|
||||
code, data = Storage.batch(command, bucket, keys)
|
||||
code == StatusOK ? data : false
|
||||
|
||||
@@ -20,6 +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",
|
||||
:fetch_host => "http://iovip.qbox.me",
|
||||
:rsf_host => "http://rsf.qbox.me",
|
||||
:up_host => "http://up.qiniu.com",
|
||||
:pub_host => "http://pu.qbox.me:10200",
|
||||
|
||||
@@ -82,6 +82,11 @@ module Qiniu
|
||||
return HTTP.management_post(url)
|
||||
end # delete
|
||||
|
||||
def fetch(bucket, target_url, key)
|
||||
url = Config.settings[:fetch_host] + '/fetch/' + Utils.urlsafe_base64_encode(target_url) + '/to/' + encode_entry_uri(bucket, key)
|
||||
return HTTP.management_post(url)
|
||||
end # fetch
|
||||
|
||||
def batch(command, bucket, keys)
|
||||
execs = []
|
||||
keys.each do |key|
|
||||
|
||||
Reference in New Issue
Block a user