lib/cloudfiles/container.rb in cloudfiles-1.4.7 vs lib/cloudfiles/container.rb in cloudfiles-1.4.8
- old
+ new
@@ -131,12 +131,12 @@
#
# Returns an empty array if no object exist in the container. Throws an InvalidResponseException
# if the request fails.
def objects(params = {})
paramarr = []
- paramarr << ["limit=#{URI.encode(params[:limit].to_i.to_s).gsub(/&/,'%26')}"] if params[:limit]
- paramarr << ["offset=#{URI.encode(params[:offset].to_i.to_s).gsub(/&/,'%26')}"] if params[:offset]
+ paramarr << ["limit=#{URI.encode(params[:limit].to_s).gsub(/&/,'%26')}"] if params[:limit]
+ paramarr << ["offset=#{URI.encode(params[:offset].to_s).gsub(/&/,'%26')}"] if params[:offset]
paramarr << ["prefix=#{URI.encode(params[:prefix]).gsub(/&/,'%26')}"] if params[:prefix]
paramarr << ["path=#{URI.encode(params[:path]).gsub(/&/,'%26')}"] if params[:path]
paramstr = (paramarr.size > 0)? paramarr.join("&") : "" ;
response = self.connection.cfreq("GET",@storagehost,"#{@storagepath}?#{paramstr}",@storageport,@storagescheme)
return [] if (response.code == "204")
@@ -162,12 +162,12 @@
# :bytes=>"22"}
# }
def objects_detail(params = {})
paramarr = []
paramarr << ["format=xml"]
- paramarr << ["limit=#{URI.encode(params[:limit].to_i).gsub(/&/,'%26')}"] if params[:limit]
- paramarr << ["offset=#{URI.encode(params[:offset].to_i).gsub(/&/,'%26')}"] if params[:offset]
+ paramarr << ["limit=#{URI.encode(params[:limit].to_s).gsub(/&/,'%26')}"] if params[:limit]
+ paramarr << ["offset=#{URI.encode(params[:offset].to_s).gsub(/&/,'%26')}"] if params[:offset]
paramarr << ["prefix=#{URI.encode(params[:prefix]).gsub(/&/,'%26')}"] if params[:prefix]
paramarr << ["path=#{URI.encode(params[:path]).gsub(/&/,'%26')}"] if params[:path]
paramstr = (paramarr.size > 0)? paramarr.join("&") : "" ;
response = self.connection.cfreq("GET",@storagehost,"#{@storagepath}?#{paramstr}",@storageport,@storagescheme)
return {} if (response.code == "204")
@@ -259,15 +259,9 @@
def make_public(options = {:ttl => 86400})
if options.is_a?(Fixnum)
print "DEPRECATED: make_public takes a hash of options now, instead of a TTL number"
ttl = options
options = {:ttl => ttl}
- end
- if options[:ttl] < 3600
- options[:ttl] = 3600
- end
- if options[:ttl] > 259200
- options[:ttl] = 259200
end
response = self.connection.cfreq("PUT",@cdnmgmthost,@cdnmgmtpath,@cdnmgmtport,@cdnmgmtscheme)
raise NoSuchContainerException, "Container #{@name} does not exist" unless (response.code == "201" || response.code == "202")