diff --git a/lib/qiniu.rb b/lib/qiniu.rb index 302125a..a79c220 100755 --- a/lib/qiniu.rb +++ b/lib/qiniu.rb @@ -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 diff --git a/lib/qiniu/config.rb b/lib/qiniu/config.rb index 68bd762..53cef8b 100755 --- a/lib/qiniu/config.rb +++ b/lib/qiniu/config.rb @@ -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", diff --git a/lib/qiniu/management.rb b/lib/qiniu/management.rb index 0c07401..1119cac 100755 --- a/lib/qiniu/management.rb +++ b/lib/qiniu/management.rb @@ -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|