Skip to content

Commit e2a0447

Browse files
committed
add delete folder method
1 parent 6d782df commit e2a0447

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/imagekitio/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ def create_folder(folder_name, parent_folder_path)
132132
@file.create_folder(folder_name, parent_folder_path)
133133
end
134134

135+
def delete_folder(folder_path)
136+
@file.delete_folder(folder_path)
137+
end
138+
135139
def phash_distance(first, second)
136140
# Get hamming distance between two phash(image hash) to check
137141
# similarity between images

lib/imagekitio/file.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ def create_folder(folder_name, parent_folder_path)
178178
@req_obj.request('post', url, @req_obj.create_headers, payload)
179179
end
180180

181+
def delete_folder(folder_path)
182+
if folder_path == '' || folder_path.nil?
183+
raise ArgumentError, 'folder_path is required'
184+
end
185+
url = "#{constants.BASE_URL}/folder"
186+
payload = { 'folderPath': folder_path }
187+
@req_obj.request('delete', url, @req_obj.create_headers, payload)
188+
end
189+
181190
def validate_upload_options(options)
182191

183192
# Validates upload value, checks if params are valid,

0 commit comments

Comments
 (0)