lib/cloudinary/uploader.rb in cloudinary-1.0.48 vs lib/cloudinary/uploader.rb in cloudinary-1.0.49
- old
+ new
@@ -19,22 +19,22 @@
:transformation => Cloudinary::Utils.generate_transformation_string(options.clone),
:public_id=> options[:public_id],
:callback=> options[:callback],
:format=>options[:format],
:type=>options[:type],
- :backup=>options[:backup],
- :faces=>options[:faces],
- :exif=>options[:exif],
- :colors=>options[:colors],
- :image_metadata=>options[:image_metadata],
- :invalidate=>options[:invalidate],
+ :backup=>Cloudinary::Utils.as_safe_bool(options[:backup]),
+ :faces=>Cloudinary::Utils.as_safe_bool(options[:faces]),
+ :exif=>Cloudinary::Utils.as_safe_bool(options[:exif]),
+ :colors=>Cloudinary::Utils.as_safe_bool(options[:colors]),
+ :image_metadata=>Cloudinary::Utils.as_safe_bool(options[:image_metadata]),
+ :invalidate=>Cloudinary::Utils.as_safe_bool(options[:invalidate]),
:eager=>build_eager(options[:eager]),
:headers=>build_custom_headers(options[:headers]),
- :use_filename=>options[:use_filename],
+ :use_filename=>Cloudinary::Utils.as_safe_bool(options[:use_filename]),
:notification_url=>options[:notification_url],
:eager_notification_url=>options[:eager_notification_url],
- :eager_async=>options[:eager_async],
+ :eager_async=>Cloudinary::Utils.as_safe_bool(options[:eager_async]),
:tags=>options[:tags] && Cloudinary::Utils.build_array(options[:tags]).join(",")}
params
end
def self.upload(file, options={})
@@ -54,9 +54,20 @@
{
:timestamp=>Time.now.to_i,
:type=>options[:type],
:public_id=> public_id,
:invalidate=>options[:invalidate],
+ }
+ end
+ end
+
+ def self.rename(from_public_id, to_public_id, options={})
+ call_api("rename", options) do
+ {
+ :timestamp=>Time.now.to_i,
+ :type=>options[:type],
+ :from_public_id=>from_public_id,
+ :to_public_id=>to_public_id,
}
end
end
def self.exists?(public_id, options={})