File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -731,6 +731,21 @@ def self.create_folder(folder_name, options={})
731731 call_api ( :post , "folders/#{ folder_name } " , { } , options )
732732 end
733733
734+ # Renames existing asset folder.
735+ #
736+ # @param [String] from_path The full path of an existing asset folder.
737+ # @param [String] to_path The full path of the new asset folder.
738+ # @param [Hash] options The optional parameters.
739+ #
740+ # @return [Cloudinary::Api::Response]
741+ #
742+ # @raise [Cloudinary::Api::Error]
743+ #
744+ # @see https://cloudinary.com/documentation/admin_api#rename_folder
745+ def self . rename_folder ( from_path , to_path , options = { } )
746+ call_api ( :put , "folders/#{ from_path } " , { :to_folder => to_path } , options )
747+ end
748+
734749 # Lists upload mappings by folder and its mapped template (URL).
735750 #
736751 # @param [Hash] options The optional parameters. See the
Original file line number Diff line number Diff line change 741741 res = @mock_api . create_folder ( UNIQUE_TEST_FOLDER )
742742 expect ( res ) . to have_deep_hash_values_of ( expected )
743743 end
744+ it 'should rename folder' do
745+ expected = {
746+ [ :url ] => /.*\/ folders\/ #{ UNIQUE_TEST_FOLDER } $/ ,
747+ [ :method ] => :put ,
748+ [ :payload , :to_folder ] => UNIQUE_TEST_FOLDER + "_new" ,
749+ }
750+ res = @mock_api . rename_folder ( UNIQUE_TEST_FOLDER , UNIQUE_TEST_FOLDER + "_new" )
751+ expect ( res ) . to have_deep_hash_values_of ( expected )
752+ end
744753 it "should support listing folders" do
745754 res = @mock_api . root_folders
746755 expect ( res ) . to have_deep_hash_values_of ( [ :url ] => /.*\/ folders$/ , [ :method ] => :get )
You can’t perform that action at this time.
0 commit comments